Skip to content

Twingate-Community/diy-vpn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DIY VPN - Twingate Exit Network Deployment

A comprehensive solution for deploying Twingate Exit Networks to create a DIY, globally-distributed VPN for personal use.

πŸš€ Overview

⚠️ Internal Use Only: This project can only be used for personal or internal use. Please do not use this project or Twingate to offer a commercial VPN service. Also note that bandwidth usage through Twingate infrastructure is subject to Twingate's Fair Use Policy.

This repository provides multiple deployment options for creating VPN Exit Networks with Twingate's zero-trust networking technology:

  • πŸ§ͺ Minikube: Local development and testing environment
  • 🌊 DigitalOcean Droplets: Small scale deployments
  • ☸️ DigitalOcean Kubernetes: Enterprise level implementation

⚠️ Important: To access Exit Networks, you need a plan that includes Exit Networks, such as Twingate Home or Twingate Enterprise. Exit Networks are not available on the free Starter plan. Learn more about Twingate plans.

✨ Key Features

βœ… Multi-Platform Support: Deploy on droplets, Kubernetes clusters, or locally
βœ… Zero-Trust Security: No inbound ports open - all access is via Twingate
βœ… Global Distribution: Multi-region deployment capabilities

πŸ—οΈ Architecture

Deployment Options

Platform Use Case Cost
Minikube Development, testing πŸ’° Free
DigitalOcean Droplets Personal, cost-effective πŸ’° Low
DigitalOcean Kubernetes Enterprise, orchestration πŸ’°πŸ’° Medium

πŸ’‘ Choose One Option: These are separate, independent deployment methods - not components that work together. Select the single option that best matches your specific needs and use case.

Which Option Should I Choose?

πŸ§ͺ Minikube - Start Here

  • Perfect for: Learning, development, testing configurations
  • Choose if: You want to experiment locally before committing to cloud resources
  • Pros: Free, fast iteration, safe testing environment. Can be used used as a free Exit Network
  • Cons: Local only, not suitable for production traffic

🌊 DigitalOcean Droplets - Most Popular

  • Perfect for: Personal VPN, small teams, cost-conscious deployments
  • Choose if: You want simple, reliable, cost-effective Exit Networks
  • Pros: Lowest cost, simple architecture, production-ready
  • Cons: Manual scaling, requires some Linux knowledge for troubleshooting

☸️ DigitalOcean Kubernetes - Enterprise Grade

  • Perfect for: Large organizations, access to cluster resources, complex deployments
  • Choose if: You need enterprise features and have Kubernetes expertise
  • Pros: Access to cluster resources, high availability, advanced orchestration
  • Cons: Higher cost, complexity, requires Kubernetes knowledge

Architecture Model

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Device   β”‚    β”‚  Twingate Cloud  β”‚    β”‚   Exit Network  β”‚
β”‚                 │◄──►│                  │◄──►│                 β”‚
β”‚ Twingate Client β”‚    β”‚   Zero-Trust     β”‚    β”‚   Connector     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚   Controller     β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Terraform >= 1.0
  • Twingate Home or other subscription plan that includes Exit Networks (not available on Starter plan)
  • Twingate account with API access
  • Platform-specific requirements (see individual folders)

1. Choose Your Deployment Platform

Select ONE option that fits your needs:

Best for Beginners Best for Production Best for Development
DigitalOcean Droplets DigitalOcean Kubernetes Minikube
Simple, cost-effective Orchestration, enterprise Local testing

Note: These are independent deployment methods. Don't try to use multiple options together - pick the one that best matches your requirements.

2. Get Your Twingate Credentials

  1. API Token: Twingate Admin Console β†’ Settings β†’ API
  2. Network Name: Your tenant name (e.g., company.twingate.com β†’ company)
  3. Exit Network ID: Create an Exit Network in Twingate Admin Console

3. Deploy

Choose your platform and follow the detailed README in each folder:

# For Minikube (recommended for beginners / local development)
cd minikube
./deploy.sh

# For DigitalOcean Droplets (cost effective / personal use)
cd digital_ocean/droplet
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your credentials
terraform init
terraform apply

# For DigitalOcean Kubernetes (Enterprise)
cd digital_ocean/kubernetes
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your credentials
terraform init
terraform apply

πŸ“ Repository Structure

diy-vpn/
β”œβ”€β”€ README.md                     # This file
β”œβ”€β”€ digital_ocean/                # DigitalOcean deployments
β”‚   β”œβ”€β”€ droplet/                  # Direct droplet deployment
β”‚   β”‚   β”œβ”€β”€ main.tf              # Core Terraform configuration
β”‚   β”‚   β”œβ”€β”€ variables.tf         # Input variables
β”‚   β”‚   β”œβ”€β”€ outputs.tf           # Output values
β”‚   β”‚   β”œβ”€β”€ terraform.tfvars.example
β”‚   β”‚   β”œβ”€β”€ templates/           # Cloud-init templates
β”‚   β”‚   └── README.md           # Detailed droplet guide
β”‚   └── kubernetes/              # Kubernetes cluster deployment
β”‚       β”œβ”€β”€ main.tf             # Cluster configuration
β”‚       β”œβ”€β”€ deploy.tf           # Deployment automation
β”‚       β”œβ”€β”€ variables.tf        # Input variables
β”‚       β”œβ”€β”€ outputs.tf          # Output values
β”‚       β”œβ”€β”€ terraform.tfvars.example
β”‚       β”œβ”€β”€ config/             # Generated configurations
β”‚       └── README.md          # Detailed Kubernetes guide
β”œβ”€β”€ helm/                        # Reusable Helm chart
β”‚   β”œβ”€β”€ Chart.yaml              # Chart metadata
β”‚   β”œβ”€β”€ values.example.yaml     # Example configuration
β”‚   β”œβ”€β”€ templates/              # Kubernetes templates
β”‚   β”œβ”€β”€ charts/                 # Chart dependencies
β”‚   └── README.md              # Helm chart documentation
└── minikube/                    # Local development
    β”œβ”€β”€ deploy.sh               # Deployment script
    β”œβ”€β”€ cleanup.sh              # Cleanup script
    β”œβ”€β”€ values.yaml             # Helm values
    β”œβ”€β”€ values-example.yaml     # Example configuration
    └── README.md              # Minikube guide

🌍 Global Deployment

DigitalOcean Regions:

  • North America: NYC1, NYC2, NYC3, SFO1, SFO2, SFO3, TOR1
  • Europe: AMS2, AMS3, LON1, FRA1
  • Asia Pacific: SGP1, BLR1, SYD1

Current as of October 2025. Refer to DigitalOcean for the most current list.

πŸ› οΈ Troubleshooting

Common Issues

Issue Solution Reference
Connector offline Check API tokens and network connectivity Droplet README
Terraform state conflicts Use separate state files per environment Kubernetes README
Helm deployment fails Verify cluster connectivity and dependencies Helm README
Minikube issues Check Docker and resource allocation Minikube README

Support Resources

Development Workflow

  1. Clone the repository
  2. Create a feature branch
  3. Test your changes locally with Minikube
  4. Submit a pull request

πŸ“„ License

Copyright (C) Twingate Inc.

This project is licensed under AGPL-3.0-only.


πŸš€ Ready to deploy your DIY VPN? Choose your platform above and follow the detailed guides in each folder!

About

DIY VPN powered by Twingate and Digital Ocean

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors