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(worker): Introduce SolidQueue #431

Open
wants to merge 2 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 112 files
49 changes: 11 additions & 38 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ services:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- DATABASE_TEST_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago_test}
- DATABASE_QUEUE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago_queue}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- LAGO_FRONT_URL=${LAGO_FRONT_URL:-https://app.lago.dev}
Expand All @@ -110,8 +111,9 @@ services:
- LAGO_LICENSE=${LAGO_LICENSE:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:[email protected]}
- LAGO_SIDEKIQ_WEB=true
- SIDEKIQ_EVENTS=true
- SIDEKIQ_PDFS=true
- LAGO_WORKER_EVENTS=true
- LAGO_WORKER_PDFS=true
- LAGO_JOB_DASHBOARD=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
Expand Down Expand Up @@ -148,6 +150,7 @@ services:
environment:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- DATABASE_QUEUE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago_queue}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
Expand All @@ -162,8 +165,8 @@ services:
- LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT:-}
- LAGO_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:[email protected]}
- SIDEKIQ_EVENTS=true
- SIDEKIQ_PDFS=true
- LAGO_WORKER_EVENTS=true
- LAGO_WORKER_PDFS=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
Expand All @@ -188,6 +191,7 @@ services:
environment:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- DATABASE_QUEUE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago_queue}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
Expand All @@ -202,7 +206,7 @@ services:
- LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT:-}
- LAGO_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:[email protected]}
- SIDEKIQ_EVENTS=true
- LAGO_WORKER_EVENTS=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
Expand All @@ -227,6 +231,7 @@ services:
environment:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- DATABASE_QUEUE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago_queue}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
Expand All @@ -241,39 +246,7 @@ services:
- LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT:-}
- LAGO_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:[email protected]}
- SIDEKIQ_PDFS=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}

api-clock:
image: api_dev
container_name: lago_api_clock_dev
restart: unless-stopped
command: ["./scripts/start.clock.dev.sh"]
depends_on:
- api
build:
context: ./api
dockerfile: $LAGO_PATH/api/Dockerfile.dev
volumes:
- $LAGO_PATH/api:/app:delegated
environment:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- LAGO_ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- SEGMENT_WRITE_KEY=${SEGMENT_WRITE_KEY:-}
- LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT:-}
- LAGO_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_WORKER_PDFS=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
Expand Down
48 changes: 11 additions & 37 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
depends_on:
- db
- redis
command: ['./scripts/start.sh']
command: ["./scripts/start.sh"]
healthcheck:
test: curl -f http://localhost:3000/health || exit 1
interval: 10s
Expand All @@ -58,6 +58,7 @@ services:
- RSA_PRIVATE_KEY=${LAGO_RSA_PRIVATE_KEY} # Should be base64 encoded
- LAGO_RSA_PRIVATE_KEY=${LAGO_RSA_PRIVATE_KEY} # Should be base64 encoded
- LAGO_SIDEKIQ_WEB=${LAGO_SIDEKIQ_WEB}
- LAGO_JOB_DASHBOARD=${LAGO_JOB_DASHBOARD}
- LAGO_ENCRYPTION_PRIMARY_KEY=${LAGO_ENCRYPTION_PRIMARY_KEY:-your-encryption-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${LAGO_ENCRYPTION_DETERMINISTIC_KEY:-your-encryption-deterministic-key}
- LAGO_ENCRYPTION_KEY_DERIVATION_SALT=${LAGO_ENCRYPTION_KEY_DERIVATION_SALT:-your-encryption-derivation-salt}
Expand All @@ -80,8 +81,8 @@ services:
- GOOGLE_AUTH_CLIENT_ID=${GOOGLE_AUTH_CLIENT_ID:-}
- GOOGLE_AUTH_CLIENT_SECRET=${GOOGLE_AUTH_CLIENT_SECRET:-}
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
# - SIDEKIQ_EVENTS=true
# - SIDEKIQ_PDFS=true
# - LAGO_WORKER_EVENTS=true
# - LAGO_WORKER_PDS=true
volumes:
- lago_storage_data:/app/storage
# If using GCS, you need to put the credentials keyfile here
Expand Down Expand Up @@ -135,9 +136,9 @@ services:
depends_on:
api:
condition: service_healthy
command: ['./scripts/start.worker.sh']
command: ["./scripts/start.worker.sh"]
healthcheck:
test: ['CMD-SHELL', 'bundle exec sidekiqmon | grep $(hostname) || exit 1']
test: ["CMD-SHELL", "bundle exec sidekiqmon | grep $(hostname) || exit 1"]
environment:
- LAGO_API_URL=${LAGO_API_URL:-http://localhost:3000}
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@${POSTGRES_HOST:-db}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-lago}?search_path=${POSTGRES_SCHEMA:-public}
Expand Down Expand Up @@ -169,8 +170,8 @@ services:
- LAGO_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH}
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}
# - SIDEKIQ_EVENTS=true
# - SIDEKIQ_PDFS=true
# - LAGO_WORKER_EVENTS=true
# - LAGO_WORKER_PDFS=true
volumes:
- lago_storage_data:/app/storage

Expand Down Expand Up @@ -214,7 +215,7 @@ services:
# - LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT}
# - LAGO_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH}
# - NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
# - SIDEKIQ_EVENTS=true
# - LAGO_WORKER_EVENTS=true
# - LAGO_LICENSE=${LAGO_LICENSE:-}

# You can uncomment this if you want to use a dedicated Sidekiq worker for the invoices pdf creation.
Expand Down Expand Up @@ -257,36 +258,9 @@ services:
# - LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT}
# - LAGO_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH}
# - NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
# - SIDEKIQ_PDFS=true
# - LAGO_WORKER_PDS=true
# - LAGO_LICENSE=${LAGO_LICENSE:-}

api-clock:
container_name: lago-clock
image: getlago/api:v1.16.0
restart: unless-stopped
depends_on:
api:
condition: service_healthy
command: ['./scripts/start.clock.sh']
environment:
- LAGO_API_URL=${LAGO_API_URL:-http://localhost:3000}
- 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}
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- RAILS_ENV=production
- RAILS_LOG_TO_STDOUT=${LAGO_RAILS_STDOUT:-true}
- SENTRY_DSN=${SENTRY_DSN}
- LAGO_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH}
- LAGO_REDIS_CACHE_URL=redis://${LAGO_REDIS_CACHE_HOST:-redis}:${LAGO_REDIS_CACHE_PORT:-6379}
- LAGO_RSA_PRIVATE_KEY=${LAGO_RSA_PRIVATE_KEY} # Should be base64 encoded
- RSA_PRIVATE_KEY=${LAGO_RSA_PRIVATE_KEY} # Should be base64 encoded
- LAGO_ENCRYPTION_PRIMARY_KEY=${LAGO_ENCRYPTION_PRIMARY_KEY:-your-encryption-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${LAGO_ENCRYPTION_DETERMINISTIC_KEY:-your-encryption-deterministic-key}
- LAGO_ENCRYPTION_KEY_DERIVATION_SALT=${LAGO_ENCRYPTION_KEY_DERIVATION_SALT:-your-encryption-derivation-salt}
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}

pdf:
image: getlago/lago-gotenberg:7.8.2

Expand All @@ -296,7 +270,7 @@ services:
depends_on:
- db
- redis
command: ['./scripts/start.migrate.sh']
command: ["./scripts/start.migrate.sh"]
volumes:
- lago_storage_data:/app/storage
environment:
Expand Down