From 188a107928b90010c6f39ebd9d7ca1257947a81c Mon Sep 17 00:00:00 2001 From: Jacob Howard Date: Mon, 8 Nov 2021 17:43:04 -0700 Subject: [PATCH] Modified project to use Mutagen Compose integration. This commit modifies the docker-compose.yml file to add support for Mutagen integration. This allows the project to be run on a cloud-based Docker host while still being edited and accessed locally. For more information, please see: - https://mutagen.io - https://mutagen.io/documentation/orchestration/compose Signed-off-by: Jacob Howard --- README.md | 6 +++++ docker-compose.yml | 55 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8c3ce44c03..5d0972c404 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ A simple distributed application running across multiple Docker containers. +**NOTE**: This example has been modified to support integration with +[Mutagen](https://mutagen.io), allowing the application to be run on a remote +Docker host while still being edited and accessed locally. For more information, +please see the +[relevant documentation](https://mutagen.io/documentation/orchestration/compose). + ## Getting started Download [Docker Desktop](https://www.docker.com/products/docker-desktop) for Mac or Windows. [Docker Compose](https://docs.docker.com/compose) will be automatically installed. On Linux, make sure you have the latest version of [Compose](https://docs.docker.com/compose/install/). diff --git a/docker-compose.yml b/docker-compose.yml index 7c2577acfc..c143cba7cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,16 +10,14 @@ services: depends_on: redis: condition: service_healthy - healthcheck: + healthcheck: test: ["CMD", "curl", "-f", "http://localhost"] interval: 15s timeout: 5s retries: 3 start_period: 10s volumes: - - ./vote:/app - ports: - - "5000:80" + - vote-code:/app networks: - front-tier - back-tier @@ -30,12 +28,9 @@ services: entrypoint: nodemon server.js depends_on: db: - condition: service_healthy + condition: service_healthy volumes: - - ./result:/app - ports: - - "5001:80" - - "5858:5858" + - result-code:/app networks: - front-tier - back-tier @@ -45,16 +40,16 @@ services: context: ./worker depends_on: redis: - condition: service_healthy + condition: service_healthy db: - condition: service_healthy + condition: service_healthy networks: - back-tier redis: image: redis:alpine volumes: - - "./healthchecks:/healthchecks" + - "healthchecks:/healthchecks" healthcheck: test: /healthchecks/redis.sh interval: "5s" @@ -68,7 +63,7 @@ services: POSTGRES_PASSWORD: "postgres" volumes: - "db-data:/var/lib/postgresql/data" - - "./healthchecks:/healthchecks" + - "healthchecks:/healthchecks" healthcheck: test: /healthchecks/postgres.sh interval: "5s" @@ -83,14 +78,46 @@ services: profiles: ["seed"] depends_on: vote: - condition: service_healthy + condition: service_healthy networks: - front-tier restart: "no" volumes: db-data: + healthchecks: + vote-code: + result-code: networks: front-tier: back-tier: + +x-mutagen: + sync: + defaults: + ignore: + vcs: true + healthchecks: + alpha: "./healthchecks" + beta: "volume://healthchecks" + mode: "one-way-safe" + vote: + alpha: "./vote" + beta: "volume://vote-code" + mode: "one-way-safe" + result: + alpha: "./result" + beta: "volume://result-code" + mode: "one-way-safe" + configurationBeta: + permissions: + defaultOwner: "id:1000" + defaultGroup: "id:1000" + forward: + vote: + source: "tcp::5000" + destination: "network://front-tier:tcp:vote:80" + result: + source: "tcp::5001" + destination: "network://front-tier:tcp:result:80"