Skip to content

🏠 Dhanman OVH VPS Infrastructure – Full Deployment Documentation


πŸ“† 1. Tech Stack Overview

Layer Technology Used
Backend APIs .NET 9
Frontend React 18 (Vite)
Database PostgreSQL 17
Auth Auth0 (QA + PROD tenants)
Logging Serilog β†’ Promtail β†’ Loki
Monitoring Grafana, Prometheus, Node/PG Exporter, Uptime Kuma
Email Zoho Mail (MX), Brevo SMTP
Code Quality SonarQube (Community)
Automation Ansible
CI/CD GitHub Actions
Reverse Proxy NGINX + Certbot

🧰 2. Repositories Overview

Repository Purpose
dhanman-common Shared organization-level API logic
dhanman-community Housing/residents management
dhanman-inventory Stock and warehouse management
dhanman-payroll Salary and employee management
dhanman-purchase Vendor, PO, GRN, Bills
dhanman-sales Customer billing, invoices
dhanman-react Frontend App
b2a-crosscutting Shared EF Core logic
└️ b2a-permissions Permission handling module
└️ b2a-emailtemplate Email templating module

πŸ—ƒοΈ 3. Database Layout (PostgreSQL 17)

βœ… Production

  • prod-dhanman-common
  • prod-dhanman-community
  • prod-dhanman-inventory
  • prod-dhanman-payroll
  • prod-dhanman-purchase
  • prod-dhanman-sales

βœ… QA

  • qa-dhanman-common
  • qa-dhanman-community
  • qa-dhanman-inventory
  • qa-dhanman-payroll
  • qa-dhanman-purchase
  • qa-dhanman-sales

βš™οΈ 4. Deployment Architecture

πŸ”Ή Folder Structure (on OVH)

/var/www/
β”œβ”€β”€ prod/
β”‚   β”œβ”€β”€ dhanman-common/
β”‚   β”‚   β”œβ”€β”€ .env
β”‚   β”‚   └── logs/dhanman-common-YYYYMMDD.log
β”‚   β”œβ”€β”€ ...
β”‚   └── logs/
β”œβ”€β”€ qa/
β”‚   β”œβ”€β”€ dhanman-common/
β”‚   β”‚   β”œβ”€β”€ .env
β”‚   β”‚   └── logs/dhanman-common-YYYYMMDD.log
β”‚   β”œβ”€β”€ ...
β”‚   └── logs/

πŸ”Ή Ports

Env Service Port
QA dhanman-common 5101
QA dhanman-community 5102
QA dhanman-inventory 5103
QA dhanman-payroll 5104
QA dhanman-purchase 5105
QA dhanman-sales 5106
PROD dhanman-common 5001
PROD dhanman-community 5002
PROD dhanman-inventory 5003
PROD dhanman-payroll 5004
PROD dhanman-purchase 5005
PROD dhanman-sales 5006

πŸ”Ή .env Example (Per Service)

ASPNETCORE_ENVIRONMENT=Production
ConnectionStrings__MainDb=Host=...;Database=prod-dhanman-common;...
ConnectionStrings__PermissionsDb=...;
Brevo__ApiKey=...;
Logging__Path=/var/www/prod/logs/
- Injected dynamically from GitHub Secrets during deployment. - Ensures clean separation of environments.


πŸš€ 5. CI/CD: GitHub Actions

βœ… QA Deployment

  • Triggered on merge to main.
  • Auto deploys to OVH:
  • SSH
  • Rsync binaries
  • Generate .env
  • Restart systemd service

βœ… PROD Deployment

  • Manual via workflow_dispatch.
  • Uses same logic but run intentionally.

βœ… Secrets Management

Secret Name Purpose
DO_HOST OVH IP address
DO_USER SSH user
DO_SSH_KEY SSH private key
CONNECTIONSTRINGS__PURCHASEDB_QA QA DB conn string
CONNECTIONSTRINGS__PURCHASEDB_PROD PROD DB conn string
CONNECTIONSTRINGS__PERMISSIONSDB_QA Permissions DB
CONNECTIONSTRINGS__PERMISSIONSDB_PROD Permissions DB
SONAR_TOKEN SonarCloud token

πŸ” 6. Authentication with Auth0

  • Two tenants: qa-auth0, prod-auth0
  • Custom Actions:
  • Inject customer_id, org_id in access tokens
  • Used in both frontend and backend

πŸ“„ 7. Logging Architecture

  • Serilog (JSON logs)
  • Logs written to:
  • /var/www/prod/logs/*.log
  • /var/www/qa/logs/*.log
  • Filename format: service-name-YYYYMMDD.log
  • Promtail regex extracts service/environment
  • Loki aggregates logs
  • Grafana dashboards include:
  • Error logs
  • Recent events
  • SQL queries via EF

πŸ“Š 8. Monitoring & Metrics

  • Uptime Kuma: HTTP-based health monitoring
  • Prometheus:
  • Node Exporter: CPU, RAM, disk
  • PostgreSQL Exporter: query times, active connections
  • Grafana Dashboards:
  • Live stats
  • Alerts (future enhancement)

πŸ“§ 9. Email Setup

  • Zoho Mail:
  • Mailboxes like info@dhanman.com
  • SPF, DKIM, DMARC configured

  • Brevo SMTP:

  • Used in email template service
  • Injected via .env

πŸ”’ 10. Code Quality

  • SonarQube (Community):
  • .NET and React projects
  • Scans run in pipeline
  • Token stored in SONAR_TOKEN

πŸ”§ 11. Future Improvements

  • [ ] PgBouncer setup for DB pooling
  • [ ] Auto backup of PostgreSQL
  • [ ] Log archival + rotation
  • [ ] Grafana alerts for anomalies
  • [ ] Audit logging for user actions

βœ… Summary Table

Area Status
APIs 6 PROD + 6 QA
Frontend React 18 SPA
Authentication Auth0 (multi-tenant)
CI/CD GitHub Actions
Logging Serilog + Loki
Monitoring Prometheus + Kuma
Email Zoho + Brevo SMTP
Code Quality SonarQube CI
Deployment Ansible + GitHub