Using docker-compose.yml for local RegTech development
As with most local development, some support services need to be running to support the app being developed. These services can be started by using the docker-compose.yml file in this repo.
- Docker engine version 1.13.0+ with docker compose version 3.0+ support needs to be installed to run all the containerized support services.
- Optional Github repository:
- Additional RegTech developed modules may need to be added to support local development:
- user-fi-management may be needed for front end development, it is used for user management, and institutions api.
- sbl-filing-api may be needed for front end development, it is used for filing SBL submissions.
- regtech-mail-api may be needed to test the frontend sending mail to SBL Help.
- If additional repository modules are needed as support services, the following folder structure should be followed, so docker-compose.yml can find and build the module with the correct relative path:
code-root ├── regtech-mail-api ├── regtech-user-fi-management ├── sbl-filing-api └── sbl-project (current repository)
- Additional RegTech developed modules may need to be added to support local development:
The docker-compose.yml currently contains 7 support services - 4 open source third party services, and 3 RegTech developed services:
- PostgreSQL as the database storage
- Keycloak for authentication and authorization
- Locust for load balance testing of the filing-api
- user-fi-management for user management, and institutions api.
- sbl-filing-api for filing SBL submissions
- mail-api for sending mail via SMTP to Mailpit or through AWS SES
- mailpit "dead-end" SMTP server for testing the mail-api
The docker-compose.yml is broken into profiles:
- backend - Runs Postgres, Keycloak, user-fi-management, sbl-filing-api, mail-api and mailpit
- locust - Runs Postgres, Keycloak, Locust, and sbl-filing-api
Only run development needed services. For front end development, the 6 backend services are likely to be needed; if development is done on user-fi-management, sbl-filing-api, or mail-api then only PostgreSQL
and Keycloak
are needed.
- To run all services, simply issue command
This will launch every service defined in the docker-compose.yml
docker compose --profile '*' up -d --remove-orphans --build
- To run just the backend services (no Locust)
docker compose --profile backend up -d --remove-orphans --build
- To run Locust load testing
docker compose --profile locust up -d --remove-orphans --build
- If only some of the services are needed, check what services are availabe in docker-compose.yml, then run the command specifying the services. e.g. to start up
PostgreSQL
andKeycloak
, issue the commanddocker compose up -d pg keycloak
- in docker-compose.yml,
PostgreSQL
service is namedpg
, andKeycloak
is namedkeycloak
- the
-d
flag in the command is to run the containers in detached mode, so your development terminal is not inundated with logs - the
--remove-orphans
flag removes containers not defined in the compose file. Good way to clean up dangling containers. - the
--build
flag ensures the latest image is built for the supporting repos and not using Docker cached images
- in docker-compose.yml,
- To stop the containers, simply issue the command
docker compose --profile <name of profile loaded> stop
- If you would like to completely destroy the containers and the volumes, so they can be recreated with fresh data:
docker compose --profile <name of profile loaded> down -v
- the
-v
flag removes any volumes created by docker compose, this makes sure the services that attaches a volume, likePostgreSQL
, gets the data wiped as well.
- the
- If a RegTech module needs to have the image rebuilt because there was an update to the codebase, we can use the
docker compose build
command with the service name, e.g.docker compose build user-fi
- Exposed ports for each service is specified in docker-compose.yml, for reference here:
- PostgreSQL(
pg
) can be accessed from the host machine at port5432
- Keycloak (
keycloak
) is accessible at8880
- user-fi-management (
user-fi
) is accessible at8881
- sbl-filing (
filing
) is accessible at8882
- regtech-mail-api (
mail-api
) is accessible at8765
- mailpit (
mailpit
) is accessible at1025
for SMTP,8025
for the web interface (http://localhost:8025/) - locust (
locust
) is accessible at8089
for the web interface (http://localhost:8089/)
- PostgreSQL(
With user-fi-management, pre-populating the database with some mock institutions can aid front-end development. We've created some instructions, and some mock institution json files in mock_data directory to help with that process.