Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(docker): Uses migrate service instead of api #428

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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 api
Submodule api updated 106 files
2 changes: 2 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: lago_dev

volumes:
front_node_modules_dev:
front_dist_dev:
Expand Down
80 changes: 54 additions & 26 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ services:
image: postgres:14-alpine
container_name: lago-db
restart: unless-stopped
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-lago} -d ${POSTGRES_DB:-lago} -h localhost -p ${POSTGRES_PORT:-5432}",
]
interval: 10s
timeout: 5s
retries: 5
environment:
POSTGRES_DB: ${POSTGRES_DB:-lago}
POSTGRES_USER: ${POSTGRES_USER:-lago}
Expand All @@ -25,19 +34,47 @@ services:
container_name: lago-redis
restart: unless-stopped
command: --port ${REDIS_PORT:-6379}
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- lago_redis_data:/data
ports:
- ${REDIS_PORT:-6379}:${REDIS_PORT:-6379}

migrate:
container_name: lago-migrate
image: getlago/api:jeremy
depends_on:
db:
condition: service_healthy
restart: true
command: ["./scripts/migrate.sh"]
environment:
- RAILS_ENV=production
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- RSA_PRIVATE_KEY=${LAGO_RSA_PRIVATE_KEY} # Should be base64 encoded
- LAGO_RSA_PRIVATE_KEY=${LAGO_RSA_PRIVATE_KEY} # Should be base64 encoded
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@${POSTGRES_HOST:-db}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-lago}?search_path=${POSTGRES_SCHEMA:-public}
- REDIS_URL=redis://${REDIS_HOST:-redis}:${REDIS_PORT:-6379}
- REDIS_PASSWORD=${REDIS_PASSWORD}

api:
container_name: lago-api
image: getlago/api:v1.15.2
image: getlago/api:jeremy
restart: unless-stopped
depends_on:
- db
- redis
command: ["./scripts/start.sh"]
migrate:
condition: service_completed_successfully
db:
condition: service_healthy
restart: true
redis:
condition: service_healthy
restart: true
command: ["./scripts/start.api.sh"]
healthcheck:
test: curl -f http://localhost:3000/health || exit 1
interval: 10s
Expand Down Expand Up @@ -98,6 +135,7 @@ services:
depends_on:
api:
condition: service_healthy
restart: true
environment:
- API_URL=${LAGO_API_URL:-http://localhost:3000}
- APP_ENV=${APP_ENV:-production}
Expand Down Expand Up @@ -130,11 +168,15 @@ services:

api-worker:
container_name: lago-worker
image: getlago/api:v1.15.2
image: getlago/api:jeremy
restart: unless-stopped
depends_on:
api:
db:
condition: service_healthy
restart: true
redis:
condition: service_healthy
restart: true
command: ["./scripts/start.worker.sh"]
healthcheck:
test: ["CMD-SHELL", "bundle exec sidekiqmon | grep $(hostname) || exit 1"]
Expand Down Expand Up @@ -262,11 +304,15 @@ services:

api-clock:
container_name: lago-clock
image: getlago/api:v1.15.2
image: getlago/api:jeremy
restart: unless-stopped
depends_on:
api:
db:
condition: service_healthy
restart: true
redis:
condition: service_healthy
restart: true
command: ["./scripts/start.clock.sh"]
environment:
- LAGO_API_URL=${LAGO_API_URL:-http://localhost:3000}
Expand All @@ -289,21 +335,3 @@ services:

pdf:
image: getlago/lago-gotenberg:7.8.2

migrate:
container_name: lago-migrate
image: getlago/api:v1.13.1
depends_on:
- db
- redis
command: ["./scripts/start.migrate.sh"]
volumes:
- lago_storage_data:/app/storage
environment:
- RAILS_ENV=production
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- RSA_PRIVATE_KEY=${LAGO_RSA_PRIVATE_KEY} # Should be base64 encoded
- LAGO_RSA_PRIVATE_KEY=${LAGO_RSA_PRIVATE_KEY} # Should be base64 encoded
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@${POSTGRES_HOST:-db}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-lago}?search_path=${POSTGRES_SCHEMA:-public}
- REDIS_URL=redis://${REDIS_HOST:-redis}:${REDIS_PORT:-6379}
- REDIS_PASSWORD=${REDIS_PASSWORD}
2 changes: 1 addition & 1 deletion front
Submodule front updated 216 files