Skip to content

Latest commit

 

History

History
133 lines (87 loc) · 3.09 KB

manual-setup.md

File metadata and controls

133 lines (87 loc) · 3.09 KB

Manual Setup

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.

Prerequisites

Make sure you have this repo as well as the following additional repos checked out:

Start the Shared Platform Infrastructure

From this repository, run:

docker-compose up -d

Start the messenger Service

  1. From the messenger repository, build the Docker image:

    # From ./app
    docker build -t messenger .
  2. From the messenger repository, start the PostgreSQL database:

    docker-compose up -d
  3. 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
  4. SSH into the container to set up the PostgreSQL DB:

    docker exec -it messenger /bin/bash
  5. Create the PostgreSQL DB:

    PGDATABASE=postgres node scripts/create-db.mjs
  6. Create the PostgreSQL DB tables:

    node scripts/create-schema.mjs
  7. Create some PostgreSQL DB seed data:

    node scripts/create-seed-data.mjs

Start the notifier Service

  1. From the notifier repository, build the Docker image:

    docker build -t notifier .
  2. From the notifier repository, start the PostgreSQL database:

    docker-compose up -d
  3. 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
  4. SSH into the container to set up the PostgreSQL DB:

    docker exec -it notifier /bin/bash
  5. Create the PostgreSQL DB:

    PGDATABASE=postgres node scripts/create-db.mjs
  6. Create the PostgreSQL DB tables:

    node scripts/create-schema.mjs
  7. Create some PostgreSQL DB seed data:

    node scripts/create-seed-data.mjs

Use the Service

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

Cleanup

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)