Deployment Overview of DeepSeek-R1:70B on Server¶
Prerequisites and Basic Requirements¶
The deployment requires a Linux server running Ubuntu with root privileges. The following system components must be present:
-
Operating System: Ubuntu (version compatible with
aptpackage manager) -
Privileges: Root access (
sudoor direct root shell) -
Required Packages:
curl,ca-certificates -
Network: Access to the internet for downloading images and models
-
Hardware: GPU support is required for the
open-webuicontainer to utilize CUDA capabilities
FQDN of the Final Panel¶
The application is accessible via the following Fully Qualified Domain Name (FQDN) format:
deepseek<Server ID>.hostkey.in:443
Replace <Server ID> with the specific identifier assigned to the server instance. The service listens on port 443 for HTTPS traffic.
File and Directory Structure¶
The deployment utilizes the following directory structure for configuration, data, and certificates:
-
/root/nginx/: Contains the Docker Compose configuration for the proxy and Certbot. -
/root/nginx/compose.yml: The Docker Compose file defining the Nginx and Certbot services. -
/data/nginx/user_conf.d/: Directory containing custom Nginx virtual host configurations. -
deepseek<Server ID>.hostkey.in.conf: HTTPS virtual host configuration. -
deepseek<Server ID>.hostkey.in.http.conf: HTTP virtual host configuration for ACME challenges. -
/data/nginx/nginx-certbot.env: Environment file for the Nginx-Certbot container. -
/var/www/certbot/: Webroot directory inside the Nginx container for Let's Encrypt ACME challenges. -
/etc/systemd/system/ollama.service: Systemd service file for Ollama. -
/etc/systemd/system/ollama.service.d/override.conf: Systemd drop-in configuration for Ollama environment variables.
Application Installation Process¶
The application stack consists of Ollama for model inference and Open WebUI for the user interface.
-
Ollama Installation:
-
The Ollama service is installed via the official installation script.
-
The
deepseek-r1:70bmodel is pulled and stored locally. -
The service is configured to listen on
0.0.0.0and allow all origins. -
Open WebUI Deployment:
-
The
open-webuicontainer is deployed using theghcr.io/open-webui/open-webui:cudaimage. -
The container runs in host network mode.
-
It is configured to connect to the local Ollama instance at
http://127.0.0.1:11434. -
GPU resources are requested via device capabilities.
Access Rights and Security¶
-
User Accounts: A system user named
ollamais created to manage the Ollama service. -
Firewall: The Nginx proxy handles external traffic on port
443(HTTPS) and port80(HTTP for redirection). -
Internal Communication:
-
Open WebUI communicates with Ollama via
127.0.0.1:11434. -
Nginx proxies traffic to Open WebUI via
127.0.0.1:8080. -
SSL/TLS: SSL certificates are managed automatically by Certbot within the Nginx container.
Databases¶
-
Storage: Open WebUI stores its data in a Docker volume named
open-webuimounted at/app/backend/datainside the container. -
Connection: No external database connection is configured; the application uses local storage within the container volume.
Docker Containers and Their Deployment¶
Two primary Docker components are deployed:
-
Nginx-Certbot:
-
Image:
jonasal/nginx-certbot:latest -
Network Mode:
host -
Volumes:
-
nginx_secrets(external) mounted at/etc/letsencrypt -
/data/nginx/user_conf.dmounted at/etc/nginx/user_conf.d
-
-
Environment: Configured via
/data/nginx/nginx-certbot.envand[email protected]. -
Open WebUI:
-
Image:
ghcr.io/open-webui/open-webui:cuda -
Name:
open-webui -
Network Mode:
host -
Restart Policy:
always -
Volumes:
open-webuimounted at/app/backend/data -
Environment Variables:
-
ENV:dev -
OLLAMA_BASE_URLS:http://127.0.0.1:11434
-
-
Device Requests: GPU capabilities enabled.
Proxy Servers¶
Nginx acts as the reverse proxy and SSL terminator for the application.
-
Configuration Location:
/data/nginx/user_conf.d/deepseek<Server ID>.hostkey.in.conf -
HTTPS Configuration:
-
Listens on port
443. -
Proxies requests to
http://127.0.0.1:8080. -
Sets the
Hostheader to$host. -
HTTP Configuration:
-
Listens on port
80. -
Handles ACME challenges at
/.well-known/acme-challenge/. -
Redirects all other traffic to HTTPS (
301redirect). -
Certificate Management: Certbot runs within the Nginx container to issue and renew certificates automatically.
Permission Settings¶
-
Nginx Directory:
/root/nginxis owned byroot:rootwith mode0755. -
Compose File:
/root/nginx/compose.ymlis owned byroot:rootwith mode0644. -
Nginx Config Files: Files in
/data/nginx/user_conf.d/are owned byroot:rootwith mode0644. -
Systemd Override:
/etc/systemd/system/ollama.service.d/override.confis owned byroot:root.
Location of Configuration Files and Data¶
| Component | Configuration File | Data Location |
|---|---|---|
| Nginx Proxy | /root/nginx/compose.yml | /data/nginx/user_conf.d/ |
| SSL Certificates | N/A (Managed by Certbot) | /etc/letsencrypt (via volume) |
| Ollama Service | /etc/systemd/system/ollama.service.d/override.conf | Local Ollama library (default path) |
| Open WebUI | N/A (Environment variables in Docker) | Docker volume open-webui |
Available Ports for Connection¶
-
Port 80: HTTP (Redirects to HTTPS, handles ACME challenges).
-
Port 443: HTTPS (Main entry point for the application).
-
Port 11434: Ollama API (Internal only, bound to
127.0.0.1). -
Port 8080: Open WebUI (Internal only, bound to
127.0.0.1).
Starting, Stopping, and Updating¶
-
Ollama Service:
-
Start:
systemctl start ollama -
Stop:
systemctl stop ollama -
Restart:
systemctl restart ollama -
Reload Daemon:
systemctl daemon-reload(required after modifying systemd overrides) -
Nginx-Certbot Container:
-
Start/Restart:
docker compose up -d(executed from/root/nginx) -
Reload Nginx:
docker exec nginx-nginx-1 nginx -s reload -
Test Configuration:
docker exec nginx-nginx-1 nginx -t -
Open WebUI Container:
-
Start/Restart:
docker restart open-webui -
Stop:
docker stop open-webui -
Update Image:
docker pull ghcr.io/open-webui/open-webui:cudafollowed bydocker restart open-webui