Skip to content

๐Ÿ’ป Configuration files to bootstrap a remote development box on GCP.

License

Notifications You must be signed in to change notification settings

2n3g5c9/remote-dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

remote-dev (on GCP)

pre-commit.ci status Packer Terraform

Automate the provisioning of an ephemeral development server on Google Cloud Platform. An immutable image is built with Packer and deployed on an e2-micro Compute Engine instance (in us-east1-b to fall in the free tier) with Terraform, all via Cloud Build. The instance is only accessible via SSH and MOSH in your Tailscale network.

Diagram

diagram

Usage

โœ… Prerequisites

๐Ÿ” Generate your SSH key pair

If you don't have an SSH key pair already, generate one (preferably with a high-entropy passphrase):

ssh-keygen -o -a 100 -t ed25519 -C remote-dev

๐Ÿ‘ทโ€โ™‚๏ธ Setup Cloud Build

Run the setup script to set the permissions to call the services APIs and setup Packer/Terraform:

./run.sh -s

โš™๏ธ Build the machine image

In the remote-dev repository, submit the Packer Cloud Build job:

./run.sh -p

๐Ÿš€ Deploy the server

In remote-dev/terraform/env/prod/terraform.tfvars, replace the SSH user/public key and Tailscale machines IP addresses with your own values.

Generate a Tailscale ephemeral key and set it:

export TAILSCALE_KEY="tskey-xxx"

Then in the remote-dev repository, submit the Terraform Cloud Build jobs:

./run.sh -t

Once deployed, you can set explicit Tailscale ACLs like the following to restrict network access in your mesh:

{
  "Hosts": {
    "remote-dev": "INSERT_IP_ADDRESS_HERE"
  },
  "ACLs": [
    { "Action": "accept", "Users": ["INSERT_USERNAME_HERE"], "Ports": ["remote-dev:22,60000-61000"] }
  ]
}

๐Ÿ’ฅ Destroy the server

In the remote-dev repository, submit the Terraform Destroy Cloud Build jobs:

./run.sh -d

About

๐Ÿงฐ Tech/frameworks used

  • Google Cloud Build: A service to "Continuously build, test, and deploy".
  • Packer: A tool to "Build Automated Machine Images".
  • Terraform: A tool to "Write, Plan, and Create Infrastructure as Code".
  • Tailscale: A zero config WireGuard mesh VPN.

๐Ÿ“ƒ License

This project is licensed under the MIT License - see the LICENSE file for details

About

๐Ÿ’ป Configuration files to bootstrap a remote development box on GCP.

Topics

Resources

License

Stars

Watchers

Forks