Skip to main content

Deploy iCommerce on Hetzner

Run StateSet iCommerce 24/7 for approximately $5/month on Hetzner. This guide walks you through deploying a persistent iCommerce Gateway on a Hetzner VPS using Docker, with durable state, baked-in binaries, and safe restart behavior.

Goal

Deploy a production-ready StateSet iCommerce Gateway on Hetzner with:
  • Persistent configuration and workspace data
  • Docker-based isolated runtime
  • SSH tunnel access for secure administration
  • Automatic restart on failure
Hetzner offers some of the most cost-effective VPS options available. Pick the smallest Debian/Ubuntu VPS that fits your workload and scale up if you encounter out-of-memory errors.

What you’ll build

1

Provision Hetzner VPS

Create a small Linux server with root access.
2

Install Docker runtime

Install Docker for isolated, reproducible application runtime.
3

Configure persistent storage

Mount host directories for configuration and workspace data that survives restarts.
4

Deploy the Gateway

Build and launch the iCommerce Gateway with Docker Compose.
5

Access securely

Connect via SSH tunnel from your local machine.

Prerequisites

Before you begin, ensure you have:
  • Hetzner VPS with root access
  • SSH access from your local machine
  • Basic familiarity with terminal commands
  • StateSet API credentials
  • Model provider credentials (OpenAI, Anthropic, etc.)
Optional integrations:
  • WhatsApp Business API credentials
  • Telegram bot token
  • Gmail OAuth credentials
This guide assumes Ubuntu or Debian on Hetzner. If you’re on another Linux VPS provider, map packages accordingly.

Quick path (experienced operators)

If you’re familiar with Hetzner and Docker, follow this condensed workflow:
  1. Provision Hetzner VPS (Ubuntu/Debian)
  2. Install Docker
  3. Clone the StateSet iCommerce repository
  4. Create persistent host directories
  5. Configure .env and docker-compose.yml
  6. Bake required binaries into the image
  7. docker compose up -d
  8. Verify persistence and Gateway access

1) Provision the VPS

Create an Ubuntu or Debian VPS in the Hetzner Cloud Console. Connect as root:
This guide assumes the VPS is stateful. Do not treat it as disposable infrastructure.

2) Install Docker

Run the following commands on the VPS:
Verify the installation:

3) Clone the repository


4) Create persistent host directories

Docker containers are ephemeral. All long-lived state must live on the host to survive restarts and rebuilds.
Setting the correct ownership is critical. The container runs as uid 1000 (node user), so the host directories must be writable by that user.

5) Configure environment variables

Create a .env file in the repository root:
Generate strong secrets:
Do not commit the .env file to version control. It contains sensitive credentials.

6) Docker Compose configuration

Create or update docker-compose.yml:
To expose the Gateway publicly, remove the 127.0.0.1: prefix from the port mapping and configure firewall rules accordingly. See the security documentation for guidance.

7) Bake required binaries into the image

Installing binaries inside a running container is a common mistake. Anything installed at runtime will be lost on restart. All external binaries required by skills must be installed at image build time.
If you add new skills later that depend on additional binaries, you must:
  1. Update the Dockerfile
  2. Rebuild the image
  3. Restart the containers

Example Dockerfile


8) Build and launch

Verify binaries are installed:
Expected output:

9) Verify the Gateway

Check the logs:
Success output:

10) Access from your local machine

Create an SSH tunnel to forward the Gateway port:
Open in your browser:
Enter your gateway token to authenticate.
The -N flag tells SSH not to execute a remote command, making it ideal for port forwarding only.

Persistence reference

All long-lived state must survive restarts, rebuilds, and reboots. Docker is not the source of truth.

Updates

To update StateSet iCommerce on the VPS:

Troubleshooting

SSH connection refused

Verify the VPS is running and your IP is not blocked by any firewall rules.

Out of memory (OOM)

If hitting OOM on a smaller VPS, upgrade to a larger instance:
  1. Create a snapshot of your VPS in Hetzner Cloud Console
  2. Resize or create a new VPS with more resources
  3. Restore from snapshot if needed

Container fails to start

Check logs for errors:
Verify environment variables are set correctly:

Permission denied on mounted volumes

Ensure the host directories have the correct ownership:

Firewall blocking connections

If using Hetzner’s firewall, ensure the required ports are open:

Hetzner-specific tips

Enable automatic backups

Enable automatic backups in the Hetzner Cloud Console for disaster recovery. Cost is approximately 20% of VPS price.

Use a floating IP

For production deployments, assign a floating IP to your VPS. This allows you to migrate to a new server without changing your IP address.

Set up monitoring

Hetzner provides basic monitoring in the Cloud Console. For more detailed metrics, consider installing a monitoring agent:

Next steps

Messaging Channels

Set up WhatsApp, Telegram, and other messaging integrations.

Skills

Configure and extend agent capabilities with custom skills.

CLI Reference

Learn the full CLI command set for managing your iCommerce instance.

Security

Review security best practices for production deployments.