Skip to main content

Self-Host InsForge on Google Cloud Compute Engine

This guide will walk you through self-hosting the InsForge platform on Google Cloud Compute Engine using Docker Compose.
This deploys InsForge itself, not the app you built. If you just want to take your app live, use Sites instead. This guide is for running the InsForge backend on your own infrastructure.
This cloud walkthrough is community-maintained and can lag the latest InsForge release. The canonical, always-current setup is the deploy/docker-compose/ directory in the InsForge repo.

πŸ“‹ Prerequisites

  • Google Cloud Account with billing enabled
  • Basic knowledge of SSH and command-line operations
  • Domain name (optional, for custom domain setup)

πŸš€ Deployment Steps

1. Create and Configure Compute Engine Instance

1.1 Create Google Cloud Project

  1. Log into Google Cloud Console at console.cloud.google.com
  2. Click β€œSelect a project” in the top navigation bar
  3. Click β€œNew Project”
  4. Enter project name (e.g., insforge-deployment)
  5. Click β€œCreate”
  6. Wait for project creation to complete

1.2 Enable Required APIs

  1. In your project, navigate to APIs & Services β†’ Library
  2. Search for and enable these APIs:
    • Compute Engine API
    • Cloud Storage API (if using for backups)
    • Cloud SQL Admin API (if using Cloud SQL)

1.3 Create Compute Engine Instance

  1. Navigate to Compute Engine β†’ VM instances
  2. Click β€œCreate Instance”
  3. Configure your instance:
    • Name: insforge-server (or your preferred name)
    • Region: Choose a region close to your users
    • Zone: Select an availability zone (e.g., us-central1-a)
    • Machine configuration:
      • Series: N2 or E2
      • Machine type: e2-medium or larger (minimum 2 vCPU, 4 GB RAM)
        • For production: e2-standard-2 (2 vCPU, 8 GB RAM) recommended
        • For testing: e2-small (2 vCPU, 2 GB RAM) minimum
    • Boot disk:
      • Operating system: Ubuntu LTS (Ubuntu 22.04 LTS or newer)
      • Boot disk type: Balanced persistent disk
      • Size: 30 GB (minimum 20 GB recommended)
    • Firewall:
      • Allow HTTP traffic: Checked
      • Allow HTTPS traffic: Checked

1.4 Configure Firewall Rules

  1. Navigate to VPC network β†’ Firewall
  2. Create or modify firewall rules to allow the following ports:
⚠️ Security Note: For production, restrict PostgreSQL (5432) to specific IP addresses or remove external access entirely. Consider using a reverse proxy (nginx) and exposing only ports 80/443.

2. Connect to Your Compute Engine Instance

  1. In the Google Cloud Console, go to Compute Engine β†’ VM instances
  2. Find your instance and click the SSH button in the same row, or:

3. Install Dependencies

3.1 Update System Packages

3.2 Install Docker

3.3 Add Your User to Docker Group

After installing Docker, you need to add your user to the docker group to run Docker commands without sudo:
Verify it works:
πŸ’‘ Note: If docker ps doesn’t work immediately, log out and log back in via SSH, then try again.
⚠️ Security Note: Adding a user to the docker group grants them root-equivalent privileges on the system. This is acceptable for single-user environments like your Compute Engine instance, but be cautious on shared systems.

3.4 Install Git

4. Deploy InsForge

4.1 Get the Repository

Checks out the files the stack reads and generates JWT_SECRET, ENCRYPTION_KEY, ROOT_ADMIN_PASSWORD and POSTGRES_PASSWORD into .env. Nothing is started.

4.2 Create Environment Configuration

The secrets are already generated β€” leave them as they are. Set the URL browsers will use:
Optional, all off by default:
.env.example carries every remaining variable with its defaults.
πŸ’‘ Back up .env somewhere safe. Its secrets are what let you migrate or restore this instance.

4.3 Start InsForge Services

Press Ctrl+C to exit log view.

4.4 Verify Services

5. Access Your InsForge Instance

5.1 Test Backend API

Expected response:

5.2 Access Dashboard

Open your browser and navigate to:

6.1 Reserve a Static External IP

  1. In Google Cloud Console, go to VPC network β†’ External IP addresses
  2. Click Reserve Static Address
  3. Name: insforge-ip
  4. Type: Regional or Global (Regional for VM instances)
  5. Region: Same as your VM instance
  6. Click Reserve

6.2 Update DNS Records

Point your domain’s DNS records to the reserved static IP:

6.3 Install Nginx Reverse Proxy

Create Nginx configuration:
Add the following configuration:
Enable the configuration:
Update your .env file with HTTPS URLs:
Change:
Restart services:

πŸ”§ Management & Maintenance

View Logs

Stop Services

Restart Services

Update InsForge

Backup Database

Monitor Resources

πŸ› Troubleshooting

Services Won’t Start

Cannot Connect to Database

Port Already in Use

Out of Memory

Consider upgrading to a larger instance type:

SSL Certificate Issues

πŸ“Š Performance Optimization

For Production Workloads

  1. Upgrade Instance Type: Use e2-standard-2 or e2-standard-4
  2. Use Cloud SQL: Migrate from containerized PostgreSQL to Google Cloud SQL for better reliability
  3. Enable Cloud Monitoring: Monitor metrics and set up alerts
  4. Configure Backups: Set up automated daily backups
  5. Use Cloud Storage: Configure Google Cloud Storage for file uploads instead of local storage

Database Optimization

πŸ”’ Security Best Practices

  1. Change Default Passwords: Update admin and database passwords
  2. Enable Firewall: Use Google Cloud Firewall rules effectively
  3. Regular Updates: Keep system and Docker images updated
  4. SSL/TLS: Always use HTTPS in production
  5. Backup Regularly: Automate database backups
  6. Monitor Logs: Set up log monitoring and alerts
  7. Limit SSH Access: Restrict SSH to specific IP addresses
  8. Use Service Accounts: Instead of API keys where possible

πŸ†˜ Support & Resources

πŸ“ Cost Estimation

Monthly Google Cloud Costs (approximate):
πŸ’‘ Cost Optimization: Use sustained use discounts for 24/7 running instances to save up to 30%. Consider preemptible instances for development/testing environments.

Congratulations! πŸŽ‰ Your InsForge instance is now running on Google Cloud Compute Engine. You can start building applications by connecting AI agents to your backend platform. For other production deployment strategies, check out our deployment guides.