[openstreetmap/openstreetmap-website] Support for Development Containers (devcontainers) (PR #6424)

Andy Allan notifications at github.com
Wed Oct 29 17:16:34 UTC 2025


@gravitystorm commented on this pull request.

This is great, thanks for working on this. It appears to be approximately 600% more complicated to set up than I had expected! Particularly around the selenium stuff.

I haven't yet tested it in action, but I've a few questions from reviewing the code. It turns out running devcontainers on vscodium is more difficult than I thought, so I need to figure out some clean way for me to test it without messing up my regular development environment.

> +# variable when you boot the app. For example:
+#
+#   DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
+#
+# If the connection URL is provided in the special DATABASE_URL environment
+# variable, Rails will automatically merge its configuration values on top of
+# the values provided in this file. Alternatively, you can specify a connection
+# URL environment variable explicitly:
+#
+#   production:
+#     url: <%= ENV["MY_APP_DATABASE_URL"] %>
+#
+# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
+# for a full overview on how database connection configuration can be specified.
+#
+production:

I don't think this section is necessary, and it's a bit confusing having references to migration paths that don't exist.

> +
+  # Schema search path. The server defaults to $user,public
+  #schema_search_path: myapp,sharedapp,public
+
+  # Minimum log levels, in increasing order:
+  #   debug5, debug4, debug3, debug2, debug1,
+  #   log, notice, warning, error, fatal, and panic
+  # Defaults to warning.
+  #min_messages: notice
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+  <<: *default
+  database: open_street_map_test

To reduce confusion, I think we should keep the same database names that are used in `docker.database.yml` and `example.database.yml`

> +
+  // Features to add to the dev container. More info: https://containers.dev/features.
+  "features": {
+    "ghcr.io/devcontainers/features/github-cli:1": {},
+    "ghcr.io/devcontainers/features/node:1": {},
+    "ghcr.io/rails/devcontainer/features/activestorage": {},
+    "ghcr.io/rails/devcontainer/features/postgres-client": {}
+  },
+
+  "containerEnv": {
+    "CAPYBARA_SERVER_PORT": "45678",
+    "DB_HOST": "postgres"
+  },
+
+  // Use 'forwardPorts' to make a list of ports inside the container available locally.
+  "forwardPorts": [3000, 5432, 6379],

3000 = rails app, 5432 = postgres, those seem reasonable. But as I understand it, 6379 is redis, and is that used at all?

Also just to check - do the ports get forwarded to the correct containers - specifically does 5432 get forwarded to the postgres container? I'm no expert on container routing.

> +
+## Other tools
+
+VS Code is not the only way to work with devcontainers. Other options include:
+
+- [RubyMine](https://www.jetbrains.com/help/ruby/start-dev-container-inside-ide.html): another popular environment to work with Ruby.
+- [DevPod](https://devpod.sh): a CLI tool to work with devcontainers.
+
+## Troubleshooting
+
+### `‘ruby’: No such file or directory`
+
+In some cases Ruby may not install correctly. If you see this message, run these two commands:
+
+```
+mise install

I don't understand what mise is used for, particularly when it's referring to installing ruby. Is the ruby binary not already installed in the container (`FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION`)?

I can see the mise cache being configured, but I can see any mise commands being run here (other than mise trust, see separate comment). 

> @@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+# This setup uses https://mise.jdx.dev to manage language versions.
+# Mark the config file as trusted to avoid an interactive prompt.
+mise trust /workspaces/mise.local.toml

I don't see a `mise.local.toml` file anywhere - where does it come from? Is it in one of the container images?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6424#pullrequestreview-3394872346
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6424/review/3394872346 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251029/9dd260d7/attachment.htm>


More information about the rails-dev mailing list