Skip to content

Commit

Permalink
docs(sandbox): update-sandbox-docker-compose (#246)
Browse files Browse the repository at this point in the history
Update sandbox docker-compose.yml and docs

gh-244
  • Loading branch information
jamescrowley321 authored Jul 11, 2021
1 parent 98fdb0f commit b967ee7
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The current catalog consists of the following services:
* [video-conferencing-service](services/video-conferencing-service)
* [bpmn-service](services/bpmn-service)

This repository also contains a set of example projects in the [sandbox](sandbox) directory.
This repository also contains a set of example projects in the [sandbox](sandbox) directory that can be run from `docker-compose`.

* [auth-multitenant-example](sandbox/auth-multitenant-example)
* [auth-ms-basic-example](sandbox/auth-ms-basic-example)
Expand Down
17 changes: 12 additions & 5 deletions sandbox/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
# Sandbox Examples
The sandbox examples have been preconfigured with a `docker-compose` file for easy setup. Please examine the environment variables in the file prior to running and change the variables where appropriate. For example, if you want to test the Keycloak integration, plugin your configuration values to the `docker-compose.yml` file.
The sandbox examples have been pre-configured with a `docker-compose` file for easy setup. Please examine the environment variables in the file prior to running and change the variables where appropriate. For example, if you want to test the Keycloak integration, plugin your configuration values to the `docker-compose.yml` file.

## Basic Setup
You must have `docker-compose` installed locally. This is not a production grade setup.

To start the services, simply run from this directory.
```shell
docker-compose up
docker-compose up --build
```

If you would like the services to run in detached mode, supply the `-d` parameter.

The services are now running under the following:
* [notification-example](http://localhost:3030)
* [auth-multitenant-example](http://localhost:3000)
* [audit-ms-example](http://localhost:3032/explorer)
* [notification-example](http://localhost:3030/explorer)
* [auth-multitenant-example](http://localhost:3000/explorer)
* [in-mail-example](http://localhost:3033/explorer)
* [notification-socket-example](http://localhost:3030/explorer)
* [scheduler-example](http://localhost:3034/explorer)
* [video-conferencing-ms-example](http://localhost:3040/explorer)
* [workflow-ms-example](http://localhost:3031/explorer)
* [Camunda](http://localhost:8080)
* [pgAdmin](http://localhost:5050)
* PostgreSQL - localhost:5432
* Redis - localhost:6739

Credentials for the database and pgAdmin are in the `docker-compose` file or can be overridden with environment variables. An orchestration container also runs that creates two databases: `notification_db` and `authentication_db`. You will still need to run the database migrations yourself.
Credentials for the database and pgAdmin are in the `docker-compose` file or can be overridden with environment variables. An orchestration container creates all of the databases and another runs the service DB migrations for you.

When connecting to PostgreSQL or from within one of the containers, pay attention to the network and service name defined in the `docker-compose` file, since you will connect via the Docker network and service name.
56 changes: 39 additions & 17 deletions sandbox/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ x-auth-variables: &auth-variables
REDIS_PORT: 6379
REDIS_URL:
REDIS_PASSWORD:
REDIS_DATABASE: 0
REDIS_DB: 0
USER_TEMP_PASSWORD: tempP@ssw0rd
GOOGLE_AUTH_URL:
GOOGLE_AUTH_CLIENT_ID:
Expand Down Expand Up @@ -55,8 +55,8 @@ x-audit-variables: &audit-variables
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_URL:
REDIS_PASSWORD:
REDIS_DATABASE: 0
REDIS_PASSWORD: test
REDIS_DB: 0
JWT_SECRET: i_am_a_strong_secret
JWT_ISSUER: https://loopback4-microservice-catalog

Expand All @@ -80,7 +80,7 @@ x-scheduler-variables: &scheduler-variables
x-video-variables: &video-variables
VONAGE_API_KEY: 0
VONAGE_API_SECRET: abc
TIME_TO_START:
TIME_TO_START: 10
DB_HOST: localhpostgresost
DB_PORT: 5432
DB_USER: ${POSTGRES_USER:-postgres}
Expand Down Expand Up @@ -123,10 +123,14 @@ services:
- redis
- postgres_orchestrator
- auth-multitenant-migration
restart: on-failure

auth-multitenant-migration:
image: sourceloop/auth-multitenant-example:latest
command: ["npm", "run", "db:migrate"]
build:
context: ./auth-multitenant-example
dockerfile: Dockerfile
command: sh -c "sleep 60 && npm run db:migrate"
environment: *auth-variables
depends_on:
- postgres
Expand Down Expand Up @@ -157,6 +161,7 @@ services:
JWT_ISSUER: https://loopback4-microservice-catalog
depends_on:
- postgres
restart: on-failure

workflow-ms-example:
image: sourceloop/workflow-ms-example
Expand All @@ -175,18 +180,22 @@ services:
- camunda
- postgres_orchestrator
- workflow-migration
restart: on-failure

workflow-migration:
image: sourceloop/workflow-ms-example:latest
command: ["npm", "run", "db:migrate"]
build:
context: ./workflow-ms-example
dockerfile: Dockerfile
command: sh -c "sleep 60 && npm run db:migrate"
environment: *workflow-variables
depends_on:
- postgres
- postgres_orchestrator
networks:
- sandbox
restart: on-failure

audit-ms-example:
image: sourceloop/audit-ms-example
build:
Expand All @@ -201,17 +210,21 @@ services:
- postgres
- postgres_orchestrator
- audit-ms-migration

restart: on-failure

audit-ms-migration:
image: sourceloop/audit-ms-example:latest
command: ["npm", "run", "db:migrate"]
command: sh -c "sleep 60 && npm run db:migrate"
build:
context: ./audit-ms-example
dockerfile: Dockerfile
environment: *audit-variables
depends_on:
- postgres
- postgres_orchestrator
networks:
- sandbox
restart: on-failure
restart: on-failure

scheduler-example:
image: sourceloop/scheduler-example
Expand All @@ -226,8 +239,8 @@ services:
depends_on:
- postgres
- postgres_orchestrator

restart: on-failure

video-conferencing-ms-example:
image: sourceloop/video-conferencing-ms-example
build:
Expand All @@ -240,11 +253,15 @@ services:
environment: *video-variables
depends_on:
- postgres
- postgres_orchestrator
- postgres_orchestrator
restart: on-failure

video-conferencing-ms-migration:
image: sourceloop/workflow-helloworld:latest
command: ["npm", "run", "db:migrate"]
image: sourceloop/video-conferencing-ms-example
build:
context: ./video-conferencing-ms-example
dockerfile: Dockerfile
command: sh -c "sleep 60 && npm run db:migrate"
environment: *video-variables
depends_on:
- postgres
Expand All @@ -266,6 +283,7 @@ services:
depends_on:
- postgres
- postgres_orchestrator
restart: on-failure

redis:
image: "redis:alpine"
Expand Down Expand Up @@ -313,15 +331,19 @@ services:
depends_on:
- postgres
command: >
bash -c "export PGPASSWORD=${POSTGRES_PASSWORD:-changeme} &&
bash -c "export PGPASSWORD=${POSTGRES_PASSWORD:-changeme} && sleep 30 &&
psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database authentication_db' &&
psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database notification_db' &&
psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database workflow_db' &&
psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database audit_db' &&
psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database scheduler_db'"
psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database scheduler_db'
psql -U ${POSTGRES_USER:-postgres} -d postgres -h postgres -c 'create database in_mail_db'"
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4
Expand Down

0 comments on commit b967ee7

Please sign in to comment.