- Direct Build: Build the Docker image directly on the droplet (simpler, no registry needed)
- Container Registry: Build locally and push to DigitalOcean’s Container Registry (more scalable)
Prerequisites
Before you begin, ensure you have:- A DigitalOcean account
- A Helix project ready to deploy
- Docker installed locally
Method 1: Direct Build
This method builds the Docker image directly on your droplet, eliminating the need for a container registry.Step 1: Install and Configure doctl
First, create a DigitalOcean API token:- Go to the Applications & API page in the DigitalOcean control panel
- Click “Generate New Token”
- Give it a name and ensure it has both read and write access
- Save the token string immediately - it’s only displayed once
doctl auth init, paste your API token.
Step 2: Create SSH Key
Generate an SSH key pair for secure access to your droplet:Step 3: Create Block Storage Volume
Create a persistent volume for your database data. This ensures data persists even if you recreate the droplet:nyc3, sfo3, ams3, etc.
Step 4: Create Droplet
Create a droplet with Docker pre-installed:Step 5: Attach Volume to Droplet
Attach the block storage volume to your droplet:/mnt/helix-prod-data.
Step 6: Copy Helix Build to Droplet
Build your Helix project and copy it to the droplet:Step 7: Build Docker Image on Droplet
Build the Docker image directly on the droplet:Step 8: Deploy Container
Run your Helix container with persistent storage:-d: Run in detached mode (background)--name helix: Name the container for easy reference--restart unless-stopped: Automatically restart on system reboot-p 6969:6969: Expose port 6969 (HelixDB default)-v /mnt/helix-prod-data:/data: Mount persistent volume-e HELIX_PORT=6969: Set the port Helix listens on-e HELIX_DATA_DIR=/data: Tell Helix where to store data
Step 9: Configure Firewall
Create a firewall to secure your droplet:- Inbound: SSH (port 22) and Helix (port 6969) from anywhere
- Outbound: All traffic (needed for updates and dependencies)
Step 10: Test Your Deployment
Verify that Helix is running correctly: This is an example of how to create a user and get a user by name, if your queries are different, you can use the same pattern.Redeployments
When you update your Helix queries or schema:Method 2: Container Registry
This method uses DigitalOcean’s Container Registry to store your Docker images, enabling easier scaling and rollbacks.Step 1-2: Prerequisites and SSH Key
Follow Steps 1-2 from Method 1 above.Step 3: Create Container Registry
Create a private container registry:Step 4-6: Volume and Droplet Setup
Follow Steps 3, 4, and 5 from Method 1 to create the volume, droplet, and attach the volume.Step 7: Build and Push Docker Image
Build your image locally and push to the registry:--platform linux/amd64 flag ensures compatibility with DigitalOcean’s Linux droplets.