Gateway Pattern¶
Multi-VM with public access and SSL for production web apps
The gateway pattern deploys a multi-VM architecture with a reverse proxy gateway that provides public IPv4 access, automatic SSL/TLS certificates, and load balancing for your backend services.
Overview¶
Perfect For: - Production websites & web apps - E-commerce sites - SaaS applications - Anything needing public HTTPS access
Quick Start¶
Deploy time: 5-7 minutes
Cost: $30-100/month
Features¶
- 🔒 Free SSL certificates - Automatic Let's Encrypt SSL/TLS
- 🌐 Public IPv4 included - Direct internet access
- ⚖️ Load balancing - Distribute traffic across backends
- ❤️ Health checks - Automatic failover for reliability
- 🔄 Reverse proxy - Nginx-based gateway with custom configs
- 🛡️ Private backend network - Backends only accessible via gateway
Example Deployment¶
Deploy a SaaS application with SSL:
The gateway pattern will: 1. Create a gateway VM with public IPv4 2. Deploy your backend application VMs 3. Configure reverse proxy and SSL 4. Set up health checks and load balancing
Architecture¶
Gateway VM¶
- Public IPv4 address
- Nginx reverse proxy
- Let's Encrypt SSL automation
- Load balancer
- Health check monitoring
Backend VMs¶
- Private network only
- Your application code
- Database services
- Internal APIs
Network Flow¶
Configuration¶
Example tfgrid-compose.yaml
for gateway pattern:
name: my-webapp
pattern: gateway
gateway:
domain: myapp.com
ssl: true
backends:
- name: app
cpu: 2
memory: 4096
port: 3000
- name: db
cpu: 2
memory: 8192
private: true
Use Cases¶
Production Web Apps¶
Deploy full-stack web applications with SSL:
E-commerce Sites¶
Run online stores with secure payments:
SaaS Applications¶
Launch multi-tenant SaaS products:
SSL/TLS Configuration¶
The gateway pattern automatically handles SSL certificate:
- Automatic issuance - Let's Encrypt certificates on deployment
- Auto-renewal - Certificates renew automatically
- HTTPS redirect - HTTP traffic automatically redirects to HTTPS
- Modern security - TLS 1.2+ with strong cipher suites
Load Balancing¶
When you deploy multiple backend instances:
The gateway automatically: - Distributes traffic across all instances - Performs health checks - Routes traffic away from unhealthy instances - Provides zero-downtime deployments
Full Documentation¶
For complete implementation details, see the gateway pattern source.
Next Steps¶
- Deploy your first gateway app
- Learn about Single-VM pattern for simpler deployments
- Explore K3s pattern for cloud-native applications
TFGrid Studio Ecosystem
Integrated tools and resources