chore(compose): dependencies, environments and healthchecks
This commit is contained in:
		
							parent
							
								
									ca9a4687af
								
							
						
					
					
						commit
						f24869ce3d
					
				
							
								
								
									
										45
									
								
								compose.yml
								
								
								
								
							
							
						
						
									
										45
									
								
								compose.yml
								
								
								
								
							| 
						 | 
					@ -4,26 +4,19 @@ networks:
 | 
				
			||||||
    external: true
 | 
					    external: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
x-django: &django
 | 
					x-django: &django
 | 
				
			||||||
 | 
					  depends_on:
 | 
				
			||||||
 | 
					    postgres:
 | 
				
			||||||
 | 
					      condition: service_healthy
 | 
				
			||||||
 | 
					    redis:
 | 
				
			||||||
 | 
					      condition: service_healthy
 | 
				
			||||||
  dns: 172.17.0.1
 | 
					  dns: 172.17.0.1
 | 
				
			||||||
  dns_search: funkwhale.test
 | 
					  dns_search: funkwhale.test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  front:
 | 
					  front:
 | 
				
			||||||
    build:
 | 
					    extends:
 | 
				
			||||||
      context: ./front
 | 
					      file: ./compose/app.vue.yml
 | 
				
			||||||
      dockerfile: Dockerfile.dev
 | 
					      service: app
 | 
				
			||||||
    ports:
 | 
					 | 
				
			||||||
      - "${VUE_PORT:-8080}:${VUE_PORT:-8080}"
 | 
					 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      - HOST
 | 
					 | 
				
			||||||
      - VUE_PORT
 | 
					 | 
				
			||||||
    volumes:
 | 
					 | 
				
			||||||
      - "./front:/app"
 | 
					 | 
				
			||||||
      - "/app/node_modules"
 | 
					 | 
				
			||||||
      - "./po:/po"
 | 
					 | 
				
			||||||
    networks:
 | 
					 | 
				
			||||||
      - internal
 | 
					 | 
				
			||||||
    command: "yarn dev --host"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  api:
 | 
					  api:
 | 
				
			||||||
    extends:
 | 
					    extends:
 | 
				
			||||||
| 
						 | 
					@ -41,26 +34,14 @@ services:
 | 
				
			||||||
    extends:
 | 
					    extends:
 | 
				
			||||||
      file: ./compose/app.nginx.yml
 | 
					      file: ./compose/app.nginx.yml
 | 
				
			||||||
      service: nginx
 | 
					      service: nginx
 | 
				
			||||||
    environment:
 | 
					    depends_on:
 | 
				
			||||||
      - "MUSIC_DIRECTORY_PATH=${MUSIC_DIRECTORY_PATH:-/music}"
 | 
					      front:
 | 
				
			||||||
      - "FUNKWHALE_HOSTNAME=${COMPOSE_PROJECT_NAME:-funkwhale}.${FUNKWHALE_DOMAIN}"
 | 
					        condition: service_healthy
 | 
				
			||||||
 | 
					      api:
 | 
				
			||||||
      - FUNKWHALE_PROTOCOL
 | 
					        condition: service_healthy
 | 
				
			||||||
 | 
					 | 
				
			||||||
      - FUNKWHALE_API_HOST
 | 
					 | 
				
			||||||
      - FUNKWHALE_API_PORT
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - FUNKWHALE_FRONT_IP
 | 
					 | 
				
			||||||
      - FUNKWHALE_FRONT_PORT
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - NGINX_MAX_BODY_SIZE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - STATIC_ROOT
 | 
					 | 
				
			||||||
      - "MEDIA_ROOT=${MEDIA_ROOT:-/data/media}"
 | 
					 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      - web
 | 
					      - web
 | 
				
			||||||
      - internal
 | 
					      - internal
 | 
				
			||||||
 | 
					 | 
				
			||||||
    labels:
 | 
					    labels:
 | 
				
			||||||
      - "traefik.enable=true"
 | 
					      - "traefik.enable=true"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,11 +5,11 @@ x-django: &django
 | 
				
			||||||
  volumes:
 | 
					  volumes:
 | 
				
			||||||
    - ../api:/app
 | 
					    - ../api:/app
 | 
				
			||||||
    - ../.env:/app/.env
 | 
					    - ../.env:/app/.env
 | 
				
			||||||
    - '${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"
 | 
				
			||||||
    - '../.state/${COMPOSE_PROJECT_NAME:-funkwhale}/media:/data/media'
 | 
					    - "../.state/${COMPOSE_PROJECT_NAME:-funkwhale}/media:/data/media"
 | 
				
			||||||
  depends_on:
 | 
					  depends_on:
 | 
				
			||||||
    postgres:
 | 
					    postgres:
 | 
				
			||||||
      condition: service_healthy
 | 
					      condition: service_healthy
 | 
				
			||||||
| 
						 | 
					@ -55,10 +55,11 @@ services:
 | 
				
			||||||
      context: ../api
 | 
					      context: ../api
 | 
				
			||||||
      dockerfile: Dockerfile.debian
 | 
					      dockerfile: Dockerfile.debian
 | 
				
			||||||
    healthcheck:
 | 
					    healthcheck:
 | 
				
			||||||
      test: ['CMD-SHELL', 'docker compose logs api | grep -q "Uvicorn running on" || exit 0']
 | 
					      test: 'curl -o /dev/null -s -w "%{http_code}" http://localhost:5000/api/v1 | grep "301" || exit 1'
 | 
				
			||||||
      interval: 3s
 | 
					      interval: 10s
 | 
				
			||||||
      timeout: 5s
 | 
					      timeout: 5s
 | 
				
			||||||
      retries: 3
 | 
					      retries: 3
 | 
				
			||||||
 | 
					      start_period: 60s
 | 
				
			||||||
    command: >
 | 
					    command: >
 | 
				
			||||||
      sh -c "
 | 
					      sh -c "
 | 
				
			||||||
        funkwhale-manage collectstatic --no-input &&
 | 
					        funkwhale-manage collectstatic --no-input &&
 | 
				
			||||||
