docker-compose.yml
Smarter Platform is a Docker-based Python-Django micro-service application that runs in Kubernetes. Below is a docker-compose.yml that strongly resembles the Kubernetes run-time configuration. You can use this file to synch your local development environment with the Smarter Platform.
--- #------------------------------------------------------------------------------ # For local development, you can use the following docker-compose file # to run the application. This file will start a MySQL database, a Redis # server, a Celery worker, and the application itself. The application # will be available at http://localhost:8000. #------------------------------------------------------------------------------ services: smarter-mysql: container_name: smarter-mysql image: mysql:8 command: ["mysqld", "--mysql-native-password=ON"] restart: always environment: MYSQL_ROOT_PASSWORD: smarter MYSQL_DATABASE: smarter MYSQL_USER: smarter MYSQL_PASSWORD: smarter volumes: - ./mysql-data:/var/lib/mysql smarter-redis: container_name: smarter-redis image: redis:latest command: redis-server --requirepass smarter smarter-worker: container_name: smarter-worker user: smarter_user x-build: type: docker build: context: . dockerfile: Dockerfile args: ENVIRONMENT: ${ENVIRONMENT} image: smarter command: celery -A smarter.smarter_celery.app worker --concurrency=4 --loglevel=info -Q default_celery_task_queue depends_on: - smarter-mysql - smarter-redis env_file: - ./.env volumes: - type: bind source: ./smarter target: /smarter consistency: cached healthcheck: test: ["CMD", "celery", "-A", "smarter.smarter_celery.app", "inspect", "ping"] interval: 30s timeout: 10s retries: 3 smarter-beat: container_name: smarter-beat user: smarter_user image: smarter command: celery -A smarter.smarter_celerybeat.app beat --loglevel=info depends_on: - smarter-mysql - smarter-redis env_file: - ./.env volumes: - type: bind source: ./smarter target: /smarter consistency: cached healthcheck: test: [ "CMD", "celery", "-A", "smarter.smarter_celerybeat.app", "inspect", "ping", ] interval: 30s timeout: 10s retries: 3 smarter-app: container_name: smarter-app user: smarter_user image: smarter command: watchmedo auto-restart --directory=./smarter --pattern=*.py --recursive -- gunicorn smarter.wsgi:application -b 0.0.0.0:8000 volumes: - type: bind source: ./smarter target: /smarter consistency: cached ports: - 8000:8000 depends_on: - smarter-mysql - smarter-redis - smarter-worker - smarter-beat env_file: - ./.env