Hosting Infrastructure
Related docs:
DEPLOYMENT·CI/CD Pipeline
1. Environment Topology
The Pakashop infrastructure is split into two identical stacks (Staging and Production) to ensure safe testing before going live.
| Component | Staging Environment (main) | Production Environment (production) |
|---|---|---|
| Frontend | Vercel (Staging) | Vercel (Production) |
| Backend API | AWS EC2 (Staging) | AWS EC2 (Production) |
| Database | RDS PostgreSQL (Staging) | RDS PostgreSQL (Production) |
| Redis | EC2 Redis (Staging) | EC2 Redis (Production) |
2. EC2 Infrastructure
Both Staging and Production EC2 instances run Ubuntu 22.04 LTS with Nginx as a reverse proxy.
2.1 Process Management (systemd)
All services are managed by systemd unit files to ensure automatic restarts and persistence.
| Service | Unit Name |
|---|---|
| API Gateway | pakashop-gateway.service |
| Backend API | pakashop-backend.service |
| Config | pakashop-config.service |
| Notifications | pakashop-notifications.service |
| Moderation | pakashop-moderation.service |
| Recommendations | pakashop-recommendations.service |
3. Deployment and Branch Mapping
- Staging: Deployed automatically when code is pushed to the
mainbranch. - Production: Deployed automatically when code is pushed to the
productionbranch.
All deployments use the centralized scripts/deploy.sh script, which is branch-aware and pulls the latest code from the branch currently checked out on the host.
4. Maintenance and Monitoring
- Logs: All environments ship logs to
journald. Live logs can be viewed withjournalctl -u <unit> -f. - Health Checks: Middleware.io monitors both Staging and Production stacks with separate environment tags.
- Status Dashboard: Use
./scripts/pakashop-status.shon either host to see a color-coded status of all local services.