# Move from standalone container to separate web and data containers

**URL:** https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413
**Category:** Sysadmins
**Tags:** docker, how-to, advanced-setup, two-container
**Created:** [5월 29, 2015, 2:12오후 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413 "2015-05-29T14:12:22Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![dfriestedt](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dfriestedt](https://meta.discourse.org/u/dfriestedt)
#### Post date: [11월 10, 2019, 5:18오후 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/27 "2019-11-10T17:18:29Z")

</div>

별개의 컨테이너를 원격 데이터베이스와 함께 구현하려고 시도하고 있습니다. 위의 설명과 원격 Postgres DB를 설정하는 [가이드](https://meta.discourse.org/t/running-discourse-with-a-separate-postgresql-server/46375)를 따랐습니다. 설정은 정상적으로 작동하지만, 왜 동일한 데이터베이스에 대한 두 개의 동일한 참조가(각각 web\_only와 data 아래에) 존재하는지 궁금합니다. 이는 제가 무언가를 잘못하고 있으며, web\_only 컨테이너가 data 컨테이너를 전혀 사용하지 않는다는 느낌을 줍니다.

제가 올바르게 하고 있는 건가요?

제 설정은 다음과 같습니다.

web\_only.yml에 다음을 추가했습니다:

```
  DISCOURSE_DB_SOCKET: ''
  DISCOURSE_DB_USERNAME: REMOVE
  DISCOURSE_DB_PASSWORD: REMOVE
  DISCOURSE_DB_HOST: xxx.ondigitalocean.com
  DISCOURSE_DB_NAME: REMOVE
  DISCOURSE_DB_PORT: 25060
  DISCOURSE_DB_BACKUP_PORT: 25060
  DISCOURSE_REDIS_HOST: data

```

data.yml에서는

postgres.template.yml을 제거했습니다.

```
templates:
# - "templates/postgres.template.yml"
  - "templates/redis.template.yml"

```

또한 다음을 추가했습니다:

```
env:
  # 컨테이너 내에 로케일이 존재하는지 확인하세요. 설치할 수 있습니다.
  LANG: en_US.UTF-8
  DISCOURSE_DB_USERNAME: REMOVE
  DISCOURSE_DB_PASSWORD: REMOVE
  DISCOURSE_DB_HOST: REMOVE.ondigitalocean.com
  DISCOURSE_DB_NAME: REMOVE
  DISCOURSE_DB_PORT: 25060
  DISCOURSE_DB_BACKUP_PORT: 25060

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [11월 10, 2019, 9:05오후 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/28 "2019-11-10T21:05:16Z")

</div>

원격 데이터베이스를 사용 중이라면, 데이터베이스가 포함된 데이터 컨테이너를 만들 필요가 없습니다. postgres와 redis가 모두 필요하므로(이를 위해 데이터 컨테이너가 필요할 수 있음) 참고해 주세요.

---

<div class="post-metadata">

### Author: ![wanghaisheng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wanghaisheng/32/163707_2.png) [@wanghaisheng](https://meta.discourse.org/u/wanghaisheng)
#### Post date: [12월 24, 2019, 10:18오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/30 "2019-12-24T10:18:41Z")

</div>

> [@5minpause](#):
>
> ### 새 사이트를 위한 2개 컨테이너 설정
> 
> @pfaffman이 2019-12-11에 추가함.
> 
> 참고: 2개 컨테이너 사이트를 만들려면 다음을 사용할 수 있습니다:
> 
> ```plaintext
> ./discourse-setup 2container
> 
> ```

하지만 여기서는 오류 없이 컨테이너 1개만 실행되고 있습니다.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [12월 24, 2019, 10:43오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/31 "2019-12-24T10:43:24Z")

</div>

두 개의 컨테이너가 정확히 무엇을 의미하는지는 모르겠지만, 두 개의 컨테이너가 두 개의 독립적인 Discourse 인스턴스를 의미한다고 가정하신다면 방향을 잘못 잡고 계신 것입니다.

이 글은 고급 사용자가 유연성을 원할 때 유용한, 별도의 애플리케이션과 데이터베이스 컨테이너를 설정하는 방법에 대해 안내합니다.

같은 머신에 두 개의 Discourse 사이트를 설치/호스팅하려는 경우, discourse multisite를 참고해 보세요:  
[Multisite configuration with Docker](https://meta.discourse.org/t/multisite-configuration-with-docker/14084?u=itsbhanusharma)

---

<div class="post-metadata">

### Author: ![wanghaisheng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wanghaisheng/32/163707_2.png) [@wanghaisheng](https://meta.discourse.org/u/wanghaisheng)
#### Post date: [12월 24, 2019, 10:47오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/32 "2019-12-24T10:47:29Z")

</div>

컨테이너라고 한 것은, 호스트 머신에서 `docker ps`를 입력하면 실행 중인 두 개의 컨테이너를 볼 수 있다는 뜻입니다.

두 번째로, 이 두 컨테이너에 대해 도메인 이름을 설정하는 방법을 찾지 못했습니다.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [12월 24, 2019, 10:50오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/33 "2019-12-24T10:50:09Z")

</div>

그래서 어떤 컨테이너가 실행 중이었나요? app 컨테이너였다고 가정하면, 아니요, 구버전의 discourse-setup을 실행하고 있는 것입니다.

최신 버전의 discourse-setup을 사용하고 있는지 확인하기 위해 진행하기 전에 git pull을 실행하십시오.

data 또는 web-only 컨테이너가 실행 중이었다면, 다른 컨테이너가 시작되지 않은 원인을 확인해야 합니다. 일반적으로 web-only 컨테이너는 포트 80/443에서 이미 프로세스(웹 서버)가 실행 중이기 때문에 시작에 실패합니다.

---

<div class="post-metadata">

### Author: ![wanghaisheng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wanghaisheng/32/163707_2.png) [@wanghaisheng](https://meta.discourse.org/u/wanghaisheng)
#### Post date: [12월 24, 2019, 10:53오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/34 "2019-12-24T10:53:08Z")

</div>

네, 앱입니다.  
아니요, 오늘 GitHub에서 소스 코드를 git clone했습니다.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [12월 24, 2019, 10:58오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/35 "2019-12-24T10:58:35Z")

</div>

직접 시도해 보지는 않았지만, @pfaffman은 이걸 만든 천재이므로 도움을 줄 수 있을 것 같습니다.

GitHub의 discourse-setup 코드를 살펴봤는데, 작동하지 않을 수 있는 명백한 문제는 보이지 않습니다.

서버를 어떤 OS에서 실행하고 계신가요?

---

<div class="post-metadata">

### Author: ![wanghaisheng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wanghaisheng/32/163707_2.png) [@wanghaisheng](https://meta.discourse.org/u/wanghaisheng)
#### Post date: [12월 24, 2019, 11:03오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/36 "2019-12-24T11:03:01Z")

</div>

서버: ubuntu

현재 스탠드얼론 컨테이너를 성공적으로 실행했습니다.

지금 이 방법을 시도하고 있습니다: [Success - New Multisite Install on Dedicated server using ServerPilot, Nginx and Apache](https://meta.discourse.org/t/success-new-multisite-install-on-dedicated-server-using-serverpilot-nginx-and-apache/28108)

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [12월 24, 2019, 11:04오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/37 "2019-12-24T11:04:40Z")

</div>

멀티사이트를 구현하려는 건가요, 아니면 멀티 컨테이너를?

---

<div class="post-metadata">

### Author: ![wanghaisheng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wanghaisheng/32/163707_2.png) [@wanghaisheng](https://meta.discourse.org/u/wanghaisheng)
#### Post date: [12월 24, 2019, 11:10오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/38 "2019-12-24T11:10:19Z")

</div>

말씀드린 대로 벤치마크를 수행했습니다. 1개월간 스탠얼론 포럼을 운영했는데, 새로운 포럼을 만들려고 여러 방법을 시도해 보았습니다.

1. 같은 서버에서 별도의 스탠얼론 컨테이너를 실행하는 것: 실패
2. 웹과 데이터베이스를 각각 다른 컨테이너로 구성하는 멀티사이트 Docker ([Multisite configuration with Docker](https://meta.discourse.org/t/multisite-configuration-with-docker/14084) 참고): 실패
3. 2컨테이너 방식: 실패
4. [Success - New Multisite Install on Dedicated server using ServerPilot, Nginx and Apache](https://meta.discourse.org/t/success-new-multisite-install-on-dedicated-server-using-serverpilot-nginx-and-apache/28108) 이 방법은 현재 시도 중이며, 성공할지 모르겠습니다.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [12월 24, 2019, 11:14오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/39 "2019-12-24T11:14:14Z")

</div>

2개의 독립적인 컨테이너만 실행하려는 경우, 다른 디렉터리와 포트를 사용하도록 yml 파일을 수정해야 합니다. 필요에 따라 letsencrypt도 비활성화할 수 있습니다.

---

<div class="post-metadata">

### Author: ![wanghaisheng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wanghaisheng/32/163707_2.png) [@wanghaisheng](https://meta.discourse.org/u/wanghaisheng)
#### Post date: [12월 24, 2019, 11:17오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/40 "2019-12-24T11:17:01Z")

</div>

이 모든 것이 수정된 후, 초보자를 위한 튜토리얼을 작성하고 싶습니다.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [12월 24, 2019, 11:21오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/41 "2019-12-24T11:21:06Z")

</div>

참고로, 성능 벤치마킹을 원하신다면 프로덕션 머신에서 하지 마세요. 대신 별도의 VPS를 띄워서 벤치마킹에 사용하시는 것이 좋습니다.

같은 머신에서 Discourse 인스턴스 두 개를 동시에 실행하면 설치 환경이 심각하게 손상될 수 있으므로 권장하지 않습니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [12월 24, 2019, 11:55오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/42 "2019-12-24T11:55:03Z")

</div>

해당 명령은 실행 시점에 app.yml 파일이 없는 경우에만 데이터 컨테이너와 웹 컨테이너를 각각 생성합니다. 웹 컨테이너를 두 개 생성하지는 않습니다.

---

<div class="post-metadata">

### Author: ![wanghaisheng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wanghaisheng/32/163707_2.png) [@wanghaisheng](https://meta.discourse.org/u/wanghaisheng)
#### Post date: [12월 24, 2019, 11:58오전 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/43 "2019-12-24T11:58:30Z")

</div>

이 명령어를 실행하기 전에 app.yml 파일이 이미 있는 것 같습니다.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [12월 24, 2019, 12:23오후 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/44 "2019-12-24T12:23:42Z")

</div>

> [@pfaffman](#):
>
> app.yml 파일이 없을 때에만

이 부분은 매우 중요하다고 생각하는데, 원문(OP)에 추가하고 GitHub에도 함께 올려야 하지 않을까요?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [12월 24, 2019, 12:25오후 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/45 "2019-12-24T12:25:52Z")

</div>

이 기능을 문서화하지 않는 편이 나았을 것 같습니다. 그리고 실제로 _이동_을 두 컨테이너 구성으로 변경하는 것은 도움이 되지 않으므로, 여기에는 애초에 속하지 않는 것 같습니다.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [12월 24, 2019, 12:28오후 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/46 "2019-12-24T12:28:15Z")

</div>

아마도 전용 #howto 채널이 있으면 좋겠네요?

상세하지 않아도, 고급 discourse 모험에 도전해보고 싶은 분들에게 매우 유용할 수 있습니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [12월 24, 2019, 1:18오후 UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/47 "2019-12-24T13:18:21Z")

</div>

그럴 수도 있겠네요. 정말 큰 도움이 되긴 하지만, discourse-setup과 마찬가지로 매우 구체적인 목적, 즉 매우 표준적인 신규 설치에 특화되어 있습니다. 제 설치 스크립트에서는 꽤 오랫동안 사용해 왔습니다. 기존 컨테이너에서 백업하고 새 컨테이너에 복원하는 작업을 감수할 의사가 있다면, 두 개의 컨테이너로 전환하는 쉬운 방법이기도 합니다.

제 우려는 항상 유지보수가 어려울 것이라는 점이었습니다. 이 방식을 이해하지 못하는 사람들이 사용하려다 보니 문서를 활용할 수 없고, 'rebuild app’이 더 이상 작동하지 않으며, 데이터베이스 컨테이너를 언제 다시 빌드해야 하는지도 파악하기 어렵기 때문입니다. 최근에는 Redis가 3.0이었는데 4.0이 요구되어 재빌드가 실패한 적이 있습니다. 또한 Postgres도 업데이트가 필요했는데, 이는 특정 순서로 단계를 따라야 했으며, 데이터 컨테이너를 언제 재빌드하고 웹 컨테이너를 언제 재빌드해야 하는지, 그리고 권장 경로에서 경로를 어떻게 변경해야 하는지 알아야 했습니다. 제 경우엔 모든 과정이 순조롭게 끝났지만, bash가 무엇인지도 모르는 사람에게 포럼에서 이를 전달하는 것은 관련자 모두에게 답답한 일이었을 것입니다.

사람들이 스스로를 보호할 수 있도록, 표준이 아닌 설치를 만드는 장벽을 상당히 높게 유지하는 것이 최선이라고 생각합니다.

[이전 페이지](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413.md?page=1)

[다음 페이지](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413.md?page=3)
