Local Deployment
-
Make sure the infra repository is already running locally.
-
Make sure the
DOCKER_NETWORK_NAMEvalue in.envmatchesmonitoring-networkor your custom network. -
Create shared Docker networks for inter-service communication and monitoring:
docker network create kafka-net
docker network create monitoring-network- Install the Loki Docker plugin (allows log shipping without extra npm packages):
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissionsPostgreSQL Streaming Replication
The service uses PostgreSQL in streaming replication mode to improve read performance.
- Primary (
postgresql-primary) — main write instance (port5432) - Replica (
postgresql-replica) — read-only replica (port5433)
# Check on primary:
docker exec -it access-control-service-postgres-primary psql -U lambdius -d access-control-service -c "SELECT * FROM pg_stat_replication;"
# Check on replica:
docker exec -it access-control-service-postgres-replica psql -U lambdius -d access-control-service -c "SELECT pg_is_in_recovery();"
# Should return `t` (true), meaning the replica is in recovery mode (read-only).Project Commands
| Command | Makefile | Description |
|---|---|---|
| Infrastructure | ||
[ -f .env.example ] && cp -f .env.example .env |
make env |
Generate .env from example (if file exists). |
docker-compose up -d |
make up |
Start all services in detached mode. |
docker-compose stop |
make stop |
Stop containers without removing them. |
docker-compose down |
make down |
Stop and remove containers and networks. |
docker-compose down && docker-compose up -d |
make restart |
Restart the entire infrastructure. |
docker-compose build |
make build |
Build application Docker images. |
docker-compose logs -f service |
make logs |
Stream logs from the main service. |
docker-compose logs -f |
make logs-all |
Stream combined logs from all services. |
docker-compose ps |
make ps |
Show status of running containers. |
docker-compose down -v |
make clean |
Remove containers along with volumes (wipes DB data). |
docker system prune -f |
make prune |
Global cleanup of unused Docker resources. |
| Development | ||
npm run lint |
make lint |
Run ESLint code checks. |
npm run lint:fix |
make lint-fix |
Auto-fix formatting and log changed files. |
| Database | ||
npx mikro-orm migration:create --name=$(name) |
make migration name="*" |
Generate a new migration based on entity changes. |
npx mikro-orm migration:up |
make migrate |
Apply all pending migrations to the database. |
npx mikro-orm seeder:run --class=SystemSeeder |
make seed |
Run the default system seeder. |
npx mikro-orm seeder:run --class=DemoSeeder |
make seed class=Demo |
Run a specific MikroORM seeder by class prefix. |
npx tsx ./src/infrastructure/redis/seeder.ts --dataset=system |
make seed-redis |
Seed Redis using the default system dataset. |
npx tsx ./src/infrastructure/redis/seeder.ts --dataset=demo |
make seed-redis dataset=demo |
Seed Redis using a specific dataset. |
| Test | ||
npx jest --config ./jest.unit.config.ts |
make test |
Run unit tests. |
npx jest --config ./jest.unit.config.ts --coverage |
make coverage |
Run unit tests with coverage report. |