From c0c0aa98d88c2a62792ed7b4f9b150774b66d07e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 28 May 2019 23:18:16 -0300 Subject: Use Floating IP on Droplet --- TODOs.org | 8 +++++++- secrets/envrc.sh | Bin 1493 -> 1541 bytes vps.tf | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/TODOs.org b/TODOs.org index 2b50fab..c7a3bdc 100644 --- a/TODOs.org +++ b/TODOs.org @@ -25,8 +25,8 @@ CLOSED: [2019-05-26 Sun 19:42] Put it in an environment variable? Done by appending to content of =~/.ssh/config=. +**** DOING Use DigitalOcean's Floating IP in front of the droplet **** DOING Automate deployment with Terraform and deployment scripts -**** NEXT Use DigitalOcean's Floating IP in front of the droplet **** DONE Backup data during deployments CLOSED: [2019-05-28 Tue 00:48] Is this approach feasible? Will it make the deployment take too much longer? What are the alternatives? @@ -120,6 +120,12 @@ I'm already covered by using Git Annex for almost everything. ** WAITING =matrix.euandreh.org=: Matrix Synapse server I'm not using IRC a lot right now. Wait for me to interact more with mailing lists and gauge the need of IRC. * Questions +** TODO How to dynamically handle Floating IPs? +Right now the current Floating IP defined in =.envrc= was created manually in DigitalOcean's web UI and copied from it to the environment variable. + +If everything was teared down, I couldn't recreate everything from source, because the Floating IP would be different. + +The ultimate goal would be to upsert a Floating IP address? If no Floating IP address exists, create one. If one already exists (I don't how to get a reference to it), use it. ** TODO Critiques of Docker? What does NixOps, DisNix and Dysnomia are trying to accomplish that overlap with Docker? diff --git a/secrets/envrc.sh b/secrets/envrc.sh index 52e5ac1..fb573ba 100644 Binary files a/secrets/envrc.sh and b/secrets/envrc.sh differ diff --git a/vps.tf b/vps.tf index c5412c3..072fc74 100644 --- a/vps.tf +++ b/vps.tf @@ -1,5 +1,6 @@ variable "do_token" {} variable "ssh_fingerprint" {} +variable "floating_ip" {} provider "digitalocean" { token = "${var.do_token}" @@ -30,3 +31,8 @@ resource "digitalocean_droplet" "vps" { script = "./deploy.sh" } } + +resource "digitalocean_floating_ip_assignment" "vps" { + ip_address = "${var.floating_ip}" + droplet_id = "${digitalocean_droplet.vps.id}" +} \ No newline at end of file -- cgit v1.2.3