Skip to content

Update Docker Compose template for S3 storage migration #9

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

Merged
merged 8 commits into from
May 20, 2025
62 changes: 56 additions & 6 deletions docker-compose.tmpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ services:
environment:
<<: *logging-env
hive_service: api_app
# Temporary volume for the case when we need to debug the uploads migration, can be removed once the migration is done
volumes:
- upload_data:/old_data

webhook_app:
<<: *service-app
Expand All @@ -57,14 +60,23 @@ services:
<<: *logging-env
hive_service: cron

img_upload_app:
image: beabee/pictshare:v0.3.0
# MinIO service
minio:
image: beabee/beabee-minio:${HIVE_VERSION:-__VERSION__}
restart: unless-stopped
environment:
URL: ${BEABEE_AUDIENCE}/uploads/
CONTENTCONTROLLERS: ${BEABEE_UPLOAD_CONTENTCONTROLLERS:-IMAGE}
volumes:
- upload_data:/var/www/data
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
environment:
MINIO_ROOT_USER: ${BEABEE_MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${BEABEE_MINIO_ROOT_PASSWORD:-minioadmin}
MINIO_REGION: ${BEABEE_MINIO_REGION:-us-east-1}
BEABEE_MINIO_BUCKET: ${BEABEE_MINIO_BUCKET:-uploads}
BEABEE_MINIO_ENDPOINT: ${BEABEE_MINIO_ENDPOINT:-http://minio:9000}
networks:
- internal

Expand All @@ -77,6 +89,36 @@ services:
<<: *logging-env
hive_service: migration

# Uploads migration service, can be removed once the migration is done
uploads_migration:
image: beabee/beabee-api-app:${HIVE_VERSION:-__VERSION__}
command: >
/bin/sh -c "
if [ \"$${MIGRATE_UPLOADS}\" = \"true\" ]; then
echo 'Starting uploads migration...' &&
yarn backend-cli migrate-uploads --source=/old_data;
else
echo 'Uploads migration skipped (MIGRATE_UPLOADS is not set to true)' &&
exit 0;
fi
"
volumes:
- upload_data:/old_data
depends_on:
migration:
condition: service_completed_successfully
minio:
condition: service_healthy
environment:
<<: *logging-env
hive_service: uploads_migration
MIGRATE_UPLOADS: ${MIGRATE_UPLOADS:-true} # TODO: Disable this once the migration is done
env_file:
- stack.env
networks:
- internal
- db-network

# Helper to run commands (GELF logging disabled)
run:
<<: *base-app
Expand Down Expand Up @@ -116,6 +158,13 @@ services:
environment:
LEGACY_APP_COOKIE_DOMAIN: ${BEABEE_COOKIE_DOMAIN}
TRUSTED_ORIGINS: ${BEABEE_TRUSTEDORIGINS-}
volumes:
- upload_data:/old_data
depends_on:
- api_app
- app
- frontend
- webhook_app
networks:
- internal
- traefik-ingress
Expand Down Expand Up @@ -148,4 +197,5 @@ networks:

volumes:
upload_data:
minio_data:
telegram-bot_data:
62 changes: 56 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ services:
environment:
<<: *logging-env
hive_service: api_app
# Temporary volume for the case when we need to debug the uploads migration, can be removed once the migration is done
volumes:
- upload_data:/old_data

webhook_app:
<<: *service-app
Expand All @@ -57,14 +60,23 @@ services:
<<: *logging-env
hive_service: cron

img_upload_app:
image: beabee/pictshare:v0.3.0
# MinIO service
minio:
image: beabee/beabee-minio:${HIVE_VERSION:-v0.27.4}
restart: unless-stopped
environment:
URL: ${BEABEE_AUDIENCE}/uploads/
CONTENTCONTROLLERS: ${BEABEE_UPLOAD_CONTENTCONTROLLERS:-IMAGE}
volumes:
- upload_data:/var/www/data
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
environment:
MINIO_ROOT_USER: ${BEABEE_MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${BEABEE_MINIO_ROOT_PASSWORD:-minioadmin}
MINIO_REGION: ${BEABEE_MINIO_REGION:-us-east-1}
BEABEE_MINIO_BUCKET: ${BEABEE_MINIO_BUCKET:-uploads}
BEABEE_MINIO_ENDPOINT: ${BEABEE_MINIO_ENDPOINT:-http://minio:9000}
networks:
- internal

Expand All @@ -77,6 +89,36 @@ services:
<<: *logging-env
hive_service: migration

# Uploads migration service, can be removed once the migration is done
uploads_migration:
image: beabee/beabee-api-app:${HIVE_VERSION:-v0.27.4}
command: >
/bin/sh -c "
if [ \"$${MIGRATE_UPLOADS}\" = \"true\" ]; then
echo 'Starting uploads migration...' &&
yarn backend-cli migrate-uploads --source=/old_data;
else
echo 'Uploads migration skipped (MIGRATE_UPLOADS is not set to true)' &&
exit 0;
fi
"
volumes:
- upload_data:/old_data
depends_on:
migration:
condition: service_completed_successfully
minio:
condition: service_healthy
environment:
<<: *logging-env
hive_service: uploads_migration
MIGRATE_UPLOADS: ${MIGRATE_UPLOADS:-true} # TODO: Disable this once the migration is done
env_file:
- stack.env
networks:
- internal
- db-network

# Helper to run commands (GELF logging disabled)
run:
<<: *base-app
Expand Down Expand Up @@ -116,6 +158,13 @@ services:
environment:
LEGACY_APP_COOKIE_DOMAIN: ${BEABEE_COOKIE_DOMAIN}
TRUSTED_ORIGINS: ${BEABEE_TRUSTEDORIGINS-}
volumes:
- upload_data:/old_data
depends_on:
- api_app
- app
- frontend
- webhook_app
networks:
- internal
- traefik-ingress
Expand Down Expand Up @@ -148,4 +197,5 @@ networks:

volumes:
upload_data:
minio_data:
telegram-bot_data: