fix(compose): move migrations into api container next to collectstatic

The overall process runs faster than in a separate container, which
reduces recreation times while developing.
This commit is contained in:
jon r 2024-10-10 11:15:05 +02:00
parent f21795ede3
commit df2e34e61c
2 changed files with 7 additions and 20 deletions

View File

@ -40,7 +40,7 @@ x-django: &django
services: services:
front: front:
build: build:
context: ../front context: ./front
dockerfile: Dockerfile.dev dockerfile: Dockerfile.dev
ports: ports:
- "${VUE_PORT:-8080}:${VUE_PORT:-8080}" - "${VUE_PORT:-8080}:${VUE_PORT:-8080}"
@ -67,12 +67,6 @@ services:
service: celeryworker service: celeryworker
<<: *django <<: *django
migrate:
extends:
file: ./compose/app.django.yml
service: migrate
<<: *django
nginx: nginx:
extends: extends:
file: ./compose/app.nginx.yml file: ./compose/app.nginx.yml

View File

@ -2,7 +2,7 @@ x-django: &django
image: funkwhale-api image: funkwhale-api
volumes: volumes:
- ../api:/app - ../api:/app
- "${MUSIC_DIRECTORY_SERVE_PATH-../.state/music}:/music:ro" - "${MUSIC_DIRECTORY_SERVE_PATH:-../.state/music}:/music:ro"
- "../.state/plugins:/srv/funkwhale/plugins" - "../.state/plugins:/srv/funkwhale/plugins"
- "../.state/staticfiles:/staticfiles" - "../.state/staticfiles:/staticfiles"
- "../.state/media:/protected/media" - "../.state/media:/protected/media"
@ -23,20 +23,13 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
install_dev_deps: 1 install_dev_deps: 1
depends_on:
migrate:
condition: service_completed_successfully
command: > command: >
bash -c "funkwhale-manage collectstatic --no-input bash -c "
&& uvicorn --reload config.asgi:application --host 0.0.0.0 --port 5000 --reload-dir config/ --reload-dir=funkwhale_api/" funkwhale-manage migrate &&
funkwhale-manage collectstatic --no-input &&
uvicorn --reload config.asgi:application --host 0.0.0.0 --port 5000 --reload-dir config/ --reload-dir funkwhale_api/
"
celeryworker: celeryworker:
<<: *django <<: *django
depends_on:
migrate:
condition: service_completed_successfully
command: celery -A funkwhale_api.taskapp worker -l debug -B --concurrency=${CELERYD_CONCURRENCY} command: celery -A funkwhale_api.taskapp worker -l debug -B --concurrency=${CELERYD_CONCURRENCY}
migrate:
<<: *django
command: funkwhale-manage migrate