Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker db #1277

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ cp config/application.example.yml config/application.yml
Update your `config/application.yml` by replacing the places that say REPLACE_ME. If you installed and configured PostgreSQL as discussed above
you can use your username and leave the password blank for development.

If you have already set up this application locally, and are now getting errors related to Queue or Cable database hosts, please update your `config/application.yml` to specify the host as localhost for these databases (see `config/application.example.yml`).

Run the setup script to prepare DB and assets
```sh
bin/setup
Expand Down
4 changes: 2 additions & 2 deletions config/application.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

DATABASE_USERNAME: REPLACE_ME
DATABASE_PASSWORD: REPLACE_ME


CABLE_HOST: localhost
QUEUE_HOST: localhost
2 changes: 2 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ development:
cable:
<<: *default
database: cable
host: <%= ENV.fetch('CABLE_HOST') { 'cable' } %>
migrations_paths: db/cable_migrate
gssencmode: disable

queue:
<<: *default
database: queue
host: <%= ENV.fetch('QUEUE_HOST') { 'queue' } %>
migrations_paths: db/queue_migrate
gssencmode: disable

Expand Down
26 changes: 24 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,33 @@ services:
POSTGRES_USER: ${DATABASE_USERNAME:-postgres}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-password}
ports:
- 5432:5432
- 54320:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USERNAME:-postgres} -d petrescue_development"]
test:
[
"CMD-SHELL",
"pg_isready -U ${DATABASE_USERNAME:-postgres} -d petrescue_development",
]
interval: 10s

cable:
image: postgres:14
environment:
POSTGRES_DB: cable
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 54321:5432

queue:
image: postgres:14
environment:
POSTGRES_DB: queue
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 54322:5432

app:
build:
context: .
Expand Down
Loading