你好 ![]()
我仍在尝试构建能与 Discourse 协同工作的流水线。
我已经准备好了一个全新的 Redis 容器和一个全新的 Postgres 容器,供 Discourse 使用。
接下来,我需要构建 web_only 容器的镜像,然后将它们连接起来并启动安装(如果我理解正确的话),但我无法成功启动该容器。
我遇到了以下错误:
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 ** 请向上滚动查看更早的错误信息,可能不止一条。
./discourse-doctor 可能有助于诊断问题。
我不明白为什么在我尚未构建任何东西的情况下,系统却尝试执行迁移。是不是我的步骤有误?
这是我正在使用的 web_only.yml 文件(非常基础):
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 集群可以获取更新,并将其部署到从开发到生产环境的各个环境中。
再次感谢大家提供的帮助与支持。![]()