Note: This repository is meant to hold the shared infrastructure for the demo architecture. Starting up the entire system including the applications is not part of its role, but instructions are included here for simplicity.
Make sure you have this repo as well as the following additional repos checked out:
From this repository, run:
docker-compose up -d
-
From the
messenger
repository, build the Docker image:# From ./app docker build -t messenger .
-
From the
messenger
repository, start the PostgreSQL database:docker-compose up -d
-
Start the
messenger
service in a container:docker run -d --rm -p 4000:4000 --name messenger -e PGPASSWORD=postgres -e CREATE_DB_NAME=messenger -e PGHOST=messenger-db -e AMQPHOST=rabbitmq -e AMQPPORT=5672 -e PORT=4000 --network mm_2023 messenger
-
SSH into the container to set up the PostgreSQL DB:
docker exec -it messenger /bin/bash
-
Create the PostgreSQL DB:
PGDATABASE=postgres node scripts/create-db.mjs
-
Create the PostgreSQL DB tables:
node scripts/create-schema.mjs
-
Create some PostgreSQL DB seed data:
node scripts/create-seed-data.mjs
-
From the
notifier
repository, build the Docker image:docker build -t notifier .
-
From the
notifier
repository, start the PostgreSQL database:docker-compose up -d
-
Start the
notifier
service in a container:docker run -d --rm -p 5000:5000 --name notifier -e PGPASSWORD=postgres -e CREATE_DB_NAME=notifier -e PGHOST=notifier-db -e AMQPHOST=rabbitmq -e AMQPPORT=5672 -e PORT=5000 -e PGPORT=5433 --network mm_2023 notifier
-
SSH into the container to set up the PostgreSQL DB:
docker exec -it notifier /bin/bash
-
Create the PostgreSQL DB:
PGDATABASE=postgres node scripts/create-db.mjs
-
Create the PostgreSQL DB tables:
node scripts/create-schema.mjs
-
Create some PostgreSQL DB seed data:
node scripts/create-seed-data.mjs
Follow the instructions here to test out the service. You should see notification logs coming from the notifier:1
container. You can see them easily by running docker logs -f notifier
Once you are done playing with this microservices demo architecture, to remove all running and dangling containers, run:
docker stop messenger notifier && docker rm messenger notifier
Then, from each cloned repository, run:
docker-compose down
And optionally, to remove any potentially dangling images, run:
docker rmi $(docker images -f dangling=true -aq)