version: '3' services: # This is the database server that is used by Django db: container_name: postgresdb image: postgres:latest restart: always env_file: - docker/project.env # ports: # - 5432:5432 volumes: - postgres-data:/var/lib/postgresql/data # This is the redis server for HUEY (background processes) redis: container_name: redisdb image: redis env_file: - docker/project.env # We need the 'bash' command in order to get the environment variables command: bash -c 'redis-server --requirepass "$${REDIS_PASSWORD}" --appendonly yes' restart: always volumes: - redis-data:/data # The Django API REST server. This should only be used for API calls # TODO: Cleanup / split code better between API, scheduler and portal broker-api: container_name: broker_api env_file: - docker/project.env # This feels like bad practice.... build: context: ./ # The args below are just here for reference. For local testing, you cannot use the RUG cache # But while building with Drones, you can. So Drones has this argument active! # args: # DOCKER_CACHE: registry.webhosting.rug.nl/cache/library/ dockerfile: ./docker/Dockerfile.api args: DEBUG: "False" command: gunicorn VRE.wsgi:application --bind 0.0.0.0:8000 --workers=4 ports: - 8000:8000 depends_on: - db - redis volumes: - staticfiles:/home/app/web/staticfiles - mediafiles:/home/app/web/mediafiles # The standard NGINX server in front of the API. This will filter out all non API calls (/api/) # And will also server as a static file server for the API documentation broker-api-ngx: container_name: broker_api_ngx env_file: - docker/project.env build: context: ./ # The args below are just here for reference. For local testing, you cannot use the RUG cache # But while building with Drones, you can. So Drones has this argument active! # args: # DOCKER_CACHE: registry.webhosting.rug.nl/cache/library/ dockerfile: ./docker/Dockerfile.nginx restart: always ports: - 1337:80 depends_on: - broker-api volumes: - staticfiles:/var/www/staticfiles - mediafiles:/var/www/mediafiles # The API background scheduler based on Django and HUEY. Needs a Redis server # This will process background tasks like creating new VPS machines broker-scheduler: container_name: broker_scheduler env_file: - docker/project.env # This feels like bad practice.... build: context: ./ # The args below are just here for reference. For local testing, you cannot use the RUG cache # But while building with Drones, you can. So Drones has this argument active! # args: # DOCKER_CACHE: registry.webhosting.rug.nl/cache/library/ dockerfile: ./docker/Dockerfile.scheduler args: DEBUG: "False" command: python manage.py run_huey depends_on: - broker-api - db - redis volumes: postgres-data: null redis-data: null staticfiles: null mediafiles: null