Skip to content

Instantly share code, notes, and snippets.

@ryanditjia
Created September 11, 2020 10:51
Show Gist options
  • Save ryanditjia/dd0f5f84ddbc48455ef2b4d0fd5a04fc to your computer and use it in GitHub Desktop.
Save ryanditjia/dd0f5f84ddbc48455ef2b4d0fd5a04fc to your computer and use it in GitHub Desktop.
Attempt to fix error
backend:
depends_on:
- db
ports:
- '8888:8888'
volumes:
- ./backend/app:/app
environment:
- JUPYTER=jupyter lab --ip=0.0.0.0 --allow-root --NotebookApp.custom_display_url=http://127.0.0.1:8888
- SERVER_HOST=http://${DOMAIN?Variable not set}
build:
context: ./backend
dockerfile: backend.dockerfile
args:
INSTALL_DEV: ${INSTALL_DEV-true}
INSTALL_JUPYTER: ${INSTALL_JUPYTER-true}
# command: bash -c "while true; do sleep 1; done" # Infinite loop to keep container live doing nothing
command: /start-reload.sh
labels:
# 0. Attach to the `proxy` service
- traefik.enable=true
- traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
# 1. Create a router for FastAPI paths (naming it STACK_NAME-backend-http)
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.rule=PathPrefix(`${API_PATH_PREFIX?Variable not set}`) || PathPrefix(`${API_DOCS_PATH_PREFIX?Variable not set}`)
# 2. Attach the router to FastAPI service (naming it STACK_NAME-backend)
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.service=${STACK_NAME?Variable not set}-backend
# 3. Attach the router to port 80 of the FastAPI service (the one named STACK_NAME-backend)
- traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=80
# Repeat the 3 steps above for Airflow path
# (naming the router STACK_NAME-airflow-http and the service STACK_NAME-airflow)
- traefik.http.routers.${STACK_NAME?Variable not set}-airflow-http.rule=PathPrefix(`/airflow`)
- traefik.http.routers.${STACK_NAME?Variable not set}-airflow-http.service=${STACK_NAME?Variable not set}-airflow
- traefik.http.services.${STACK_NAME?Variable not set}-airflow.loadbalancer.server.port=8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment