Install Discourse for development using Docker

I did the same steps in a $5 DO droplet. Everything went fine. Now how do I expose my site so that I can access it ?

P.S. It works with ngrok. Doesn’t yet work with nginx reverse proxy to 9292

Thanks to this. You can do this on the server and avoid configuring nginx reverse proxy. Enjoying d/o docker+vscode remote setup :slight_smile:

use d/unicorn -D to run unicorn as daemon so the shell is still usable after starting the server.

Also you need atleast $10 d/o droplet.

3 Likes

I’m on a Mac with zsh (on iTerm2) and if I try to use symbolic link for plugins development I get stuck with this errors:

readlink: illegal option -- f
usage: readlink [-n] [file ...]

This because the Mac implementation of the readlink command is slightly different from the GNU one.

The easiest way to solve this is by doing this:

# brew install coreutils
# ln -s "$(which greadlink)" "$(dirname "$(which greadlink)")/readlink"

This will give you the possibility to use a compatible readlink version.

Please remember you need to have dirname "$(which greadlink)" value on your PATH in a position preceding the /usr/bin (where usually the original readlink is). On my case PATH is something like /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:... and the symbolik link to greadlink is in /usr/local/bin.

Reference: Fixing "readlink: illegal option -- f" error on a Mac

5 Likes

To run a single plugin test suite, you can do in this way:

# d/rake "plugin:spec[PLUGIN_NAME]"
1 Like

IMHO these related posts should be a separate topic so that it is not lost if these post become automatically deleted, but also because for those of us that developer or plan to develop plug-ins this is a howto (must know) topic.

1 Like

Hi,

I have followed the instructions but app is not running rather its giving this error in browser console.
“ReferenceError: Discourse is not defined”
Looking for the solution.
Thanks

1 Like

I’ve been running for 6 months or so in this configuration but today my usual workflow in docker fails with a message that Discourse can’t connect to the database.

Is there some issue caused by the recent Postgres 13 upgrade?

After many failed attempts I decided to re-do the boot init. I’ve removed all discourse_dev containers and have run:

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)

I’ve tried entering the container as root and running psql but it yields.

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"?

The Postgres inside the container has indeed been updated.

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

Any pointers?

1 Like

Not sure if it is the same issue, but I got a similar problem and was due to permissions on some files in the container that postgres couldn’t access and, hence, wouldn’t start. The hint for that was on postgres logs — have a look at those perhaps?

2 Likes

Thanks for the suggestion @mentalstring . Oddly, the Postgres main log /var/log/postgresql/postgresql-13-main.log is empty.

But there is a clue in some of the other files under the /var/log/ structure. The file /var/log/postgres/current is completely filled with repeated errors like this.

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.pgdg1
00+1).

Some judicious Googling reveals that the raw DB format is incompatible and that a pg_upgrade command needs to be run.

I can’t see that command in PATH. Either way, a further bit of Googling reveals that Docker-based system struggle with this as both the old and new versions of Postgres need to be present for it to work.

Some further questions for anyone that can help

  • Is this a fundamental problem with using Docker in development for this upgrade?
  • Did I somehow miss a step?
  • Can I convert now?
  • Last resort how can I nuke the current data so boot_dev --init re-creates the database at Postgres 13?

Thanks in advance.

1 Like

This bit is mentioned on the first post:

4 Likes

I followed this installation on a VPS, but I’m having trouble accessing the newly installed discourse. I tried accessing discourse from my VPS’ IP followed by the port 9292 with no luck. I believe the exposed port is different due to the docker interface.

Edit:
Nevermind I forgot to expose the ports globally on docker.

2 Likes

I set up a development environment at the beginning of this year to build a plugin. Now I want to make sure the plugin still works on the latest version of Discourse. Am I better off creating a new development environment from scratch (new docker container, database, etc.), or is it simple to get the latest version working from such an old build? I hear from time to time about database migrations in production environments, so that’s what I’m most unsure about. If I stick with my current environment, after I pull from git, what do I have to do?

1 Like
bundle install
rake db:migrate

Should do it

2 Likes

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 Like

See my post above.

It might be related.

My sense was that my problem was related to a migration to Postgres 13 that is automated on full installs but doesn’t get run on development. (an assumption).

See my followup post.

In the end I went nuclear, recreated the data and restored.

1 Like

Yeah, I don’t really have any data worth keeping anyway. So clearing all the data is probably the simplest approach if that’ll work. Was just running sudo rm -fr data and d/boot_dev --init again sufficient to gets things back up and running? I’m not sure what you mean by “restored” though if you could clarify that part.

1 Like

Yeah, I did have data I needed so cleared the data down and did a RESTORE from backup.

2 Likes

I did get my environment working again by deleting data and reinitializing, so now I can use the app including the plugin I was testing. However, I’m getting an error when I run tests against my plugin and another plugin that I tried to make sure it wasn’t just mine. I posted a separate topic about it, but I’m not sure if it’s related to my docker setup, so I wanted to cross-post here.

2 Likes

I am using Ubuntu WSL 2 in windows.

When I run:
d/boot_dev --init

nothing happens. It just starts a new line, with no execution signs. Any idea what’s going on here? Docker and git installed though.

Thank you.

1 Like
  1. You installed Docker within WSL 2 and not on Windows itself, right?
  2. What directory are you running the command from? It should be from the top-level directory in the discourse repo.
2 Likes

Yes, I did install docker in both windows as well as inside Ubuntu WSL 2.
And I did run the command from /discourse directory.
But nothing shows up when I press return.

Not even any error logs or anything. So, it’s quite frustrating to know where to start from.

1 Like