π₯οΈVirtual Machine (Docker)
Deploy FormSG to a virtual machine for small-scale production use, staging environments, or pilot deployments. This guide uses Docker Compose on a single server to get FormSG running with minimal infrastructure complexity.
Overview
This deployment is ideal for:
Pilot projects - Test FormSG with real users before full production
Small organizations - Up to 1,000 form submissions per month
Staging environments - Test customizations and integrations
Air-gapped deployments - Isolated government networks
Budget-conscious teams - Simple infrastructure with predictable costs
Prerequisites
Cloud provider account (AWS, Azure, GCP) or physical server access
Basic Linux command line knowledge
SSH client on your local machine
Domain name (optional but recommended)
Architecture Overview

This VM deployment runs FormSG components on a single server using docker containers, specific services can be seen in docker config here.
Deployment Steps
Create Virtual Machine
Cloud Provider Setup:
Choose your preferred cloud provider and create a new VM instance:
AWS: EC2 β Launch Instance β Ubuntu 22.04 LTS
Azure: Virtual Machines β Create β Ubuntu 22.04 LTS
GCP: Compute Engine β VM instances β Create β Ubuntu 22.04 LTS
Recommended Specifications:
CPU: 2 vCPUs (minimum 1 vCPU for testing)
Memory: 4 GB RAM (minimum 2 GB)
Storage: Few GBs, depending on need
Network: Public IP address if external access needed
Instance Examples:
AWS: t3.small or t3.medium (t2.micro for testing)
Azure: Standard_B2s or Standard_B1ms (Standard_B1s for testing)
GCP: e2-small or e2-medium (e2-micro for testing)
Security Group/Firewall Rules:
SSH (port 22) from your IP address
HTTP (port 80) from anywhere (if using domain)
HTTPS (port 443) from anywhere (if using SSL)
Custom port 5173 from anywhere (for direct access)
Security Note: Restrict SSH access to your IP address only. Consider using a VPN or bastion host for production deployments.
Install Docker and Docker Compose
This deployment path requires Docker and Docker Compose to run. Install them using your preferred method:
Option 1: Official Docker Installation (Recommended)
Follow the official Docker installation guide for Ubuntu:
Ensure you install Docker Compose plugin
Option 2: Quick Installation via Convenience Script
Option 3: Package Manager Installation
Post-Installation Setup:
Start FormSG Services
You have two options for starting FormSG:
Option 1: All-in-One (Recommended)
This handles both the frontend build and Docker services automatically.
Option 2: Backend Only
Use this if you want more control over individual services.
Services Starting:
MongoDB: Database server
MailDev: Email testing
FormSG Backend: API server
FormSG Frontend: Web interface (port 5173)
Accessing Your FormSG Instance
Web Interface
Open your browser and navigate to:
Main Application:
http://YOUR_VM_IP:5173Email Testing:
http://YOUR_VM_IP:1080(MailDev interface)
First Login
Go to the admin portal:
http://YOUR_VM_IP:5173/loginClick "Login with Email"
Enter your email address
Check the MailDev interface (
http://YOUR_VM_IP:1080) for the OTP codeEnter the OTP to complete login
Scaling
This VM deployment runs all FormSG components on a single server, which limits scaling options. For high-traffic scenarios or high availability requirements, consider moving to a cloud-native deployment with multiple servers.
When to Move Beyond VM Deployment
Consider migrating to a more robust deployment when you experience:
High traffic: >1,000 concurrent users or >10,000 daily submissions
Availability requirements: Need 99.9% uptime or zero-downtime deployments
Advanced integrations: Complex workflows requiring multiple services
π Congratulations! You now have FormSG running on a virtual machine. This provides a solid foundation for small-scale production use while maintaining full control over your infrastructure.
Last updated
Was this helpful?