Add compose.yml for new apps#403
Open
aaronmallen wants to merge 1 commit intomainfrom
Open
Conversation
Contributor
|
ℹ️ Optional job failed: Ruby jruby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Generates a
compose.ymlfile when a new app is created with either thepostgresormysqldatabase adapter, so users can spin up a local database withdocker compose upwithout any extra setup.Design choices
Why
compose.ymlinstead ofdocker-compose.ymlThe Compose Specification (which Docker Compose v2 implements) treats
compose.yaml/compose.ymlas the canonical filename.docker-compose.ymlis still supported, but only for backwards compatibility with v1.From the Docker documentation:
Generating new projects with the modern name avoids steering users toward a legacy convention they would eventually need to migrate away from.
Why the database has no password
The generated
compose.ymlusesPOSTGRES_HOST_AUTH_METHOD: trustfor Postgres andMYSQL_ALLOW_EMPTY_PASSWORD: "yes"for MySQL. A few reasons:.env,config/db.rb, and the composeenvironmentblock, and kept in sync across all three. Any drift produces a confusing connection error on first run, which is a bad first experience for a brand new app.localhost, so the unauthenticated socket is not exposed beyond the developer's machine.hanami db createout of the box. Users can runhanami new,docker compose up, andhanami db createin sequence with no further configuration.closes hanami/roadmap/issues/27