Deployment Overview of OpenClaw on Server¶
Prerequisites and Basic Requirements¶
To ensure a successful deployment, the following system requirements must be met:
-
Operating System: Debian 11+ or Ubuntu 20.04+.
-
Privileges: Root or sudo access is required for package installation and service management.
-
Network Ports:
-
80/tcp(HTTP) for Let's Encrypt validation and redirection. -
443/tcp(HTTPS) for secure web panel access. -
18789/tcp(Gateway Port) for internal application communication.
FQDN of the final panel on the hostkey.in domain¶
The application is accessible via a specific subdomain generated based on the server ID.
| Parameter | Value |
|---|---|
| Prefix | openclaw |
| Domain | hostkey.in |
| Full template | openclaw{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
The following directories are used for configuration, application data, and SSL certificates:
-
/home/openclaw: Home directory for theopenclawuser. -
/home/openclaw/.openclaw: Application configuration directory. -
/data/nginx: Nginx configuration and certificate management files. -
/data/nginx/user_conf.d: Custom Nginx reverse proxy configurations. -
/root/nginx: Docker Compose deployment files for the proxy.
Application installation process¶
The installation of OpenClaw involves several stages to set up the runtime environment, the application itself, and the secure web proxy:
-
System Preparation: The system is updated, and base packages (
ca-certificates,curl,gnupg,sudo,dbus-user-session) are installed. -
Runtime Environment Setup:
-
A dedicated user named
openclawis created with a home directory. -
NodeSource repositories are added to provide the required Node.js runtime (version 24 or higher).
-
pnpmis installed globally vianpm. -
Application Installation: The OpenClaw application is installed globally for the
openclawuser usingpnpm install -g openclaw@latest. -
Onboarding and Configuration:
-
An automated onboarding process is executed to initialize the local gateway.
-
A configuration patch is applied to the OpenClaw gateway to enable HTTPS reverse proxy support, allowing it to trust the Nginx proxy located on
127.0.0.1. -
Proxy Setup: Docker and Certbot are configured to manage SSL certificates via Let's Encrypt, providing a secure entry point for the web panel.
Access Rights and Security¶
-
User Isolation: The application runs under a dedicated
openclawuser with restricted permissions. -
Firewall Configuration: If
ufwis present on the system, rules are automatically added to allow incoming traffic on ports80and443. -
Service Hardening: The OpenClaw gateway is managed as a systemd service with specific environment variables and restricted paths.
Databases¶
The application uses an internal data management approach; no external database connection parameters are required for the standard installation.
Docker Containers and Their Deployment¶
The deployment utilizes one primary container to handle SSL termination and reverse proxying:
Nginx-Certbot Container
-
Image:
jonasal/nginx-certbot:6.2.0-nginx1.31.0 -
Ports: Listens on host ports
80and443. -
Volumes:
-
nginx_secrets:/etc/letsencrypt(Certificates) -
/data/nginx/user_conf.d:/etc/nginx/user_conf.d(Proxy configurations) -
Environment Variables:
CERTBOT_EMAILis used for Let's Encrypt notifications. -
Restart Policy:
unless-stopped
Custom Scripts and Additional Setup¶
The installation performs several non-standard configuration steps to ensure seamless HTTPS operation:
-
Gateway Token Management: A unique gateway token is generated and stored in
/root/openclaw-gateway-token.txt. This token is used for secure communication between the proxy and the application. -
Systemd Integration: A custom systemd unit file (
openclaw-gateway.service) is created to manage the OpenClaw gateway as a background service. -
Configuration Patching: The application's internal configuration is modified via
openclaw config patchto allow it to operate behind an HTTPS reverse proxy, specifically setting thepublicOriginandtrustedProxies.
Application Update Instructions¶
To update the main OpenClaw application:
-
The installation script/process should be re-run to pull the latest version via
pnpm. -
Alternatively, if manual updates are performed, ensure the
openclawuser is used and the gateway service is restarted after the update.
Location of configuration files and data¶
-
Application Config:
/home/openclaw/.openclaw -
Nginx Proxy Configs:
/data/nginx/user_conf.d/ -
SSL Certificates: Managed within the
nginx_secretsDocker volume.
Available ports for connection¶
-
Web Panel (HTTPS):
443via the configured FQDN. -
Internal Gateway:
18789(accessible locally).
Starting and Stopping the application¶
The OpenClaw gateway is managed as a systemd service:
-
Start/Restart the gateway:
-
Stop the gateway:
-
Check status:
Proxy Servers¶
The application uses an Nginx container managed by Docker to act as a reverse proxy. This setup handles:
-
SSL/TLS termination via Let's Encrypt.
-
Automatic HTTP to HTTPS redirection.
-
WebSocket support (via
UpgradeandConnectionheaders) for real-time communication. -
Proxying requests from the public domain to the local OpenClaw gateway on port
18789.