Skip to content

Deployment Overview of CogVideoX-5b on Server

Prerequisites and Basic Requirements

To ensure the successful deployment and operation of the application, the following system requirements must be met:

  • Operating System: Ubuntu 22.04 (recommended for HWE kernel support).

  • Privileges: Root or sudo access is required for all installation steps.

  • Hardware Requirement: An NVIDIA GPU is mandatory for CUDA acceleration.

  • Network Ports:

  • 443 (HTTPS) - External access via Nginx proxy.

  • 7860 - Internal application port.

FQDN of the final panel on the hostkey.in domain

The application is accessible through a specific subdomain template based on the server ID.

Parameter Value
Prefix cogvideo
Domain hostkey.in
Full template cogvideo{Server_ID_from_Invapi}.hostkey.in

File and Directory Structure

The following directories are used for application data, configurations, and system services:

  • /opt/CogVideo: Main application directory containing the source code and Python virtual environment.

  • /opt/CogVideo/env: Python virtual environment.

  • /root/nginx: Configuration directory for the Nginx proxy container.

  • /data/nginx/user_conf.d: Directory containing Nginx site configurations.

  • /data/nginx/nginx-certbot.env: Environment file for Certbot configuration.

Application installation process

The application is installed using a combination of system-level package management, manual script execution, and service configuration:

  1. System Preparation: The system is updated and upgraded via apt. The linux-generic-hwe-22.04 kernel and gcc compiler are installed to support specialized drivers.

  2. NVIDIA Driver & CUDA Setup:

  3. A CUDA keyring is added to the package manager.

  4. cuda-toolkit and nvidia-cuda-toolkit are installed.

  5. The system environment variables (PATH and LD_LIBRARY_PATH) are updated in .bashrc.

  6. NVIDIA drivers are initialized, and nvidia-docker2 is installed to enable GPU support within Docker containers.

  7. Application Source: The CogVideo repository is cloned from GitHub into /opt/CogVideo.

  8. Python Environment Setup:

  9. Python 3.10 and venv modules are installed.

  10. A virtual environment is created at /opt/CogVideo/env.

  11. Required dependencies are installed via pip, including specific versions of torch, torchvision, and torchaudio compiled for CUDA 11.8, as well as moviepy.

  12. Service Configuration: A systemd service named cogvideo.service is created to manage the application process using the Gradio composite demo script.

Access Rights and Security

  • Firewall/Access: The application is exposed via an Nginx reverse proxy on port 443.

  • User Permissions: The CogVideo service runs under the root user within its working directory /opt/CogVideo.

  • Docker Security: NVIDIA container runtime is configured to allow the application to interface with host GPU hardware securely.

Docker Containers and Their Deployment

The deployment utilizes a single Nginx container managed via Docker Compose for SSL termination and reverse proxying.

Container Name Image Ports (Host:Container) Volumes Environment Variables Restart Policy
nginx jonasal/nginx-certbot:latest host_network - nginx_secrets:/etc/letsencrypt
- /data/nginx/user_conf.d:/etc/nginx/user_conf.d
[email protected] (plus custom env file) unless-stopped

Custom Scripts and Additional Setup

The installation process includes an automated initialization script (install_script.sh) located in /tmp during the setup phase. This script performs the following critical actions:

  • Updates system repositories.

  • Installs necessary build tools (GCC).

  • Configures NVIDIA CUDA repositories and toolkits.

  • Modifies shell configuration files to set up the CUDA environment path.

  • Removes the nouveau driver to allow the NVIDIA proprietary driver to load.

Application Update Instructions

To update the main application, follow these steps:

  1. Update Source Code: Navigate to /opt/CogVideo and pull the latest changes from the repository.

  2. Update Dependencies: Activate the virtual environment and upgrade packages:

    source /opt/CogVideo/env/bin/activate
    pip install -r requirements.txt
    

  3. Restart Service: Apply changes by restarting the systemd service:

    systemctl restart cogvideo
    

Location of configuration files and data

  • Nginx Configuration: /data/nginx/user_conf.d/{prefix}{server_id}.hostkey.in.conf

  • Docker Compose File: /root/nginx/compose.yml

  • Application Source: /opt/CogVideo

Available ports for connection

  • HTTPS (External): 443

  • Internal Application Port: 7860

Starting and Stopping the application

The application is managed as a systemd service:

  • Start the application: systemctl start cogvideo

  • Stop the application: systemctl stop cogvideo

  • Check status: systemctl status cogvideo

  • Enable on boot: systemctl enable cogvideo

Proxy Servers

The system uses an Nginx container (jonasal/nginx-certbot) acting as a reverse proxy. It handles SSL certificates via Certbot and routes incoming traffic from port 443 to the internal application running on http://127.0.0.1:7860.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×