Skip to content

installation

docisit edited this page Jul 27, 2026 · 2 revisions

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

# 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.

⚠️ 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 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

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 page for a full walkthrough of every environment variable.

At minimum, set:

# .env — Minimum Required Settings
SECRET_KEY=<generate-a-random-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=<your-livekit-api-key>
LIVEKIT_API_SECRET=<your-livekit-api-secret>
LIVEKIT_URL=wss://livekit.yourdomain.com
FRONTEND_URL=https://yourdomain.com

3. Database Setup

# 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

# 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

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 page for detailed instructions.

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

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',
    },
  ],
};
# 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:

# 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 — Set up all environment variables correctly
  2. LiveKit Setup — Get WebRTC working for guest video/audio
  3. Deployment — Set up Nginx, SSL, and go live at your domain

❓ Need Help?

Check the Troubleshooting & FAQ page for common issues, or open an issue on GitHub.


← Back to Wiki Home

Clone this wiki locally