Terraform template that deploys live reload server on fly.io
Imagine a situation: you're developing an frontend application, you hit deploy, open preview on your iPhone, and... CSS is all fucked up!
Desktop browser emulation of mobile devices just sucks.
Introducing:
✨ dev servers on the edge ✨
Sure!
- cloudflare tunnels: great docs, easy to setup.
- localtunnel: open-source!
- ngrok: tbh never used it...
Why bother rolling out your own thing? I just felt like doing this.
# 1. rename the config
mv terraform.tfvars.example terraform.tfvars
# 2. open terraform.tfvars
# 3. fill in your own values
# 4. deploy
terraform init
terraform plan -out=terraform.tfplan
terraform apply terraform.tfplan
# 5.1 ssh into the server
ssh {vm_user}@{app_name}.fly.dev
# 5.2 (optional) install your dotfiles
# 6. git clone your project
# 7. run the server
npm run dev
# 8. open the url on your iPhone
Rust module shamelessly stolen from here.
Terraform code was revealed to me in a dream...