From 2afe4aa779c8b97c4f139c7d6d85f0509ffc34ff Mon Sep 17 00:00:00 2001 From: jmilljr24 <16829344+jmilljr24@users.noreply.github.com> Date: Tue, 17 Dec 2024 19:33:30 -0500 Subject: [PATCH 1/2] set host --- config/database.yml | 2 ++ docker-compose.yml | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/config/database.yml b/config/database.yml index 3be5568eb..ee59a0911 100644 --- a/config/database.yml +++ b/config/database.yml @@ -43,12 +43,14 @@ development: cable: <<: *default database: cable + host: cable migrations_paths: db/cable_migrate gssencmode: disable queue: <<: *default database: queue + host: queue migrations_paths: db/queue_migrate gssencmode: disable diff --git a/docker-compose.yml b/docker-compose.yml index 2de3b1891..23a787036 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: . From c4c0db7879c8da01c3e0475fdca2cc20185ca37d Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 18 Dec 2024 10:09:09 -0800 Subject: [PATCH 2/2] Set localhost in application.yml for people running locally --- README.md | 2 ++ config/application.example.yml | 4 ++-- config/database.yml | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7fbc76912..fac02a7ea 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/config/application.example.yml b/config/application.example.yml index d21c22170..760572946 100644 --- a/config/application.example.yml +++ b/config/application.example.yml @@ -2,5 +2,5 @@ DATABASE_USERNAME: REPLACE_ME DATABASE_PASSWORD: REPLACE_ME - - +CABLE_HOST: localhost +QUEUE_HOST: localhost diff --git a/config/database.yml b/config/database.yml index ee59a0911..7f4ee15e4 100644 --- a/config/database.yml +++ b/config/database.yml @@ -43,14 +43,14 @@ development: cable: <<: *default database: cable - host: cable + host: <%= ENV.fetch('CABLE_HOST') { 'cable' } %> migrations_paths: db/cable_migrate gssencmode: disable queue: <<: *default database: queue - host: queue + host: <%= ENV.fetch('QUEUE_HOST') { 'queue' } %> migrations_paths: db/queue_migrate gssencmode: disable