Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 1 addition & 1 deletion Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ brew "ghostscript"
brew "imagemagick"
cask "temurin@21"
brew "poppler"
brew "postgresql@14"
brew "postgresql"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be that we want to remove this line. We require binaries though. We can get them from libpq instead but it requires a modification of PATH which we don't have a standard tool to do. I recommend mise if we proceed down that path.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is as reasonable as anything else if there isn't a brew formula for the exact binaries we need.

brew "postgis"
brew "rbenv"
brew "yarn"
Expand Down
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ FileUtils.chdir APP_ROOT do
system! "yarn install"

puts "\n== Starting database =="
system! "brew services stop postgresql"
system! "docker compose pull db"
system! "docker compose up --wait -d db"
Comment on lines +51 to 52
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer stopping Postgres because other projects might be using it. Should be sufficient to just start on another port. This up call should stop and restart if env vars change and assign the new ports. pull to check for updates to the specified image before uping.


puts "\n== Preparing database =="
Expand Down
2 changes: 0 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ deploy_default: &deploy_default
development:
<<: *local_default
database: vita-min_development
username: <%= ENV.fetch("RAILS_DB_USERNAME", 'postgres') %>
password: <%= ENV.fetch("RAILS_DB_PASSWORD", 'password') %>
Comment on lines -19 to -20
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need this after using .env. Shouldn't have made it in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what "shouldn't have made it in" means here & just want to double check to make sure I'm not missing something - these lines were added by Melanie when she added the docker compose file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these lines in my last merge. They're unnecessary because they only matter in development and we're already using .env in development so we should be dealing with it there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad - i was looking at the very similar lines 7-8 up in local_default

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the same rationale for removing these lines apply now to those ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm inclined to leave them alone. Ports rarely change and username / password additionally are allowable to be entirely nil. This differs from setting them to '' because it switches postgres into trust authentication, if enabled.


# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
Expand Down
16 changes: 8 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ services:
image: postgis/postgis:13-3.4-alpine
user: postgres
ports:
- 127.0.0.1:5432:5432
- 127.0.0.1:${RAILS_DB_PORT:-5432}:5432
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unusual notation of ${SOME_ENV_VAR:-value} allows you to set value as a default value when SOME_ENV_VAR is not set or otherwise empty.

volumes:
- database:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_USER: ${RAILS_DB_USERNAME:-postgres}
POSTGRES_PASSWORD: ${RAILS_DB_PASSWORD:-password}
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-d", "postgres"]
interval: 30s
Expand All @@ -31,11 +31,11 @@ services:
web:
condition: service_healthy
environment:
- DOCKER=true
- RAILS_DB_HOST=db
- RAILS_DB_USERNAME=postgres
- RAILS_DB_PORT=5432
- RAILS_DB_PASSWORD=password
DOCKER: true
RAILS_DB_HOST: db
RAILS_DB_USERNAME: ${RAILS_DB_USERNAME:-postgres}
RAILS_DB_PORT: ${RAILS_DB_PORT:-5432}
RAILS_DB_PASSWORD: ${RAILS_DB_PASSWORD:-password}
web:
container_name: web
build:
Expand Down
Loading