Dockerを使用して開発用にDiscourseをインストールする

IMHO、これらの関連投稿は別のトピックとして作成すべきです。そうすれば、これらの投稿が自動的に削除されても失われることがありませんし、プラグインの開発者や開発を検討している方々にとって、これは知っておくべき「ハウツー」トピックだからです。

「いいね!」 1

こんにちは、

手順に従いましたが、アプリが起動せず、ブラウザのコンソールに以下のエラーが表示されます。
“ReferenceError: Discourse is not defined”
解決策をご教示ください。

よろしくお願いいたします。

「いいね!」 1

この構成で約 6 ヶ月ほど運用していましたが、今日いつもの Docker ワークフローが、Discourse がデータベースに接続できないというエラーメッセージで失敗しました。

これは最近の Postgres 13 アップグレードによる問題でしょうか?

多くの失敗の後、boot init をやり直すことにしました。すべての 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

同じ問題かどうかはわかりませんが、私も同様の問題に直面しました。原因は、コンテナ内のいくつかのファイルへのアクセス権限で、Postgres がそれらにアクセスできず、起動しなかったことです。そのヒントは Postgres のログにありましたので、ぜひ確認してみてください。

「いいね!」 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 を付けてアクセスしてみましたが、うまくいきませんでした。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 data を実行し、その後 d/boot_dev --init を再度実行するだけで、システムが正常に復旧するのでしょうか?ただし、「復元」という部分の意味が少し不明確です。その点について詳しく教えていただけますか?

「いいね!」 1

はい、必要なデータがあったため、既存のデータをクリアしてバックアップから復元を行いました。

「いいね!」 2

data を削除して再初期化することで、環境が再び動作するようになりました。そのため、テスト中のプラグインを含むアプリが使用できるようになりました。ただし、自分のプラグインと、それが自分だけの問題ではないか確認するために試した別のプラグインに対してテストを実行すると、エラーが発生します。この件については別途トピックを投稿しましたが、Docker 設定に関連しているかどうかわからないため、こちらにも転載しました。

「いいね!」 2

Ubuntu WSL 2 を Windows で使用しています。

以下のコマンドを実行すると:
d/boot_dev --init

何も起こらず、新しい行が空で表示されるだけで、実行の兆候もありません。何が起きているのかご存知でしょうか?Docker と git はインストール済みです。

よろしくお願いいたします。

「いいね!」 1
  1. Docker は Windows 本体ではなく、WSL 2 内にインストールしましたよね?
  2. コマンドを実行しているディレクトリはどこですか?discourse リポジトリのルートディレクトリから実行する必要があります。
「いいね!」 2

はい、Windows と Ubuntu WSL 2 の両方に Docker をインストールしました。
また、/discourse ディレクトリからコマンドを実行しました。
しかし、Enter キーを押しても何も表示されません。

エラーログさえも表示されません。どこから手をつければよいか分からず、非常にフラストレーションが溜まります。

「いいね!」 1

皆様、こんにちは。質問です:Digital Ocean のワンクリックインストール(https://marketplace.digitalocean.com/apps/discourse)を使用する場合、これは開発環境と見なされるのでしょうか?事前に無知をお詫びしますが、本番環境と開発環境の違いが理解できず、プラグイン開発の長い学習の旅を始めるにあたり、お手伝いいただければ幸いです。

いくつかの状況があります:(1) 古い Mac(2012 年製)と古い OS(10.12.6)を持っており、ターミナルから Discourse のローカルインストールに必要なものをすべて手動でインストールすることができません。多くのコンポーネントをソースからビルドする必要があり、最終的に「make」が終了しない問題に直面します。(2) 過去に Digital Ocean のワンクリック droplet で Discourse フォーラムを正常に作成したことはありますが、本番環境用だけで、開発用ではありませんでした。

ご助力、ご指導、ご助言をいただければ大変嬉しく思います!

「いいね!」 1

こんにちは!

WSL を使用して Windows に Discourse をインストールすることに成功しました。

私が実施した前提条件は以下の通りです。

  • WSL のバージョン 2 を有効化
  • Ubuntu 20.04 を使用
  • ディストリビューションの設定 : ) 以下の指示に従って準備完了です

ディストリビューション内のホームフォルダ(/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