diff --git a/deployment/community/docker-compose.debug.yml b/deployment/community/docker-compose.debug.yml new file mode 100644 index 00000000..09a88a6b --- /dev/null +++ b/deployment/community/docker-compose.debug.yml @@ -0,0 +1,51 @@ + + +services: + server: + image: server + build: + context: ../../server + dockerfile: Dockerfile + env_file: + - .prod.env + - .dev.env + environment: + - FLASK_ENV=development + - FLASK_DEBUG=1 + - GEVENT_SUPPORT=1 + command: ["pip install debugpy -t /tmp && python3 /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 -m flask run -h 0.0.0.0 -p 5000"] + ports: + - 5000:5000 + - 5678:5678 + volumes: + - ../../server/:/app + celery-beat: + image: celery-beat + build: + context: ../../server + dockerfile: Dockerfile + env_file: + - .prod.env + - .dev.env + celery-worker: + image: celery-worker + build: + context: ../../server + dockerfile: Dockerfile + env_file: + - .prod.env + - .dev.env + web: + image: merginmaps-frontend + build: + context: ../../web-app + dockerfile: Dockerfile + maildev: + image: maildev/maildev + container_name: merginmaps-maildev + restart: always + ports: + - 1080:1080 + - 1025:1025 + networks: + - merginmaps diff --git a/development.md b/development.md index b51c83d4..4e4a2bd3 100644 --- a/development.md +++ b/development.md @@ -69,6 +69,7 @@ If you want to run the whole stack locally, you can use the docker. Docker will cd deployment/community/ # Run the docker composition with the current Dockerfiles +cp .env.template .prod.env docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d # Give ownership of the ./projects folder to user that is running the gunicorn container @@ -94,6 +95,14 @@ docker exec -it merginmaps-server flask server send-check-email --email admin@e In docker-compose.dev.yml is started maildev/maildev image that can be used to test emails (see [https://github.com/maildev/maildev/](https://github.com/maildev/maildev/)). In localhost:1080 you can see the emails sent by the application in web interface. +### Running with remote debugger +If you want to run the application with remote debugger, you can use debug compose file with attatched source code and reload. +It starts a debugpy session on port 5678 you cat attach to. + +```shell +docker compose -f docker-compose.yml -f docker-compose.debug.yml up +``` + ## Running tests To launch the unit tests run: ```shell