Skip to content

Commit

Permalink
Modified project to use Mutagen Compose integration.
Browse files Browse the repository at this point in the history
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 <jacob@mutagen.io>
  • Loading branch information
xenoscopic committed Apr 27, 2023
1 parent 3accda9 commit 188a107
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 14 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -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/).
Expand Down
55 changes: 41 additions & 14 deletions docker-compose.yml
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"

0 comments on commit 188a107

Please sign in to comment.