# ๐Ÿ“ฆ Installation Guide > How to install and run ITG Media App on your own server. --- ## ๐Ÿ“‹ Prerequisites | Tool | Version | Purpose | |------|---------|----------| | **Python** | 3.11+ | Django backend | | **Node.js** | 20+ | Next.js frontend | | **PostgreSQL** | 14+ | Primary database | | **Redis** | 7+ | WebSocket channels, caching, session store | | **Docker Compose** | 2.x+ | LiveKit + optional full-stack dev | | **Nginx** | 1.24+ | Reverse proxy, SSL termination (production) | | **Certbot** | Latest | Let's Encrypt SSL certificates (production) | > โš ๏ธ **Platform Support:** ITG Media App has been tested on **Linux servers** (Ubuntu 22.04/24.04 LTS). It has **not been tested on Windows Server**. If you're running Windows, we recommend using WSL2 or a Linux VM. Docker-based deployment should work on any platform, but production hosting is validated only on Linux. --- ## ๐Ÿณ Option A: Docker Dev Stack (Easiest โ€” Try It Locally) Everything runs in containers โ€” Postgres, Redis, Django, Next.js, Nginx: ```bash # Clone the repository git clone https://github.com/docisit/itg-media-engine.git cd itg-media-engine # Start the development stack docker compose -f docker-compose.dev.yml up --build ``` Once the containers are up, open **[http://localhost:3000](http://localhost:3000)**. > โš ๏ธ **LiveKit is NOT included** in the dev stack. For WebRTC features (guest video/audio), you'll need to set up LiveKit separately โ€” see the [LiveKit Setup](livekit) page. ### Docker Dev Stack โ€” What Runs | Container | Service | Port | |-----------|---------|------| | `mediasite-nginx` | Nginx reverse proxy | 80, 443 | | `mediasite-nextjs` | Next.js frontend | 3000 | | `mediasite-django` | Django REST API | 8000 | | `mediasite-daphne` | Daphne WebSocket server | 8001 | | `mediasite-postgres` | PostgreSQL database | 5432 | | `mediasite-redis` | Redis cache & channels | 6379 | --- ## ๐Ÿ–ฅ๏ธ Option B: Manual Setup (PM2 / Bare Metal โ€” Production) For production deployments on a Linux VPS or dedicated server. ### 1. Clone & Setup Backend ```bash git clone https://github.com/docisit/itg-media-engine.git cd itg-media-engine # Create Python virtual environment python3 -m venv .venv source .venv/bin/activate # Install Python dependencies pip install -r requirements.txt # Copy and edit environment config cp .env.example .env # โš ๏ธ EDIT .env with your settings before proceeding! ``` ### 2. Configure Environment See the **[Configuration](configuration)** page for a full walkthrough of every environment variable. At minimum, set: ```ini # .env โ€” Minimum Required Settings SECRET_KEY= DEBUG=False ALLOWED_HOSTS=yourdomain.com,localhost,127.0.0.1 DATABASE_URL=postgres://youruser:yourpassword@localhost:5432/media_db REDIS_URL=redis://127.0.0.1:6379/0 LIVEKIT_API_KEY= LIVEKIT_API_SECRET= LIVEKIT_URL=wss://livekit.yourdomain.com FRONTEND_URL=https://yourdomain.com ``` ### 3. Database Setup ```bash # Create PostgreSQL database and user sudo -u postgres psql -c "CREATE DATABASE media_db;" sudo -u postgres psql -c "CREATE USER media_user WITH PASSWORD 'your-password';" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE media_db TO media_user;" # Run migrations python manage.py migrate # Create superuser (admin account) python manage.py createsuperuser # Collect static files python manage.py collectstatic --noinput ``` ### 4. Redis Setup ```bash # Install Redis (Ubuntu/Debian) sudo apt install redis-server -y # Secure Redis โ€” bind to localhost only sudo sed -i 's/^bind 127.0.0.1 ::1/bind 127.0.0.1/' /etc/redis/redis.conf # Start and enable Redis sudo systemctl enable redis-server sudo systemctl start redis-server # Verify Redis is running redis-cli ping # Expected output: PONG ``` ### 5. Frontend Setup ```bash cd frontend # Install Node.js dependencies npm install # Build for production npm run build ``` ### 6. LiveKit Setup WebRTC guest video/audio requires LiveKit. See the **[LiveKit Setup](livekit)** page for detailed instructions. ```bash # Quick self-hosted LiveKit with Docker cd /opt/livekit docker compose up -d ``` ### 7. Start Services with PM2 Create an `ecosystem.config.js` file in the project root: ```javascript module.exports = { apps: [ { name: 'mediasite-django', script: '.venv/bin/gunicorn', args: 'backend.wsgi:application --bind 127.0.0.1:8000 --workers 4 --timeout 120', cwd: '/home/deploy/itg-media-engine', }, { name: 'mediasite-daphne', script: '.venv/bin/daphne', args: '-b 127.0.0.1 -p 8001 backend.asgi:application', cwd: '/home/deploy/itg-media-engine', }, { name: 'mediasite-nextjs', script: 'node_modules/.bin/next', args: 'start -p 3000', cwd: '/home/deploy/itg-media-engine/frontend', }, ], }; ``` ```bash # Install PM2 globally npm install -g pm2 # Start all services pm2 start ecosystem.config.js # Save PM2 process list (auto-restart on reboot) pm2 save # Enable PM2 startup script pm2 startup # Follow the printed instructions to complete PM2 startup setup # Verify all processes are running pm2 list ``` --- ## ๐Ÿงช Verifying Your Installation Once everything is running, verify each component: ```bash # Django API health check curl -s http://localhost:8000/api/health/ | jq . # Frontend is accessible curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 # Expected: 200 # Redis connection redis-cli ping # Expected: PONG # PostgreSQL connection PGPASSWORD=your-password psql -h localhost -U media_user -d media_db -c "SELECT 1;" # Expected: 1 # LiveKit health check curl -s https://livekit.yourdomain.com/ | jq . ``` --- ## โญ๏ธ Next Steps 1. **[Configuration](configuration)** โ€” Set up all environment variables correctly 2. **[LiveKit Setup](livekit)** โ€” Get WebRTC working for guest video/audio 3. **[Deployment](deployment)** โ€” Set up Nginx, SSL, and go live at your domain --- ## โ“ Need Help? Check the **[Troubleshooting & FAQ](troubleshooting)** page for common issues, or [open an issue on GitHub](https://github.com/docisit/itg-media-engine/issues). --- *โ† Back to [Wiki Home](home)*