Skip to content

Commit 038db23

Browse files
authored
Update Docker Compose template for S3 storage migration
2 parents 65b2a8f + e58ef0f commit 038db23

File tree

2 files changed

+112
-14
lines changed

2 files changed

+112
-14
lines changed

docker-compose.tmpl.yml

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ x-base-app: &base-app
1212
networks:
1313
- internal
1414
- db-network
15-
logging:
15+
logging: &logging
1616
driver: gelf
1717
options:
1818
gelf-address: "udp://127.0.0.1:12201"
@@ -42,6 +42,9 @@ services:
4242
environment:
4343
<<: *logging-env
4444
hive_service: api_app
45+
# Temporary volume for the case when we need to debug the uploads migration, can be removed once the migration is done
46+
volumes:
47+
- upload_data:/old_data
4548

4649
webhook_app:
4750
<<: *service-app
@@ -57,14 +60,22 @@ services:
5760
<<: *logging-env
5861
hive_service: cron
5962

60-
img_upload_app:
61-
image: beabee/pictshare:v0.3.0
63+
# MinIO service
64+
minio:
65+
image: beabee/beabee-minio:${HIVE_VERSION:-__VERSION__}
6266
restart: unless-stopped
63-
environment:
64-
URL: ${BEABEE_AUDIENCE}/uploads/
65-
CONTENTCONTROLLERS: ${BEABEE_UPLOAD_CONTENTCONTROLLERS:-IMAGE}
6667
volumes:
67-
- upload_data:/var/www/data
68+
- minio_data:/data
69+
environment:
70+
<<: *logging-env
71+
hive_service: minio
72+
MINIO_ROOT_USER: ${BEABEE_MINIO_ROOT_USER:-minioadmin}
73+
MINIO_ROOT_PASSWORD: ${BEABEE_MINIO_ROOT_PASSWORD:-minioadmin}
74+
MINIO_REGION: ${BEABEE_MINIO_REGION:-us-east-1}
75+
BEABEE_MINIO_BUCKET: ${BEABEE_MINIO_BUCKET:-uploads}
76+
BEABEE_MINIO_ENDPOINT: ${BEABEE_MINIO_ENDPOINT:-http://minio:9000}
77+
logging:
78+
<<: *logging
6879
networks:
6980
- internal
7081

@@ -77,6 +88,36 @@ services:
7788
<<: *logging-env
7889
hive_service: migration
7990

91+
# Uploads migration service, can be removed once the migration is done
92+
uploads_migration:
93+
image: beabee/beabee-api-app:${HIVE_VERSION:-__VERSION__}
94+
command: >
95+
/bin/sh -c "
96+
if [ \"$${MIGRATE_UPLOADS}\" = \"true\" ]; then
97+
echo 'Starting uploads migration...' &&
98+
yarn backend-cli migrate-uploads --source=/old_data;
99+
else
100+
echo 'Uploads migration skipped (MIGRATE_UPLOADS is not set to true)' &&
101+
exit 0;
102+
fi
103+
"
104+
volumes:
105+
- upload_data:/old_data
106+
depends_on:
107+
migration:
108+
condition: service_completed_successfully
109+
minio:
110+
condition: service_healthy
111+
environment:
112+
<<: *logging-env
113+
hive_service: uploads_migration
114+
MIGRATE_UPLOADS: ${MIGRATE_UPLOADS:-true} # TODO: Disable this once the migration is done
115+
env_file:
116+
- stack.env
117+
networks:
118+
- internal
119+
- db-network
120+
80121
# Helper to run commands (GELF logging disabled)
81122
run:
82123
<<: *base-app
@@ -116,6 +157,13 @@ services:
116157
environment:
117158
LEGACY_APP_COOKIE_DOMAIN: ${BEABEE_COOKIE_DOMAIN}
118159
TRUSTED_ORIGINS: ${BEABEE_TRUSTEDORIGINS-}
160+
volumes:
161+
- upload_data:/old_data
162+
depends_on:
163+
- api_app
164+
- app
165+
- frontend
166+
- webhook_app
119167
networks:
120168
- internal
121169
- traefik-ingress
@@ -148,4 +196,5 @@ networks:
148196

149197
volumes:
150198
upload_data:
199+
minio_data:
151200
telegram-bot_data:

docker-compose.yml

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ x-base-app: &base-app
1212
networks:
1313
- internal
1414
- db-network
15-
logging:
15+
logging: &logging
1616
driver: gelf
1717
options:
1818
gelf-address: "udp://127.0.0.1:12201"
@@ -42,6 +42,9 @@ services:
4242
environment:
4343
<<: *logging-env
4444
hive_service: api_app
45+
# Temporary volume for the case when we need to debug the uploads migration, can be removed once the migration is done
46+
volumes:
47+
- upload_data:/old_data
4548

4649
webhook_app:
4750
<<: *service-app
@@ -57,14 +60,22 @@ services:
5760
<<: *logging-env
5861
hive_service: cron
5962

60-
img_upload_app:
61-
image: beabee/pictshare:v0.3.0
63+
# MinIO service
64+
minio:
65+
image: beabee/beabee-minio:${HIVE_VERSION:-v0.27.4}
6266
restart: unless-stopped
63-
environment:
64-
URL: ${BEABEE_AUDIENCE}/uploads/
65-
CONTENTCONTROLLERS: ${BEABEE_UPLOAD_CONTENTCONTROLLERS:-IMAGE}
6667
volumes:
67-
- upload_data:/var/www/data
68+
- minio_data:/data
69+
environment:
70+
<<: *logging-env
71+
hive_service: minio
72+
MINIO_ROOT_USER: ${BEABEE_MINIO_ROOT_USER:-minioadmin}
73+
MINIO_ROOT_PASSWORD: ${BEABEE_MINIO_ROOT_PASSWORD:-minioadmin}
74+
MINIO_REGION: ${BEABEE_MINIO_REGION:-us-east-1}
75+
BEABEE_MINIO_BUCKET: ${BEABEE_MINIO_BUCKET:-uploads}
76+
BEABEE_MINIO_ENDPOINT: ${BEABEE_MINIO_ENDPOINT:-http://minio:9000}
77+
logging:
78+
<<: *logging
6879
networks:
6980
- internal
7081

@@ -77,6 +88,36 @@ services:
7788
<<: *logging-env
7889
hive_service: migration
7990

91+
# Uploads migration service, can be removed once the migration is done
92+
uploads_migration:
93+
image: beabee/beabee-api-app:${HIVE_VERSION:-v0.27.4}
94+
command: >
95+
/bin/sh -c "
96+
if [ \"$${MIGRATE_UPLOADS}\" = \"true\" ]; then
97+
echo 'Starting uploads migration...' &&
98+
yarn backend-cli migrate-uploads --source=/old_data;
99+
else
100+
echo 'Uploads migration skipped (MIGRATE_UPLOADS is not set to true)' &&
101+
exit 0;
102+
fi
103+
"
104+
volumes:
105+
- upload_data:/old_data
106+
depends_on:
107+
migration:
108+
condition: service_completed_successfully
109+
minio:
110+
condition: service_healthy
111+
environment:
112+
<<: *logging-env
113+
hive_service: uploads_migration
114+
MIGRATE_UPLOADS: ${MIGRATE_UPLOADS:-true} # TODO: Disable this once the migration is done
115+
env_file:
116+
- stack.env
117+
networks:
118+
- internal
119+
- db-network
120+
80121
# Helper to run commands (GELF logging disabled)
81122
run:
82123
<<: *base-app
@@ -116,6 +157,13 @@ services:
116157
environment:
117158
LEGACY_APP_COOKIE_DOMAIN: ${BEABEE_COOKIE_DOMAIN}
118159
TRUSTED_ORIGINS: ${BEABEE_TRUSTEDORIGINS-}
160+
volumes:
161+
- upload_data:/old_data
162+
depends_on:
163+
- api_app
164+
- app
165+
- frontend
166+
- webhook_app
119167
networks:
120168
- internal
121169
- traefik-ingress
@@ -148,4 +196,5 @@ networks:
148196

149197
volumes:
150198
upload_data:
199+
minio_data:
151200
telegram-bot_data:

0 commit comments

Comments
 (0)