- Docker: Used for containerizing the application (frontend & backend).
- Nginx: Configured as a reverse proxy to route traffic efficiently.
- PostgreSQL/MongoDB: (If applicable) Used as the database.
- Redis: (If applicable) Used for caching and message queuing.
- Node.js & Express: Backend framework.
- Server: Hosted on an AWS EC2 instance.
- Port Mapping:
- Frontend runs on port
81
. - Backend runs on port
8000
. - Nginx handles the routing and load balancing.
- Frontend runs on port
- Clone the repository and navigate to the project directory.
- Use Docker Compose to build and start services:
docker-compose up -d --build
- Ensure Nginx is properly configured and restarted:
systemctl restart nginx
- Verify that both frontend and backend are accessible via their respective URLs.
server {
listen 81;
location / {
proxy_pass http://frontend_container:3000;
}
}
server {
listen 8000;
location / {
proxy_pass http://backend_container:8000;
}
}
- Use
docker logs <container_id>
to check logs. - Ensure proper monitoring using Prometheus, Grafana, or CloudWatch.
- Integrated with Jenkins/GitHub Actions for automated builds and deployments.
- Runs linting, tests, and Docker image builds before pushing to production.
- SSL termination via Nginx (if using HTTPS).
- Use
.env
for sensitive configurations and avoid hardcoding credentials. - Regular security patching and vulnerability scanning for containers.
This setup ensures scalability, security, and efficient traffic handling. 🚀