使用 Docker 为开发安装 Discourse

依我看,这些相关帖子应该单独开一个主题,这样即使这些帖子被自动删除也不会丢失。此外,对于我们这些正在开发或计划开发插件的人来说,这是一个必须掌握的“操作指南”主题。

1 个赞

您好,

我已按照说明操作,但应用无法运行,浏览器控制台中出现以下错误:
“ReferenceError: Discourse 未定义”
希望能找到解决方案。
谢谢

1 个赞

我按此配置运行了大约 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 个赞

不确定是否是同一个问题,但我遇到了类似的情况,原因是容器内某些文件的权限设置导致 PostgreSQL 无法访问,从而无法启动。相关提示可以在 PostgreSQL 日志中找到,不妨查看一下?

2 个赞

感谢你的建议 @mentalstring。奇怪的是,Postgres 主日志 /var/log/postgresql/postgresql-13-main.log 是空的。

但在 /var/log/ 目录下的其他一些文件中有一个线索。文件 /var/log/postgres/current 完全被重复的错误填满,例如:

2020-12-11 20:06:34.875 UTC [11680] FATAL:  database files are incompatible with server
2020-12-11 20:06:34.875 UTC [11680] DETAIL:  The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 13.1 (Debian 13.1-1.pgdg100+1).

经过一番仔细搜索后发现,原始数据库格式不兼容,需要运行 pg_upgrade 命令。

我在 PATH 中找不到该命令。无论如何,进一步的搜索表明,基于 Docker 的系统在处理此问题时存在困难,因为需要同时存在旧版和新版的 Postgres 才能正常工作。

在此向任何能提供帮助的人提出几个问题:

  • 对于此次升级,在开发环境中使用 Docker 是否存在根本性问题?
  • 我是否漏掉了某个步骤?
  • 我现在可以转换吗?
  • 作为最后手段,我该如何清除当前数据,以便通过 boot_dev --init 重新在 Postgres 13 上创建数据库?

提前感谢。

1 个赞

第一帖中提到了这一点:

4 个赞

我在 VPS 上按照此说明进行了安装,但无法访问新安装的 Discourse。我尝试通过 VPS 的 IP 地址加上端口 9292 来访问 Discourse,但没有成功。我认为由于 Docker 接口的原因,暴露的端口可能不同。

编辑:
算了,我忘了在 Docker 中全局暴露端口。

2 个赞

今年初我搭建了一个开发环境来构建插件。现在我想确保该插件在最新版本的 Discourse 上仍能正常运行。我是应该从头创建一个新的开发环境(新的 Docker 容器、数据库等),还是直接从这样一个旧的构建中升级到最新版本更简单?我偶尔会听到关于生产环境中数据库迁移的讨论,因此对此我最不确定。如果继续使用当前的环境,在从 Git 拉取代码后,我需要做什么?

1 个赞

运行以下命令即可:

bundle install
rake db:migrate
2 个赞

I’m not able to get this working. I pulled the latest from the master branch, and then here’s what I did:

  1. d/boot_dev (works)
  2. d/bundle install (works)
  3. d/rails db:migrate RAILS_ENV=development as indicated in the OP, or d/rake db:migrate as you recommended (neither of them work)

Here’s the error I get for one of them (the other is basically the same):

rails 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>'
bin/rails:17:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment

And here’s the full trace if I add --trace as the error message recommends:

Full trace
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
rails 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"?
/usr/local/lib/ruby/gems/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize'
/usr/local/lib/ruby/gems/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `new'
/usr/local/lib/ruby/gems/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/postgresql_adapter.rb:46:in `postgresql_connection'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_handling.rb:189:in `connection'
/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>'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:318:in `block in load'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:318:in `load'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/engine.rb:666:in `block in load_config_initializer'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/notifications.rb:182:in `instrument'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/engine.rb:665:in `load_config_initializer'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/engine.rb:625:in `block (2 levels) in <class:Engine>'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/engine.rb:624:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/engine.rb:624:in `block in <class:Engine>'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:32:in `run'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
/usr/local/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/usr/local/lib/ruby/2.7.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
/usr/local/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
/usr/local/lib/ruby/2.7.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:50:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:50:in `tsort_each_child'
/usr/local/lib/ruby/2.7.0/tsort.rb:415:in `call'
/usr/local/lib/ruby/2.7.0/tsort.rb:415:in `each_strongly_connected_component_from'
/usr/local/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
/usr/local/lib/ruby/2.7.0/tsort.rb:347:in `each'
/usr/local/lib/ruby/2.7.0/tsort.rb:347:in `call'
/usr/local/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
/usr/local/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
/usr/local/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/application.rb:363:in `initialize!'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/railtie.rb:190:in `public_send'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/railtie.rb:190:in `method_missing'
/src/config/environment.rb:7:in `<main>'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `block in require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/application.rb:339:in `require_environment!'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/application.rb:523:in `block in run_tasks_blocks'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `synchronize'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:241:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:241:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `synchronize'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:241:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:241:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `synchronize'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/command.rb:48:in `invoke'
/usr/local/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/commands.rb:18:in `<main>'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/usr/local/lib/ruby/gems/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `block in require'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency'
/usr/local/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
bin/rails:17:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment

