Deployment Overview of HunyuanVideo on Server¶
Prerequisites and Basic Requirements¶
The deployment of HunyuanVideo requires a Linux-based environment with specific hardware and software configurations to support GPU-accelerated video generation.
-
Operating System: Ubuntu 22.04 LTS (or compatible version with HWE kernel).
-
Privileges: Root access or
sudoprivileges are required for system-wide package installation and Docker configuration. -
Hardware: NVIDIA GPU with compatible drivers and CUDA support.
-
Network: Access to the internet for downloading repositories, models, and certificates.
-
Ports: Port 443 is required for external HTTPS access.
FQDN of the Final Panel¶
The application is accessible via the following Fully Qualified Domain Name (FQDN) format on the hostkey.in domain:
-
Domain Format:
hvideo<Server ID>.hostkey.in -
Port: 443 (HTTPS)
-
Path:
/
File and Directory Structure¶
The application and its supporting components are organized in the following directory structure:
-
Application Source:
/opt/HunyuanVideo -
Contains the cloned repository from Tencent.
-
Python Environment:
/opt/HunyuanVideo/venv -
Virtual environment for Python dependencies.
-
Models:
/opt/HunyuanVideo/models -
Storage location for downloaded HunyuanVideo checkpoints.
-
Nginx Configuration:
-
Directory:
/root/nginx -
Compose file:
/root/nginx/compose.yml -
User configuration:
/data/nginx/user_conf.d/hvideo<Server ID>.hostkey.in.conf -
Docker Secrets:
/etc/letsencrypt(mounted volume for SSL certificates).
Application Installation Process¶
The installation involves cloning the repository, setting up a Python virtual environment, installing dependencies, and downloading the necessary AI models.
-
Clone the Repository: The HunyuanVideo repository is cloned from GitHub to the
/opt/HunyuanVideodirectory. -
Create Virtual Environment: A Python 3 virtual environment is created within the application directory.
-
Install Dependencies: Python packages are installed using
pipfrom therequirements.txtfile. -
Install Hugging Face CLI: The
huggingface-hubpackage with CLI support is installed to facilitate model downloads. -
Download Models: Pre-trained checkpoints are downloaded directly to the models directory.
Access Rights and Security¶
Security is managed through system-level package installation and Docker runtime configuration.
-
System Packages: Essential tools such as
git,python3,curl, andwgetare installed viaapt. -
NVIDIA Drivers: The
nvidia-docker2package is installed to enable GPU passthrough for containers. -
Docker Runtime: The default Docker runtime is configured to use the NVIDIA container runtime.
-
Firewall: External access is restricted to port 443 for HTTPS traffic managed by the Nginx proxy.
Databases¶
The provided configuration does not include external database connections or persistent storage for relational data. The application relies on local file storage for models and generated outputs within the /opt/HunyuanVideo directory.
Docker Containers and Their Deployment¶
The deployment utilizes Docker containers for the reverse proxy and SSL management. The application itself runs in the host environment with GPU access configured via the NVIDIA runtime.
-
Nginx-Certbot Container:
-
Image:
jonasal/nginx-certbot:latest -
Restart Policy:
unless-stopped -
Network Mode:
host -
Volumes:
-
nginx_secretsmounted to/etc/letsencrypt -
/data/nginx/user_conf.dmounted to/etc/nginx/user_conf.d
-
-
Environment:
-
CERTBOT_EMAIL:[email protected] -
Configuration loaded from
/data/nginx/nginx-certbot.env
-
-
Docker Compose File: The container orchestration is defined in
/root/nginx/compose.yml. -
NVIDIA Runtime Configuration: Docker is configured to use the NVIDIA runtime by default via
/etc/docker/daemon.json:
Proxy Servers¶
Nginx acts as the reverse proxy and SSL terminator for the application.
-
Proxy Configuration:
-
The Nginx configuration file is located at
/data/nginx/user_conf.d/hvideo<Server ID>.hostkey.in.conf. -
The
proxy_passdirective forwards requests to the internal application service: -
SSL/TLS:
-
Managed automatically by the
nginx-certbotcontainer. -
Certificates are stored in the
nginx_secretsvolume. -
Custom Domain:
-
The domain
hvideo<Server ID>.hostkey.inis mapped to the internal service.
Permission Settings¶
File and directory permissions are set to ensure proper access for the root user and the Docker daemon.
-
Nginx Directory:
-
Path:
/root/nginx -
Owner:
root:root -
Mode:
0755 -
Compose File:
-
Path:
/root/nginx/compose.yml -
Owner:
root:root -
Mode:
0644 -
Application Directory:
-
Path:
/opt/HunyuanVideo -
Permissions are managed by the user executing the Python scripts (typically root or a dedicated service user).
Location of Configuration Files and Data¶
Key configuration and data files are located in the following paths:
| File/Directory | Path | Description |
|---|---|---|
| Application Source | /opt/HunyuanVideo | Main repository code |
| Python Virtual Env | /opt/HunyuanVideo/venv | Isolated Python environment |
| AI Models | /opt/HunyuanVideo/models | Downloaded model checkpoints |
| Docker Compose | /root/nginx/compose.yml | Nginx container definition |
| Nginx Config | /data/nginx/user_conf.d/hvideo<Server ID>.hostkey.in.conf | Reverse proxy rules |
| Docker Daemon Config | /etc/docker/daemon.json | NVIDIA runtime settings |
Available Ports for Connection¶
The following ports are configured for external and internal communication:
-
Port 443: External HTTPS access via Nginx proxy.
-
Port 8080: Internal HTTP port used by the application, proxied by Nginx.
Starting, Stopping, and Updating¶
Service management is handled through Docker Compose for the proxy and standard Python commands for the application.
-
Start Nginx Proxy:
-
Stop Nginx Proxy:
-
Update Nginx Proxy:
-
Run Application Test: To verify the installation, run the sample generation script:
-
Restart Docker Service: Required after modifying
/etc/docker/daemon.json: