Build and Deploy Steps
A. Running Locally without Docker
Clone repository
# Fork and Clone the Repository
git clone https://github.com/PSMRI/ubi-beneficiary-backend.git
cd ubi-beneficiary-backend
# Check out the main branch
git checkout main
Install Dependencies
# Install dependencies
npm install
Optional - Set up Git hooks
# Set up Git hooks (Husky)
npm run prepare
git config core.hooksPath .husky/_
chmod +x .husky/pre-commit
chmod +x .husky/commit-msg
Create / Update .env
Ensure you have created and updated .env
with required variables
Running in Dev Mode
npm run start:dev
The backend will be available at: 👉 http://localhost:3000
Running in Production Mode
npm run build
npm run start:prod
B. Running with Docker
Create / Update .env
Ensure you have created and updated .env
with required variables
Build Docker Image Run Steps
Using Dockerfile from the repo code, you can generate an image
# Build the Docker Image
docker build -t beneficiary-backend .
Example .env for docker
The docker-compose.yml
requires a separate file .env
# Database
DATABASE_NAME=uba_beneficiary_mw
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=postgres
# pgAdmin
PGADMIN_DEFAULT_EMAIL=admin@example.com
PGADMIN_DEFAULT_PASSWORD=admin123
# Keycloak
KC_DB=postgres
KC_DB_URL=jdbc:postgresql://postgres:5432/uba_beneficiary_mw
KC_DB_USERNAME=postgres
KC_DB_PASSWORD=postgres
KEYCLOAK_ADMIN=admin
KEYCLOAK_ADMIN_PASSWORD=admin123
# Hasura
HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:postgres@postgres:5432/uba_beneficiary_mw
HASURA_GRAPHQL_ADMIN_SECRET=hasura_secret
Use Image in docker-compose
Use generated images in docker-compose.yml
# Run the Container
docker-compose up -d
More about docker-compose
The docker-compose.yml located in the root of the repository provisions the following services:
Postgres (port
5432
)pgAdmin (port
8082
)Keycloak (port
8080
)Hasura GraphQL Engine (port
8081
)
Verify Services
Database:
localhost:5432
pgAdmin: http://localhost:8082
Keycloak: http://localhost:8080
Hasura Console: http://localhost:8081
Last updated
Was this helpful?