Install Discourse for development using Docker

There is no way to docker Discourse on a Mac with a M1 chip currently right?

When running d/boot_dev --init, I was running into this error:

ActiveRecord::NoDatabaseError: We could not find your database: discourse_development. Available database configurations can be found in config/database.yml. (ActiveRecord::NoDatabaseError)

I’m not sure if this is a bug in the boot_dev script, or if the discourse_development database is supposed to be created somewhere else. Either way, I was able to fix it with this change:

diff --git a/bin/docker/boot_dev b/bin/docker/boot_dev
index 89fdcf6f65..0e9c5ce7d5 100755
--- a/bin/docker/boot_dev
+++ b/bin/docker/boot_dev
@@ -122,6 +122,7 @@ echo "pnpm install..."
 
 if [ "${initialize}" = "initialize" ]; then
     echo "Migrating database..."
+    "${SCRIPTPATH}/rake" db:create
     "${SCRIPTPATH}/rake" db:migrate
     RAILS_ENV=test "${SCRIPTPATH}/rake" db:migrate

After that, the setup process ran properly, following the instructions in the OP.

I’m not familiar enough with the Discourse codebase to know whether this is the correct fix, but I’m happy to submit a PR if that would help. :slightly_smiling_face:

4 Likes

Oh yes please create a PR and link it here. Thanks!

2 Likes

Done!

1 Like