# Install Discourse for development using Docker

**URL:** https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009
**Category:** Developer Guides
**Tags:** docker, dev-install, how-to
**Created:** [November 16, 2018, 9:40am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009 "2018-11-16T09:40:04Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://meta.discourse.org/u/EricGT)
#### Post date: [October 17, 2020, 9:45am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/128 "2020-10-17T09:45:52Z")

</div>

> [@aleber](#):
>
> To run a single plugin test suite

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.

---

<div class="post-metadata">

### Author: ![Mustafa\_Butt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mustafa_butt/32/199069_2.png) [@Mustafa\_Butt](https://meta.discourse.org/u/Mustafa_Butt)
#### Post date: [November 3, 2020, 5:58pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/129 "2020-11-03T17:58:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![bletch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bletch/32/69088_2.png) [@bletch](https://meta.discourse.org/u/bletch)
#### Post date: [December 11, 2020, 5:20pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/130 "2020-12-11T17:20:27Z")

</div>

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:

```bash
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.

```bash
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.

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

```

Any pointers?

---

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [December 11, 2020, 5:38pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/131 "2020-12-11T17:38:45Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![bletch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bletch/32/69088_2.png) [@bletch](https://meta.discourse.org/u/bletch)
#### Post date: [December 11, 2020, 8:40pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/132 "2020-12-11T20:40:35Z")

</div>

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.

```plaintext
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.

---

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [December 11, 2020, 10:50pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/133 "2020-12-11T22:50:02Z")

</div>

> [@bletch](#):
>
> - Last resort how can I nuke the current data so boot\_dev --init re-creates the database at Postgres 13?

This bit is mentioned on the first post:

> [@rishabh](#):
>
> - Data is persisted between invocations of the container in your source root `tmp/postgres` directory. If for any reason you want to reset your database run:
> 
> ```plaintext
> sudo rm -fr data
> 
> ```

---

<div class="post-metadata">

### Author: ![Mikitos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mikitos/32/183953_2.png) [@Mikitos](https://meta.discourse.org/u/Mikitos)
#### Post date: [December 15, 2020, 5:07pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/134 "2020-12-15T17:07:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)
#### Post date: [December 25, 2020, 12:39am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/135 "2020-12-25T00:39:08Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 25, 2020, 3:49pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/136 "2020-12-25T15:49:37Z")

</div>

```
bundle install
rake db:migrate

```

Should do it

---

<div class="post-metadata">

### Author: ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)
#### Post date: [January 9, 2021, 4:22pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/137 "2021-01-09T16:22:36Z")

</div>

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):

```plaintext
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**
>
> ```plaintext
> ** 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:

```plaintext
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?

---

<div class="post-metadata">

### Author: ![bletch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bletch/32/69088_2.png) [@bletch](https://meta.discourse.org/u/bletch)
#### Post date: [January 9, 2021, 7:35pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/138 "2021-01-09T19:35:34Z")

</div>

See my post above.

> [@Install Discourse for development using Docker](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009/130):
>
> 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@Bletc…

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.

> [@Install Discourse for development using Docker](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009/132):
>
> 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 …

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

---

<div class="post-metadata">

### Author: ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)
#### Post date: [January 9, 2021, 9:22pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/139 "2021-01-09T21:22:20Z")

</div>

> [@bletch](#):
>
> In the end I went nuclear, recreated the data and restored.

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.

---

<div class="post-metadata">

### Author: ![bletch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bletch/32/69088_2.png) [@bletch](https://meta.discourse.org/u/bletch)
#### Post date: [January 10, 2021, 5:57pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/140 "2021-01-10T17:57:18Z")

</div>

> [@seanblue](#):
>
> I’m not sure what you mean by “restored” though if you could clarify that part.

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

---

<div class="post-metadata">

### Author: ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)
#### Post date: [January 18, 2021, 2:29pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/141 "2021-01-18T14:29:16Z")

</div>

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.

> [@Plugin tests fail with "undefined method \`test\_transaction='"](https://meta.discourse.org/t/plugin-tests-fail-with-undefined-method-test-transaction/176292):
>
> I built [a plugin](https://github.com/seanblue/discourse-ruby) last year and wanted to verify that it still works on the latest version of Discourse. After reinitializing my dev environment (I had DB migration issues) I was able to manually verify that the plugin still works. However, when I run my [spec tests](https://github.com/seanblue/discourse-ruby/blob/master/spec/markdown_ruby_spec.rb) (which passed last year when I wrote them), I get the following error: Failure/Error: DB.test\_transaction = ActiveRecord::Base.connection.current\_transaction NoMethodError: undefined method `test\_transaction=' for…

---

<div class="post-metadata">

### Author: ![abalone](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@abalone](https://meta.discourse.org/u/abalone)
#### Post date: [January 20, 2021, 3:47am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/142 "2021-01-20T03:47:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![seanblue](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@seanblue](https://meta.discourse.org/u/seanblue)
#### Post date: [January 20, 2021, 12:42pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/143 "2021-01-20T12:42:50Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![abalone](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@abalone](https://meta.discourse.org/u/abalone)
#### Post date: [January 20, 2021, 7:53pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/144 "2021-01-20T19:53:02Z")

</div>

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.

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/5/055cf91b13bf31ade685b0a051c3866d7058eae6.png)

---

<div class="post-metadata">

### Author: ![Joshua\_Kogan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joshua_kogan/32/127595_2.png) [@Joshua\_Kogan](https://meta.discourse.org/u/Joshua_Kogan)
#### Post date: [January 23, 2021, 7:23pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/145 "2021-01-23T19:23:12Z")

</div>

Hi all, question: if I use Digital Ocean’s one-click install ([Discourse | DigitalOcean Marketplace 1-Click App](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!

---

<div class="post-metadata">

### Author: ![Cosmin\_Popescu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cosmin_popescu/32/95102_2.png) [@Cosmin\_Popescu](https://meta.discourse.org/u/Cosmin_Popescu)
#### Post date: [January 24, 2021, 8:03am UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/146 "2021-01-24T08:03:08Z")

</div>

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 🙂 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](http://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 🙂  
Have a nice day or evening!  
Cosmin

---

<div class="post-metadata">

### Author: ![Joshua\_Kogan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joshua_kogan/32/127595_2.png) [@Joshua\_Kogan](https://meta.discourse.org/u/Joshua_Kogan)
#### Post date: [January 24, 2021, 5:27pm UTC](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009/147 "2021-01-24T17:27:02Z")

</div>

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?

[Previous page](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009.md?page=2)

[Next page](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009.md?page=4)
