Compare commits

...

2 Commits

3 changed files with 201 additions and 0 deletions

26
.dockerignore Normal file
View File

@ -0,0 +1,26 @@
# .dockerignore
# Do not copy environment files into the image
.env
.env.prod
# Do not copy git repository
.git
.gitignore
# Do not copy docker files themselves
Dockerfile
docker-compose.yml
docker-compose.prod.yml
.dockerignore
# Do not copy local IDE settings
.vscode
.idea
# Do not copy local test data or backups
*.bak
AllStaff.json
hierarchy_mapping.json
# Deno cache directory (if exists locally)
.deno

37
.gitignore vendored Normal file
View File

@ -0,0 +1,37 @@
# .gitignore
# Environment Variables (NEVER commit these)
.env
.env.prod
.env.local
# Docker volumes
hrms_db_data/
# IDE and OS files
.vscode/
.idea/
.DS_Store
*.swp
# Deno specific
.deno/
# Backup files
*.bak
routes.ts.bkp
# Logs
*.log
npm-debug.log*
# Database Dumps
database-dump/*.sql
# Sensitive Data Imports/Exports
services/ems/AllStaff.json
services/ems/hierarchy_mapping.json
# Protobuf generation
node_modules/
generated/

138
docker-compose.prod.yml Normal file
View File

@ -0,0 +1,138 @@
version: '3.8'
services:
# ==========================================
# DATABASES (Isolated & Secured)
# ==========================================
ems_db:
image: docker.io/library/mysql:8.4
container_name: hrms_prod_ems_db
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-root}
MYSQL_DATABASE: hrms_ems
MYSQL_USER: ${DB_USER:-admin}
MYSQL_PASSWORD: ${DB_PASSWORD:-admin123}
volumes:
- ./init-db/01-init-ems.sql:/docker-entrypoint-initdb.d/01-init-ems.sql:Z
- prod_ems_db_data:/var/lib/mysql
networks:
- hrms_internal_network
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
ams_db:
image: docker.io/library/mysql:8.4
container_name: hrms_prod_ams_db
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-root}
MYSQL_DATABASE: hrms_ams
MYSQL_USER: ${DB_USER:-admin}
MYSQL_PASSWORD: ${DB_PASSWORD:-admin123}
volumes:
- ./init-db/02-init-ams.sql:/docker-entrypoint-initdb.d/02-init-ams.sql:Z
- prod_ams_db_data:/var/lib/mysql
networks:
- hrms_internal_network
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
lms_db:
image: docker.io/library/mysql:8.4
container_name: hrms_prod_lms_db
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-root}
MYSQL_DATABASE: hrms_lms
MYSQL_USER: ${DB_USER:-admin}
MYSQL_PASSWORD: ${DB_PASSWORD:-admin123}
volumes:
- ./init-db/03-init-lms.sql:/docker-entrypoint-initdb.d/03-init-lms.sql:Z
- prod_lms_db_data:/var/lib/mysql
networks:
- hrms_internal_network
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
# ==========================================
# MICROSERVICES
# ==========================================
gateway:
build: .
container_name: hrms_prod_gateway
command: run -A --env-file=.env.prod services/gateway/main.ts
ports:
- "8000:8000"
env_file:
- .env.prod
depends_on:
ems:
condition: service_started
networks:
- hrms_internal_network
restart: unless-stopped
ems:
build: .
container_name: hrms_prod_ems
command: run -A --env-file=.env.prod services/ems/main.ts
env_file:
- .env.prod
environment:
- DB_HOST=ems_db # <-- Forces EMS to connect to ems_db
depends_on:
ems_db:
condition: service_healthy
networks:
- hrms_internal_network
restart: unless-stopped
ams:
build: .
container_name: hrms_prod_ams
command: run -A --env-file=.env.prod services/ams/main.ts
env_file:
- .env.prod
environment:
- DB_HOST=ams_db # <-- Forces AMS to connect to ams_db
depends_on:
ams_db:
condition: service_healthy
ems:
condition: service_started
networks:
- hrms_internal_network
restart: unless-stopped
lms:
build: .
container_name: hrms_prod_lms
command: run -A --env-file=.env.prod services/lms/main.ts
env_file:
- .env.prod
environment:
- DB_HOST=lms_db # <-- Forces LMS to connect to lms_db
depends_on:
lms_db:
condition: service_healthy
ems:
condition: service_started
networks:
- hrms_internal_network
restart: unless-stopped
networks:
hrms_internal_network:
driver: bridge
volumes:
prod_ems_db_data:
prod_ams_db_data:
prod_lms_db_data: