- Replace hardcoded DATABASE_URL and RAILS_MASTER_KEY with environment variables. - Change POSTGRES_PASSWORD to utilize an environment variable instead of a hardcoded value. These changes enhance security by ensuring sensitive information is not exposed in the configuration files, allowing for better practices in managing environment variables.
41 lines
980 B
YAML
41 lines
980 B
YAML
version: '3.8'
|
|
|
|
services:
|
|
web:
|
|
image: songtianlun/today_ai_weather:latest
|
|
#ports:
|
|
# - "3000:3000"
|
|
environment:
|
|
- RAILS_ENV=production
|
|
- DATABASE_URL=postgresql://postgres:${PG_PASSWORD}@db:5432/db
|
|
- RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
|
|
sidekiq:
|
|
image: songtianlun/today_ai_weather:latest
|
|
command: bundle exec sidekiq
|
|
environment:
|
|
- RAILS_ENV=production
|
|
- DATABASE_URL=postgresql://postgres:${PG_PASSWORD}@db:5432/db
|
|
- RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
|
|
db:
|
|
image: postgres:16
|
|
volumes:
|
|
- ../taw_data/pg:/var/lib/postgresql/data
|
|
environment:
|
|
- POSTGRES_PASSWORD=${PG_PASSWORD}
|
|
- POSTGRES_DB=db
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
volumes:
|
|
- ../taw_data/redis:/data
|
|
command: redis-server --appendonly yes |