Skip to content

Commit

Permalink
Docker db (#1277)
Browse files Browse the repository at this point in the history
* set host

* Set localhost in application.yml for people running locally

---------

Co-authored-by: jmilljr24 <[email protected]>
  • Loading branch information
kasugaijin and jmilljr24 authored Dec 18, 2024
1 parent 02718a3 commit 991f763
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
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

0 comments on commit 991f763

Please sign in to comment.