Payment Hub is a payment processing service designed to manage and streamline online payment operations. The service is containerized with Docker and wrapped by Makefile.
Features
- Blue-Green Deployment: Ensures zero downtime during updates and new version deployments.
- Comprehensive Health Checks: Regular health checks for all services to ensure smooth operations.
- Integrated with Stripe, RabbitMQ, and PostgreSQL;
- Local and production environment configurations;
- GNU Make;
- Docker;
- clone the repository;
cd payment-hub-new
- navigate to the project directory;- copy an appropriate
.env
file example; - set up the environment variables (ask for the keys, seeds if required, correct local ports);
- (for local environment) ask for DB seeds;
make
- Makefile will read environment fromNODE_ENV
and use corresponding commands;
The local development environment can be established by deploying dockerized services with a simple make
command.
However, it's worth noting that the NodeJS service (payment-hub) may not perform optimally when run within a local Docker container.
To address this, one potential solution is to deploy the project with the NodeJS app running directly on the host machine while keeping other services within Docker containers. This can help improve the performance of the NodeJS service during local development.
For such setup use the .env.local.ph-at-host
file as an example, but get the DB and RabbitMQ env var values from the .env.dev
file.
For such setup do the following:
- install the NodeJS locally without docker;
- comment the
payment-hub
service in thedocker-compose.local.yml
file; cp .env.local.ph-at-host .env
- set up the environment variables in the
.env
file; make
- build & run the dockerized services;
Additionally, you will need to ask for DB seeds.
Set application environment using variable NODE_ENV
.
local
- basic setup without blue/green deployment;.env
file example:.env.local.ph-at-host
development
- run tests on dockerized test database;.env
file example:.env.dev
production
- tests and fixtures won't be ran; env var values are set in the GitLab;
Makefile contains the scripts based on environments, but you can use the make
commands manually.
Useful commands are listed down below.
Database Operations
make db-migrate
- migrate database changes;make db-seed
- seed the database;
Testing
make test
- run tests;make test-e2e
- run functional tests:
Blue-Green Deployment
make blue-green-deploy
- executes the blue-green deployment script;