chore(compose): dependencies, environments and healthchecks
This commit is contained in:
		
							parent
							
								
									0c3d732791
								
							
						
					
					
						commit
						afceb5bf3b
					
				
							
								
								
									
										45
									
								
								compose.yml
								
								
								
								
							
							
						
						
									
										45
									
								
								compose.yml
								
								
								
								
							| 
						 | 
				
			
			@ -4,26 +4,19 @@ networks:
 | 
			
		|||
    external: true
 | 
			
		||||
 | 
			
		||||
x-django: &django
 | 
			
		||||
  depends_on:
 | 
			
		||||
    postgres:
 | 
			
		||||
      condition: service_healthy
 | 
			
		||||
    redis:
 | 
			
		||||
      condition: service_healthy
 | 
			
		||||
  dns: 172.17.0.1
 | 
			
		||||
  dns_search: funkwhale.test
 | 
			
		||||
 | 
			
		||||
services:
 | 
			
		||||
  front:
 | 
			
		||||
    build:
 | 
			
		||||
      context: ./front
 | 
			
		||||
      dockerfile: Dockerfile.dev
 | 
			
		||||
    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"
 | 
			
		||||
    extends:
 | 
			
		||||
      file: ./compose/app.vue.yml
 | 
			
		||||
      service: app
 | 
			
		||||
 | 
			
		||||
  api:
 | 
			
		||||
    extends:
 | 
			
		||||
| 
						 | 
				
			
			@ -41,26 +34,14 @@ services:
 | 
			
		|||
    extends:
 | 
			
		||||
      file: ./compose/app.nginx.yml
 | 
			
		||||
      service: nginx
 | 
			
		||||
    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_IP
 | 
			
		||||
      - FUNKWHALE_FRONT_PORT
 | 
			
		||||
 | 
			
		||||
      - NGINX_MAX_BODY_SIZE
 | 
			
		||||
 | 
			
		||||
      - STATIC_ROOT
 | 
			
		||||
      - "MEDIA_ROOT=${MEDIA_ROOT:-/data/media}"
 | 
			
		||||
    depends_on:
 | 
			
		||||
      front:
 | 
			
		||||
        condition: service_healthy
 | 
			
		||||
      api:
 | 
			
		||||
        condition: service_healthy
 | 
			
		||||
    networks:
 | 
			
		||||
      - web
 | 
			
		||||
      - internal
 | 
			
		||||
 | 
			
		||||
    labels:
 | 
			
		||||
      - "traefik.enable=true"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,14 +55,11 @@ services:
 | 
			
		|||
      context: ../api
 | 
			
		||||
      dockerfile: Dockerfile.debian
 | 
			
		||||
    healthcheck:
 | 
			
		||||
      test:
 | 
			
		||||
        [
 | 
			
		||||
          "CMD-SHELL",
 | 
			
		||||
          'docker compose logs api | grep -q "Uvicorn running on" || exit 0',
 | 
			
		||||
        ]
 | 
			
		||||
      interval: 3s
 | 
			
		||||
      test: 'curl -o /dev/null -s -w "%{http_code}" http://localhost:5000/api/v1 | grep "301" || exit 1'
 | 
			
		||||
      interval: 10s
 | 
			
		||||
      timeout: 5s
 | 
			
		||||
      retries: 3
 | 
			
		||||
      start_period: 60s
 | 
			
		||||
    command: >
 | 
			
		||||
      sh -c "
 | 
			
		||||
        funkwhale-manage collectstatic --no-input &&
 | 
			
		||||
| 
						 | 
				
			
			@ -76,6 +73,3 @@ services:
 | 
			
		|||
        pip install watchdog[watchmedo] &&
 | 
			
		||||
        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:
 | 
			
		||||
  nginx:
 | 
			
		||||
    image: nginx
 | 
			
		||||
    depends_on:
 | 
			
		||||
      - api
 | 
			
		||||
      - front
 | 
			
		||||
    networks:
 | 
			
		||||
      - internal
 | 
			
		||||
    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:
 | 
			
		||||
      - "${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/media:/protected/media:ro
 | 
			
		||||
      - ../.state/${COMPOSE_PROJECT_NAME:-funkwhale}/media:/data/media:ro
 | 
			
		||||
    networks:
 | 
			
		||||
      - internal
 | 
			
		||||
    healthcheck:
 | 
			
		||||
      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
 | 
			
		||||
| 
						 | 
				
			
			@ -12,3 +12,6 @@ RUN yarn install
 | 
			
		|||
COPY . .
 | 
			
		||||
 | 
			
		||||
CMD ["yarn", "serve"]
 | 
			
		||||
 | 
			
		||||
HEALTHCHECK --start-period=30s --interval=10s --timeout=5s \
 | 
			
		||||
  CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue