# 새 설치에서 web\_only 이미지를 생성할 수 없습니다

**URL:** https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221
**Category:** Self-hosting
**Tags:** two-container
**Created:** [2월 18, 2021, 4:20오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221 "2021-02-18T16:20:53Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![ann\_eav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ann_eav/32/207897_2.png) [@ann\_eav](https://meta.discourse.org/u/ann_eav)
#### Post date: [2월 18, 2021, 4:20오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/1 "2021-02-18T16:20:53Z")

</div>

안녕하세요 😊

Discourse와 함께 사용할 파이프라인을 만드는 것을 계속 시도하고 있습니다.  
Discourse와 함께 사용할 새 Redis 컨테이너와 새 Postgres 컨테이너를 준비했습니다.  
제가 이해하기로는 다음 단계는 web\_only 컨테이너의 이미지를 빌드한 후, 이들을 연결하고 설치를 시작하는 것인데, 컨테이너를 부트스트랩(bootstrap)하는 데 실패하고 있습니다.

다음과 같은 오류가 발생합니다:

```plaintext
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 4632 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
0e576a9672a887d23579100756224f920ab595b819874b5e7cbe4868f4234481
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

```

아직 아무것도 빌드하지 않았는데 왜 마이그레이션을 시도하는지 혼란스럽습니다. 제가 단계를 잘못 수행하고 있는 건가요?  
제가 사용 중인 web\_only.yml 파일입니다 (매우 기본적인 구성):

```plaintext
templates:
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
env:
  LANG: en_US.UTF-8
  UNICORN_WORKERS: 2
  DISCOURSE_DB_USERNAME: root
  DISCOURSE_DB_PASSWORD: my-secret-pw
  DISCOURSE_DB_HOST: 127.0.0.1
  DISCOURSE_DB_NAME: communities
  DISCOURSE_DEVELOPER_EMAILS: 'email@mail.com'
  DISCOURSE_HOSTNAME: 'localhost'
  DISCOURSE_REDIS_HOST: 127.0.0.1
  SKIP_POST_DEPLOYMENT_MIGRATIONS: 1
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-slack-official.git
          - git clone https://github.com/discourse/discourse-assign.git
run:
  - exec:
      cd: /var/www/discourse
      cmd:
        - sed -i 's/GlobalSetting.serve_static_assets/true/' config/environments/production.rb
        - bash -c "touch -a /shared/log/rails/{sidekiq,puma.err,puma}.log"
        - bash -c "ln -s /shared/log/rails/{sidekiq,puma.err,puma}.log log/"
        - sed -i 's/default \$scheme;/default https;/' /etc/nginx/conf.d/discourse.conf

```

부트스트랩 빌드를 수행할 때마다 Postgres와 Redis 컨테이너가 실행 중이어야 하나요? 이미지를 미리 준비해서 직접 업로드한 후, 데이터베이스에 대한 추가 작업 없이 환경에서 다시 실행할 수 있을 것이라 생각했거든요…

제가 구축하라는 파이프라인은 다음과 같습니다:

- Github Actions: 업데이트가 필요한 경우 이미지를 부트스트랩할 수 있어야 합니다.
  - 이미지를 비공개 레지스트리에 푸시합니다.

- 그런 다음 Kubernetes 클러스터가 업데이트를 가져와 dev부터 prod까지 환경에 배포합니다.

다시 한번 모든 도움과 지원에 감사드립니다. ✨

---

<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: [2월 18, 2021, 6:03오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/2 "2021-02-18T18:03:45Z")

</div>

문제는 컨테이너 내부에서 127이 작동하지 않는다는 점인 것 같습니다. 부트스트랩 과정에서 데이터베이스가 마이그레이션됩니다. 데이터베이스 마이그레이션을 원하지 않으시면 템플릿을 수정하거나 임시 데이터베이스를 사용해야 합니다.

---

<div class="post-metadata">

### Author: ![ann\_eav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ann_eav/32/207897_2.png) [@ann\_eav](https://meta.discourse.org/u/ann_eav)
#### Post date: [2월 19, 2021, 8:46오전 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/3 "2021-02-19T08:46:49Z")

</div>

답장 주셔서 감사합니다 🙂  
데이터베이스 마이그레이션을 피하거나 건너뛰는 방법을 알려주실 수 있을까요? SKIP\_POST\_DEPLOYMENT\_MIGRATIONS: 1을 설정하면 된다고 생각했는데…

---

<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: [2월 19, 2021, 1:47오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/4 "2021-02-19T13:47:18Z")

</div>

그렇게 할 수 없어요. 마이그레이션 후 폐기할 스크래치 데이터베이스를 생성하는 것을 추천합니다.

그렇게 할 때, 새 이미지를 배포하면 모든 해당 작업이 수행되는지 확인해야 합니다.

---

<div class="post-metadata">

### Author: ![ann\_eav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ann_eav/32/207897_2.png) [@ann\_eav](https://meta.discourse.org/u/ann_eav)
#### Post date: [2월 25, 2021, 8:47오전 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/5 "2021-02-25T08:47:50Z")

</div>

문제는 새 설치용으로 첫 이미지를 생성하고 있는데, 마이그레이션할 것이 없는데도 왜 데이터베이스 마이그레이션이 일어나는지 이해가 안 된다는 것입니다. ☹

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [2월 25, 2021, 12:12오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/6 "2021-02-25T12:12:51Z")

</div>

마이그레이션은 Rails 컨텍스트에서 사용되는 기술 용어입니다. 마이그레이션은 기본적으로 올바른 DB 구조를 생성합니다.

---

<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: [2월 25, 2021, 12:58오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/7 "2021-02-25T12:58:18Z")

</div>

데이터베이스에 필요한 테이블과 데이터가 입력되지 않으면 Discourse를 실행할 수 없습니다. 또한 에셋을 사전 컴파일해야 합니다. 다른 방식으로 배포를 시도할 계획이라면 이 과정이 어떻게 작동하는지 이해해야 합니다.

---

<div class="post-metadata">

### Author: ![ann\_eav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ann_eav/32/207897_2.png) [@ann\_eav](https://meta.discourse.org/u/ann_eav)
#### Post date: [2월 25, 2021, 2:58오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/8 "2021-02-25T14:58:28Z")

</div>

확인해 주셔서 감사합니다. 처음에는 포럼을 처음 실행할 때 첫 번째 DB 구조가 생성되는 줄 알았어요.

---

<div class="post-metadata">

### Author: ![ann\_eav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ann_eav/32/207897_2.png) [@ann\_eav](https://meta.discourse.org/u/ann_eav)
#### Post date: [2월 25, 2021, 2:59오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/9 "2021-02-25T14:59:14Z")

</div>

답변해 주셔서 정말 감사합니다. 이 문제에 대해 계속 생각해 보겠습니다. 제가 필요로 하는 방식으로 파이프라인을 구성하는 것이 불가능한 것 같습니다. ☹

---

<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: [2월 25, 2021, 3:21오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/10 "2021-02-25T15:21:46Z")

</div>

가능하지만, 명시적으로 그렇게 해야 합니다. 그리고 이미지를 구축하는 가장 쉬운 방법은 스크래치 데이터베이스를 마이그레이션하도록 하는 것입니다.

---

<div class="post-metadata">

### Author: ![ann\_eav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ann_eav/32/207897_2.png) [@ann\_eav](https://meta.discourse.org/u/ann_eav)
#### Post date: [2월 25, 2021, 3:30오후 UTC](https://meta.discourse.org/t/unable-to-create-web-only-image-for-a-fresh-install/180221/11 "2021-02-25T15:30:17Z")

</div>

그럼 팀원들에게 GitHub 파이프라인 동안 임시 Postgres DB를 요청하도록 설득해 보겠습니다. 도움을 주셔서 정말 감사합니다.