Besides it sounding like it can’t connect to the database, I have no idea what any of this means. I don’t even know how to tell if a database migration is even necessary, other than me assuming it is from chatter on the forums over the last year.

Once this failed I figured I’d try just running d/unicorn in case the database migration wasn’t relevant, but that also failed with the following error at the end:

7: from /usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
	 6: from /usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
	 5: from /usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
	 4: from /usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
	 3: from /usr/local/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/postgresql_adapter.rb:46:in `postgresql_connection'
	 2: from /usr/local/lib/ruby/gems/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
	 1: from /usr/local/lib/ruby/gems/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `new'
/usr/local/lib/ruby/gems/2.7.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

So it seems to be the same issue effectively. Any suggestions for how to fix this connection issue or anything else that you may notice being wrong based on the traces?

1 个赞

请查看我上面的帖子。

这可能与我的问题有关。

我的直觉是,我的问题与迁移到 Postgres 13 有关。该迁移在完整安装时会自动执行,但在开发环境中不会运行(这是我的假设)。

请查看我的后续帖子。

最终,我采取了最彻底的办法:重新创建数据并恢复。

1 个赞

是啊,反正我也没什么值得保留的数据。所以,如果能行的话,清除所有数据应该是最简单的办法。我只需要再次运行 sudo rm -fr datad/boot_dev --init 就能让系统恢复正常了吗?不过,我不太明白你说的“恢复”具体是指什么,能否详细说明一下?

1 个赞

是的,我确实有需要保留的数据,所以先清空了数据,然后从备份进行了恢复。

2 个赞

我通过删除 data 并重新初始化,成功让环境恢复运行,现在可以正常使用应用,包括我正在测试的插件。不过,当我对插件以及另一个我特意尝试的插件运行测试时,遇到了错误。我已经为此单独发布了一个主题,但我不确定这是否与我的 Docker 配置有关,因此想在此交叉发布。

2 个赞

我在 Windows 上使用 Ubuntu WSL 2。

运行以下命令时:
d/boot_dev --init

没有任何反应。它只是换了一行,没有显示任何执行迹象。请问这是怎么回事?Docker 和 git 已安装。

谢谢。

1 个赞
  1. 您是在 WSL 2 中安装了 Docker,而不是直接在 Windows 上安装,对吗?
  2. 您是从哪个目录运行该命令的?它应该是 discourse 仓库的顶层目录。
2 个赞

是的,我确实在 Windows 和 Ubuntu WSL 2 中都安装了 Docker。
我也确实从 /discourse 目录执行了该命令。
但按下回车键后没有任何反应。

甚至没有任何错误日志或其他提示。因此,对于该从何入手感到相当沮丧。

1 个赞

大家好,有个问题:如果我使用 Digital Ocean 的一键安装(https://marketplace.digitalocean.com/apps/discourse),这是否被视为开发环境?提前为我的无知道歉,但我一直不太理解生产环境与开发环境的区别,我想开始漫长而缓慢的插件开发学习之旅。

几点情况:(1) 我有一台旧款 Mac(2012 年),运行旧版操作系统(10.12.6),无法通过终端手动安装 Discourse 本地部署所需的全部依赖;我必须从源码构建很多东西,最终会遇到一个无法结束的 make 过程。(2) 过去我曾在一键式 Digital Ocean Droplet 上成功部署过 Discourse 论坛,但仅用于生产环境,而非开发环境。

非常感激任何帮助、指导或建议!

1 个赞

你好!

我已成功在 Windows 上使用 WSL 安装了 Discourse。

我已完成的先决条件:

  • 启用 WSL 版本 2
  • 我使用的是 Ubuntu 20.04
  • 配置您的发行版 :slight_smile: 按照给定的说明操作,即可开始使用

在发行版中,位于我的家目录 /home/cosmin 下。

  • 按照第一篇帖子的说明安装 Docker。对我来说,安装 docker.io 的部分并非必要。我只执行了 sudo usermod -a -G docker $USER
  • Docker 安装完成后,使用 sudo docker service start 启动服务并进行检查
  • cd discourse
  • 运行 d/boot_dev --init 并等待完成
  • 在 discourse 文件夹中运行 d/unicorn,即可开始使用

注意:
如果命令报告权限错误,请尝试使用 sudo

希望这对您有帮助 :slight_smile:
祝您度过愉快的一天或夜晚!
Cosmin

4 个赞

感谢您分享您的配置;不过,我没有 Windows 系统。我特别想了解一键式 Digital Ocean 部署方案——它是否适合开发使用?

1 个赞