使用 Docker 为开发安装 Discourse

我按此配置运行了大约 6 个月,但今天我在 Docker 中的常规工作流程失败了,提示 Discourse 无法连接到数据库。

这是否由最近的 Postgres 13 升级引起的问题?

在多次尝试失败后,我决定重新执行启动初始化。我已删除所有 discourse_dev 容器,并运行了以下命令:

bletch@BletchUbuntu:~/RubymineProjects/discourse$ git pull
Already up-to-date.
bletch@BletchUbuntu:~/RubymineProjects/discourse$ rm -rf tmp/*
bletch@BletchUbuntu:~/RubymineProjects/discourse$ sudo d/boot_dev --init
Using script path: /home/bletch/RubymineProjects/discourse/bin/docker
Using source in:   /home/bletch/RubymineProjects/discourse
Using data in:     /home/bletch/RubymineProjects/discourse/data/postgres
Mounting symlinks for plugins:  -v /home/bletch/RubymineProjects/plugin_dev/discourse-onebox-assistant:/src/plugins/discourse-onebox-assistant:delegated -v /home/bletch/RubymineProjects/plugin_dev/school-points:/src/plugins/school-points:delegated -v /home/bletch/RubymineProjects/plugin_dev/discourse-custom-wizard:/src/plugins/discourse-custom-wizard:delegated
mount_plugin_symlinks=:  -v /home/bletch/RubymineProjects/plugin_dev/discourse-onebox-assistant:/src/plugins/discourse-onebox-assistant:delegated -v /home/bletch/RubymineProjects/plugin_dev/school-points:/src/plugins/school-points:delegated -v /home/bletch/RubymineProjects/plugin_dev/discourse-custom-wizard:/src/plugins/discourse-custom-wizard:delegated
release: Pulling from discourse/discourse_dev
Digest: sha256:0a9e857b7a225660463a47446fb28d6f8b92b0fc559310723300d59a950d9563
Status: Image is up to date for discourse/discourse_dev:release
docker.io/discourse/discourse_dev:release
d19dec96649b15cd03af4a3f68f3f8f97ec67d06caf274bef301b03c9e7548d9
Installing gems...
Fetching gem metadata from https://rubygems.org/.........
Using rake 13.0.1
...
[LOTS OF GEM DETAILS]
...
Bundle complete! 123 Gemfile dependencies, 209 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Migrating database...
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
/src/lib/site_settings/db_provider.rb:61:in `table_exists?'
/src/lib/site_settings/db_provider.rb:16:in `all'
/src/lib/site_settings/defaults_provider.rb:29:in `db_all'
/src/lib/site_setting_extension.rb:290:in `block in refresh!'
/src/lib/site_setting_extension.rb:287:in `synchronize'
/src/lib/site_setting_extension.rb:287:in `refresh!'
/src/lib/site_setting_extension.rb:522:in `block in setup_methods'
/src/config/initializers/004-message_bus.rb:120:in `<main>'
/src/config/environment.rb:7:in `<main>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)

我尝试以 root 身份进入容器并运行 psql,但结果如下:

root@discourse:/# psql 
psql: error: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

容器内的 Postgres 确实已更新。

root@discourse:/# psql -V
psql (PostgreSQL) 13.1 (Debian 13.1-1.pgdg100+1)

有什么建议吗?

1 个赞