Skip to content

Commit 2d86793

Browse files
fix prod db access
1 parent d635b9e commit 2d86793

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

samples/rails/.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
SECRET_KEY_BASE=example
2-
DATABASE_USERNAME=rails_user
2+
DATABASE_USERNAME=postgres
33
DATABASE_PASSWORD=secret
4+
DATABASE_HOST=db

samples/rails/app/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ FROM base
4444

4545
# Install packages needed for deployment
4646
RUN apt-get update -qq && \
47-
apt-get install --no-install-recommends -y curl libvips && \
47+
apt-get install --no-install-recommends -y curl libvips libpq-dev && \
4848
rm -rf /var/lib/apt/lists /var/cache/apt/archives
4949

5050
# Copy built artifacts: gems, application

samples/rails/app/config/database.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ default: &default
22
adapter: postgresql
33
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
44
username: <%= ENV["DATABASE_USERNAME"] %>
5-
password: <%= ENVs["DATABASE_PASSWORD"] %>
5+
password: <%= ENV["DATABASE_PASSWORD"] %>
66
host: <%= ENV["DATABASE_HOST"] %>
77
port: 5432
88
timeout: 5000

samples/rails/compose.dev.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ services:
1717
extends:
1818
file: compose.yaml
1919
service: db
20-
environment:
21-
POSTGRES_USER: app_user
22-
POSTGRES_PASSWORD: secret
2320
volumes:
2421
- db-data:/var/lib/postgresql/data
2522
volumes:

samples/rails/compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ services:
2424
restart: unless-stopped
2525
image: postgres:16
2626
environment:
27-
POSTGRES_USER: rails_user
27+
POSTGRES_USER: postgres
2828
POSTGRES_PASSWORD: secret
2929
ports:
3030
- mode: host
3131
target: 5432
3232
healthcheck:
33-
test: ["CMD-SHELL", "pg_isready -U app_user"]
33+
test: ["CMD-SHELL", "pg_isready -U postgres"]
3434
interval: 10s
3535
timeout: 5s
3636
retries: 5

0 commit comments

Comments
 (0)