# πŸš€ Deployment Guide - Hosting Platform ## πŸ“Š Server Information **Server IP**: `176.96.129.77` **OS**: Ubuntu 24.04 LTS **RAM**: 4GB **CPU**: 4 cores --- ## 🌐 Production URLs | Service | URL | Status | |---------|-----|--------| | **Frontend** | https://argeict.net | βœ… Running | | **Backend API** | https://api.argeict.net | βœ… Running | | **Gitea** | https://gitea.argeict.net | βœ… Running | --- ## 🎯 Deployed Services ### βœ… Core Services | Service | Port | Internal URL | Status | |---------|------|--------------|--------| | **Frontend (React + Vite)** | 3001 | http://127.0.0.1:3001 | βœ… Running | | **Backend API (Flask)** | 5000 | http://127.0.0.1:5000 | βœ… Running | | **Gitea** | 3000 | http://127.0.0.1:3000 | βœ… Running | | **PostgreSQL** | 5432 | localhost:5432 | βœ… Running | | **Redis** | 6379 | localhost:6379 | βœ… Running | | **Nginx (HTTPS)** | 443 | - | βœ… Running | | **Nginx (HTTP β†’ HTTPS)** | 80 | - | βœ… Running | ### πŸ” Credentials **Gitea Admin**: - Username: `hostadmin` - Password: `HostAdmin2024!` - Repository: https://gitea.argeict.net/hostadmin/hosting-platform **PostgreSQL**: - User: `hosting_user` - Password: `HostingDB2024!` - Database: `hosting_db` **Redis**: - No password (localhost only) **SSL Certificates (Let's Encrypt)**: - Certificate: `/etc/letsencrypt/live/argeict.net/fullchain.pem` - Private Key: `/etc/letsencrypt/live/argeict.net/privkey.pem` - Domains: `argeict.net`, `api.argeict.net`, `gitea.argeict.net` - Expires: `2026-04-10` (Auto-renewal enabled via certbot timer) --- ## πŸ—οΈ Architecture ``` Internet β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Nginx Reverse Proxy (Port 80) β”‚ β”‚ - Frontend: / β”‚ β”‚ - Backend API: /api β”‚ β”‚ - Webhook: /webhook β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β–Ό β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚Frontend β”‚ β”‚ Backend β”‚ β”‚ Gitea β”‚ β”‚ :3001 β”‚ β”‚ :5000 β”‚ β”‚ :3000 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚PostgreSQLβ”‚ β”‚ Redis β”‚ β”‚ :5432 β”‚ β”‚ :6379 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## πŸ“ Directory Structure ``` /opt/hosting-platform/ β”œβ”€β”€ backend/ β”‚ β”œβ”€β”€ app/ β”‚ β”‚ β”œβ”€β”€ __init__.py β”‚ β”‚ β”œβ”€β”€ main.py β”‚ β”‚ β”œβ”€β”€ config.py β”‚ β”‚ β”œβ”€β”€ models/ β”‚ β”‚ β”‚ β”œβ”€β”€ __init__.py β”‚ β”‚ β”‚ └── domain.py β”‚ β”‚ β”œβ”€β”€ services/ β”‚ β”‚ β”‚ β”œβ”€β”€ __init__.py β”‚ β”‚ β”‚ └── cloudflare_service.py β”‚ β”‚ └── api/ β”‚ β”œβ”€β”€ venv/ β”‚ └── requirements.txt β”œβ”€β”€ frontend/ β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ App.jsx β”‚ β”‚ β”œβ”€β”€ main.jsx β”‚ β”‚ β”œβ”€β”€ pages/ β”‚ β”‚ β”‚ β”œβ”€β”€ DomainSetup.jsx β”‚ β”‚ β”‚ └── DomainList.jsx β”‚ β”‚ └── services/ β”‚ β”‚ └── api.js β”‚ β”œβ”€β”€ package.json β”‚ └── vite.config.js └── deploy.sh ``` --- ## πŸ”„ Auto-Deploy Workflow 1. **Developer pushes code** to `main` branch 2. **Gitea webhook** triggers β†’ `POST http://176.96.129.77:5000/webhook/deploy` 3. **Backend receives webhook** β†’ Executes `/opt/hosting-platform/deploy.sh` 4. **Deploy script**: - Pulls latest code from Git - Installs dependencies - Restarts services via Supervisor --- ## πŸ› οΈ Management Commands ### Supervisor (Process Management) ```bash # Check status supervisorctl status # Restart services supervisorctl restart hosting-backend supervisorctl restart hosting-frontend # View logs tail -f /var/log/hosting-backend.log tail -f /var/log/hosting-frontend.log # Stop/Start supervisorctl stop hosting-backend supervisorctl start hosting-backend ``` ### Nginx ```bash # Test configuration nginx -t # Reload systemctl reload nginx # Restart systemctl restart nginx # View logs tail -f /var/log/nginx/access.log tail -f /var/log/nginx/error.log ``` ### Database ```bash # Connect to PostgreSQL psql -U hosting_user -d hosting_db # Connect to Redis redis-cli ``` --- ## πŸ§ͺ Testing ### Health Check ```bash curl https://api.argeict.net/health ``` ### API Test ```bash curl https://api.argeict.net/api/domains ``` ### Frontend Open browser: https://argeict.net ### Gitea Open browser: https://gitea.argeict.net ### SSL Certificate Check ```bash openssl s_client -connect argeict.net:443 -servername argeict.net < /dev/null 2>/dev/null | openssl x509 -noout -dates ``` --- ## πŸ“ Next Steps 1. βœ… **Add SSL Certificate** (Let's Encrypt) 2. βœ… **Configure Domain Name** 3. βœ… **Set up Monitoring** (Prometheus/Grafana) 4. βœ… **Add Backup System** 5. βœ… **Implement Authentication** --- ## πŸ†˜ Troubleshooting ### Backend not starting ```bash # Check logs tail -f /var/log/hosting-backend.log # Check if port is in use lsof -i :5000 # Restart supervisorctl restart hosting-backend ``` ### Frontend not loading ```bash # Check logs tail -f /var/log/hosting-frontend.log # Restart supervisorctl restart hosting-frontend ``` ### Database connection issues ```bash # Check PostgreSQL status systemctl status postgresql # Check connections psql -U hosting_user -d hosting_db -c "SELECT * FROM pg_stat_activity;" ``` --- **Deployment Date**: 2026-01-10 **Version**: 1.0.0 **Deployed By**: Hosting Platform Team