Skip to main content

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.

ComponentStaging Environment (main)Production Environment (production)
FrontendVercel (Staging)Vercel (Production)
Backend APIAWS EC2 (Staging)AWS EC2 (Production)
DatabaseRDS PostgreSQL (Staging)RDS PostgreSQL (Production)
RedisEC2 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.

ServiceUnit Name
API Gatewaypakashop-gateway.service
Backend APIpakashop-backend.service
Configpakashop-config.service
Notificationspakashop-notifications.service
Moderationpakashop-moderation.service
Recommendationspakashop-recommendations.service

3. Deployment and Branch Mapping

  • Staging: Deployed automatically when code is pushed to the main branch.
  • Production: Deployed automatically when code is pushed to the production branch.

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 with journalctl -u <unit> -f.
  • Health Checks: Middleware.io monitors both Staging and Production stacks with separate environment tags.
  • Status Dashboard: Use ./scripts/pakashop-status.sh on either host to see a color-coded status of all local services.