Deployment Overview of DeepSeek-R1:14B on Server¶
Prerequisites and Basic Requirements¶
To ensure the successful deployment of the application, the following requirements must be met:
-
Operating System: Ubuntu (recommended).
-
Privileges: Root or sudo access is required for package installation and service management.
-
Hardware Acceleration: NVIDIA GPU support is required for CUDA-enabled container execution.
-
Ports:
-
80/tcp: For HTTP traffic and ACME challenges (SSL). -
443/tcp: For secure HTTPS traffic. -
11434/tcp: Internal Ollama service communication. -
8080/tcp: Local upstream connection for Open WebUI.
FQDN of the final panel on the hostkey.in domain¶
The application is accessible via a specific subdomain template:
| Parameter | Value |
|---|---|
| Prefix | deepseek |
| Domain | hostkey.in |
| Full template | deepseek{Server_ID}.hostkey.in |
Application installation process¶
The installation follows a multi-stage process involving system package management, model preparation, and container orchestration:
-
System Dependencies: The system is updated to include essential utilities such as
curlandca-certificates. -
Ollama Installation:
-
The official Ollama installation script is executed via
curl. -
A dedicated
ollamasystem user is created. -
Systemd service overrides are configured to allow remote access (
OLLAMA_HOST=0.0.0.0) and enable Flash Attention (LLAMA_FLASH_ATTENTION=1). -
Model Download: The
deepseek-r1:14bmodel is pulled directly into the Ollama local storage. -
Container Deployment: The Open WebUI interface is deployed as a Docker container using the CUDA-optimized image.
Access Rights and Security¶
-
Firewall/Network: The application utilizes
network_mode: hostfor the primary web interface to facilitate direct communication with local services. -
SSL/TLS: SSL certificates are managed via Certbot within an Nginx environment, ensuring all external traffic is encrypted over port 443.
-
Service Isolation: A systemd override is applied to Ollama to manage its execution environment and security parameters.
Databases¶
The application uses a Docker volume for persistent data storage:
-
Volume Name:
open-webui -
Mount Path:
/app/backend/datainside the container.
Docker Containers and Their Deployment¶
The deployment consists of two primary containerized components:
Open WebUI¶
-
Image:
ghcr.io/open-webui/open-webui:cuda -
Ports: Uses host network mode (access via standard web ports).
-
Environment Variables:
-
ENV:dev -
OLLAMA_BASE_URLS:http://127.0.0.1:11434 -
Volumes:
open-webui:/app/backend/data -
Restart Policy:
always -
Hardware Access: GPU capabilities are enabled for hardware acceleration.
Nginx Proxy (Certbot)¶
-
Image:
jonasal/nginx-certbot:latest -
Ports: Uses host network mode.
-
Environment Variables:
-
CERTBOT_EMAIL:[email protected] -
Volumes:
-
nginx_secrets:/etc/letsencrypt -
/data/nginx/user_conf.d:/etc/nginx/user_conf.d -
Restart Policy:
unless-stopped
Custom Scripts and Additional Setup¶
The following configuration steps are performed during the setup:
-
Nginx Configuration Generation: A custom Nginx configuration is generated to proxy HTTPS traffic from port 443 to the local Open WebUI service running on port 8080.
-
ACME Challenge Setup: An HTTP server block is configured on port 80 specifically to handle
.well-known/acme-challengerequests for automated SSL certificate renewal. -
Systemd Configuration: Custom override files are placed in
/etc/systemd/system/ollama.service.d/override.confto configure environment variables for the Ollama service.
Application Update Instructions¶
To update the main application interface, execute the following commands:
Note: To update the underlying AI model, use the Ollama CLI:
Location of configuration files and data¶
| Component | Path |
|---|---|
| Nginx Compose File | /root/nginx/compose.yml |
| Nginx User Configs | /data/nginx/user_conf.d/ |
| Ollama Service Overrides | /etc/systemd/system/ollama.service.d/override.conf |
| Open WebUI Data | Docker volume open-webui |
Available ports for connection¶
-
HTTPS:
443(via Nginx proxy) -
HTTP:
80(for SSL redirection and ACME)
Starting and Stopping the application¶
Open WebUI¶
The container is configured to restart automatically. To manage it manually:
Nginx Proxy¶
To reload the proxy configuration after changes: