Skip to content

Commit abedfd3

Browse files
committed
working local and cloud
1 parent 2d86793 commit abedfd3

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

samples/rails/.env

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

samples/rails/app/Dockerfile.dev

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ RUN bundle install && \
2626
# Copy application code
2727
COPY . .
2828

29+
RUN ls /rails
30+
2931
# Entrypoint prepares the database.
3032
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
3133

samples/rails/app/config/database.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
default: &default
22
adapter: postgresql
33
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
4-
username: <%= ENV["DATABASE_USERNAME"] %>
5-
password: <%= ENV["DATABASE_PASSWORD"] %>
6-
host: <%= ENV["DATABASE_HOST"] %>
4+
username: <%= ENV["POSTGRES_USERNAME"] %>
5+
password: <%= ENV["POSTGRES_PASSWORD"] %>
6+
host: <%= ENV["POSTGRES_HOST"] %>
77
port: 5432
88
timeout: 5000
99

samples/rails/compose.dev.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
services:
2-
web:
2+
rails:
33
extends:
44
file: compose.yaml
5-
service: web
5+
service: rails
66
build:
77
context: ./app
88
dockerfile: Dockerfile.dev
99
env_file:
1010
- .env
11+
environment:
12+
- POSTGRES_PASSWORD=secret
1113
ports:
1214
- "3000:3000"
1315
volumes:
14-
- .:/rails/
16+
- ./app:/rails/
1517

1618
db:
1719
extends:

samples/rails/compose.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ services:
88
dockerfile: Dockerfile
99
env_file:
1010
- .env
11+
environment:
12+
POSTGRES_PASSWORD:
1113
ports:
1214
- mode: ingress
1315
target: 3000
@@ -23,9 +25,9 @@ services:
2325
db:
2426
restart: unless-stopped
2527
image: postgres:16
28+
x-defang-postgres: true
2629
environment:
27-
POSTGRES_USER: postgres
28-
POSTGRES_PASSWORD: secret
30+
POSTGRES_PASSWORD:
2931
ports:
3032
- mode: host
3133
target: 5432

0 commit comments

Comments
 (0)