hosting-platform/DEPLOYMENT.md

6.0 KiB

🚀 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:

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)

# 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

# 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

# Connect to PostgreSQL
psql -U hosting_user -d hosting_db

# Connect to Redis
redis-cli

🧪 Testing

Health Check

curl https://api.argeict.net/health

API Test

curl https://api.argeict.net/api/domains

Frontend

Open browser: https://argeict.net

Gitea

Open browser: https://gitea.argeict.net

SSL Certificate Check

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

# 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

# Check logs
tail -f /var/log/hosting-frontend.log

# Restart
supervisorctl restart hosting-frontend

Database connection issues

# 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