Skip to main content

Deploy iCommerce on GCP

Run StateSet iCommerce 24/7 for approximately $5-12/month on Google Cloud Platform. This guide walks you through deploying a persistent iCommerce Gateway on a GCP Compute Engine VM using Docker, with durable state, baked-in binaries, and safe restart behavior.

Goal

Deploy a production-ready StateSet iCommerce Gateway on GCP Compute Engine with:
  • Persistent configuration and workspace data
  • Docker-based isolated runtime
  • SSH tunnel access for secure administration
  • Automatic restart on failure
Pricing varies by machine type and region. Start with the smallest VM that fits your workload and scale up if you encounter out-of-memory errors.

What you’ll build

1

Create GCP infrastructure

Set up a GCP project, enable billing, and create a Compute Engine VM.
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:
  • GCP account (free tier eligible for e2-micro)
  • gcloud CLI installed, or access to the Cloud Console
  • 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

Quick path (experienced operators)

If you’re familiar with GCP and Docker, follow this condensed workflow:
  1. Create GCP project and enable Compute Engine API
  2. Create Compute Engine VM (e2-small, Debian 12, 20GB)
  3. SSH into the VM
  4. Install Docker
  5. Clone the StateSet iCommerce repository
  6. Create persistent host directories
  7. Configure .env and docker-compose.yml
  8. Bake required binaries, build, and launch

1) Install gcloud CLI


2) Create a GCP project

Enable billing at console.cloud.google.com/billing (required for Compute Engine).Enable the Compute Engine API:

3) Create the VM

Machine type comparison


4) SSH into the VM

SSH key propagation can take 1-2 minutes after VM creation. If the connection is refused, wait and retry.

5) Install Docker

Run the following commands on the VM:
Log out and back in for the group change to take effect:
SSH back in:
Verify the installation:

6) Clone the repository


7) Create persistent host directories

Docker containers are ephemeral. All long-lived state must live on the host to survive restarts and rebuilds.

8) 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.

9) 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.

10) 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


11) Build and launch

Verify binaries are installed:
Expected output:

12) Verify the Gateway

Success output:

13) Access from your local machine

Create an SSH tunnel to forward the Gateway port:
Open in your browser:
Enter your gateway token to authenticate.

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 VM:

Troubleshooting

SSH connection refused

SSH key propagation can take 1-2 minutes after VM creation. Wait and retry.

OS Login issues

Check your OS Login profile:
Ensure your account has the required IAM permissions (Compute OS Login or Compute OS Admin Login).

Out of memory (OOM)

If using e2-micro and hitting OOM, upgrade to e2-small or e2-medium:

Container fails to start

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

Service accounts (security best practice)

For personal use, your default user account works fine. For automation or CI/CD pipelines, create a dedicated service account with minimal permissions: Create a service account:
Grant Compute Instance Admin role:
Avoid using the Owner role for automation. Use the principle of least privilege. See GCP IAM roles documentation for details.

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.