Install Discourse for development using Docker

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

Hi all, question: if I use Digital Oceanā€™s one-click install (https://marketplace.digitalocean.com/apps/discourse) is this considered a developing environment? Iā€™m sorry in advance for my ignorance, but Iā€™m having trouble understanding what separates production from developing environments, and Iā€™d like to start the long slow journey on learning plugin development.

A few things: (1) I have and old mac (2012) with an old OS (10.12.6), and I canā€™t manually install via terminal all that is needed for a local installation of discourse ā€“ I have to build much from source, and eventually I run into a ā€œmakeā€ that never ends, and (2) I have successfully created discourse forums on one-click DO droplets in the past, but only for production ā€“ not development.

Any and all help/guidance/advice would be much appreciated!

1 Like

Hello!

I have managed to install Discourse on Windows using WSL.

Prerequisites that i have done.

  • Enable WSL with version 2
  • I am using Ubuntu 20.04
  • Set up your distribution :slight_smile: Follow the given instructions and you are ready to go

In the distribution, under my home home folder, /home/cosmin.

  • Install Docker as instructed in the first post. The installation part of docker.io was not necessary for me. I only executed sudo usermod -a -G docker $USER
  • After the Docker installation is complete, start the service with sudo docker service start and check it
  • cd discourse
  • Run d/boot_dev --init and wait to finish
  • Run in discourse folder, run d/unicorn and you are ready yo go

Note:
If the commands are reporting permissions error, try with sudo

Hope this helps :slight_smile:
Have a nice day or evening!
Cosmin

4 Likes

Thanks for sharing your setup; however, I donā€™t have Windows. Iā€™m specifically curious about the one-click Digital Ocean setup ā€“ is it suitable for development?

1 Like