| 
						 | 
					@ -72,6 +73,3 @@ services:
 | 
				
			||||||
        pip install watchdog[watchmedo] &&
 | 
					        pip install watchdog[watchmedo] &&
 | 
				
			||||||
        watchmedo auto-restart --patterns="*.py" --recursive -- celery -A funkwhale_api.taskapp worker -l debug -B --concurrency=${CELERYD_CONCURRENCY}
 | 
					        watchmedo auto-restart --patterns="*.py" --recursive -- celery -A funkwhale_api.taskapp worker -l debug -B --concurrency=${CELERYD_CONCURRENCY}
 | 
				
			||||||
      '
 | 
					      '
 | 
				
			||||||
    depends_on:
 | 
					 | 
				
			||||||
      api:
 | 
					 | 
				
			||||||
        condition: service_healthy
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,24 @@
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  nginx:
 | 
					  nginx:
 | 
				
			||||||
    image: nginx
 | 
					    image: nginx
 | 
				
			||||||
    depends_on:
 | 
					    networks:
 | 
				
			||||||
      - api
 | 
					      - internal
 | 
				
			||||||
      - front
 | 
					    environment:
 | 
				
			||||||
 | 
					      - "MUSIC_DIRECTORY_PATH=${MUSIC_DIRECTORY_PATH:-/music}"
 | 
				
			||||||
 | 
					      - "FUNKWHALE_HOSTNAME=${COMPOSE_PROJECT_NAME:-funkwhale}.${FUNKWHALE_DOMAIN}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - FUNKWHALE_PROTOCOL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - FUNKWHALE_API_HOST
 | 
				
			||||||
 | 
					      - FUNKWHALE_API_PORT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - FUNKWHALE_FRONT_HOST
 | 
				
			||||||
 | 
					      - FUNKWHALE_FRONT_PORT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - NGINX_MAX_BODY_SIZE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - STATIC_ROOT
 | 
				
			||||||
 | 
					      - "MEDIA_ROOT=${MEDIA_ROOT:-/data/media}"
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - '${MUSIC_DIRECTORY_SERVE_PATH:-../.state/music}:${MUSIC_DIRECTORY_PATH:-/music}:ro'
 | 
					      - '${MUSIC_DIRECTORY_SERVE_PATH:-../.state/music}:${MUSIC_DIRECTORY_PATH:-/music}:ro'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,5 +29,8 @@ services:
 | 
				
			||||||
      - ../.state/staticfiles:/usr/share/nginx/html/staticfiles:ro
 | 
					      - ../.state/staticfiles:/usr/share/nginx/html/staticfiles:ro
 | 
				
			||||||
      - ../.state/media:/protected/media:ro
 | 
					      - ../.state/media:/protected/media:ro
 | 
				
			||||||
      - ../.state/${COMPOSE_PROJECT_NAME:-funkwhale}/media:/data/media:ro
 | 
					      - ../.state/${COMPOSE_PROJECT_NAME:-funkwhale}/media:/data/media:ro
 | 
				
			||||||
    networks:
 | 
					    healthcheck:
 | 
				
			||||||
      - internal
 | 
					      test: 'curl -o /dev/null -s -w "%{http_code}" http://localhost:80/ | grep "200" || exit 1'
 | 
				
			||||||
 | 
					      interval: 5s
 | 
				
			||||||
 | 
					      timeout: 3s
 | 
				
			||||||
 | 
					      retries: 3
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  app:
 | 
				
			||||||
 | 
					    image: funkwhale-app
 | 
				
			||||||
 | 
					    build:
 | 
				
			||||||
 | 
					      context: ../front
 | 
				
			||||||
 | 
					      dockerfile: Dockerfile.dev
 | 
				
			||||||
 | 
					    command: "yarn dev --host"
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - "${VUE_PORT:-8080}:${VUE_PORT:-8080}"
 | 
				
			||||||
 | 
					    networks:
 | 
				
			||||||
 | 
					      - internal
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - "../front:/app"
 | 
				
			||||||
 | 
					      - "/app/node_modules"
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - HOST
 | 
				
			||||||
 | 
					      - VUE_PORT
 | 
				
			||||||
| 
						 | 
					@ -16,4 +16,11 @@ VOLUME /app
 | 
				
			||||||
VOLUME /app/node_modules
 | 
					VOLUME /app/node_modules
 | 
				
			||||||
EXPOSE 8080
 | 
					EXPOSE 8080
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
CMD ["yarn", "dev", "--host"]
 | 
					CMD ["yarn", "dev", "--host"]
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					CMD ["yarn", "serve"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					HEALTHCHECK --start-period=30s --interval=10s --timeout=5s \
 | 
				
			||||||
 | 
					  CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1
 | 
				
			||||||
 | 
					>>>>>>> afceb5bf3 (chore(compose): dependencies, environments and healthchecks)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue