mirror of
https://github.com/docker/compose.git
synced 2025-07-22 13:14:29 +02:00
Use official images in rails tutorial
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
This commit is contained in:
parent
796df302dd
commit
406425a6b9
@ -28,7 +28,7 @@ Next, we have a bootstrap `Gemfile` which just loads Rails. It'll be overwritten
|
|||||||
Finally, `fig.yml` is where the magic happens. It describes what services our app comprises (a database and a web app), how to get each one's Docker image (the database just runs on a pre-made PostgreSQL image, and the web app is built from the current directory), and the configuration we need to link them together and expose the web app's port.
|
Finally, `fig.yml` is where the magic happens. It describes what services our app comprises (a database and a web app), how to get each one's Docker image (the database just runs on a pre-made PostgreSQL image, and the web app is built from the current directory), and the configuration we need to link them together and expose the web app's port.
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: orchardup/postgresql
|
image: postgres
|
||||||
ports:
|
ports:
|
||||||
- "5432"
|
- "5432"
|
||||||
web:
|
web:
|
||||||
@ -62,19 +62,18 @@ Now that we've got a new `Gemfile`, we need to build the image again. (This, and
|
|||||||
|
|
||||||
$ fig build
|
$ fig build
|
||||||
|
|
||||||
The app is now bootable, but we're not quite there yet. By default, Rails expects a database to be running on `localhost` - we need to point it at the `db` container instead. We also need to change the username and password to align with the defaults set by `orchardup/postgresql`.
|
The app is now bootable, but we're not quite there yet. By default, Rails expects a database to be running on `localhost` - we need to point it at the `db` container instead. We also need to change the database and username to align with the defaults set by the `postgres` image.
|
||||||
|
|
||||||
Open up your newly-generated `database.yml`. Replace its contents with the following:
|
Open up your newly-generated `database.yml`. Replace its contents with the following:
|
||||||
|
|
||||||
development: &default
|
development: &default
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
encoding: unicode
|
encoding: unicode
|
||||||
database: myapp_development
|
database: postgres
|
||||||
pool: 5
|
pool: 5
|
||||||
username: docker
|
username: postgres
|
||||||
password: docker
|
password:
|
||||||
host: <%= ENV.fetch('DB_1_PORT_5432_TCP_ADDR', 'localhost') %>
|
host: db_1
|
||||||
port: <%= ENV.fetch('DB_1_PORT_5432_TCP_PORT', '5432') %>
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
<<: *default
|
<<: *default
|
||||||
|
Loading…
x
Reference in New Issue
Block a user