biff

A web framework + self-hosted deployment solution for Clojure. Repo: https://github.com/jacobobryant/biff. Docs: https://biff.findka.com
2020-11-18T19:16:03.071900Z

Start to finish deployment time was roughly an hour minor deployment hiccups: • I didn't run ./task dev after updating by task.env which i believe caused an error because i wasn't sending the correct github repo. • you have to run ./task init at least once before deployment before being on the happy path. Current blocker:

➜  bean git:(master) ✗ ./task tf apply

Error: Could not load plugin


Plugin reinitialization required. Please run "terraform init".

Plugins are external binaries that Terraform uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.

Terraform automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints, run "terraform providers".

Failed to instantiate provider
"<http://registry.terraform.io/digitalocean/digitalocean|registry.terraform.io/digitalocean/digitalocean>" to obtain schema: unknown
provider "<http://registry.terraform.io/digitalocean/digitalocean|registry.terraform.io/digitalocean/digitalocean>"
I wonder if terraform didn't update something? Looking there instructions, i see some variables were missing. "do_token" "pvt_key" . If i copy the "http://provider.tf" directly into my project and run terraform init (which before gives the same error as above) it succeeds.

2020-11-18T19:18:30.072500Z

The error says the provider is uknown though...

2020-11-18T19:20:00.072800Z

➜  bean git:(master) ✗ terraform providers

Providers required by configuration:
.
└── provider[<http://registry.terraform.io/digitalocean/digitalocean|registry.terraform.io/digitalocean/digitalocean>] 1.22.2

2020-11-18T19:27:12.074800Z

DIGITALOCEAN_API_KEY isn't in this list: https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs

2020-11-18T19:36:29.075Z

we add it to the vars though

2020-11-18T19:39:29.075400Z

I really hope terraform doesn't do breaking changes.

2020-11-18T19:44:37.076300Z

FIXED. you have to run ./task tf init

2020-11-18T19:45:07.076800Z

which the error makes clear but obviously we have to run it via the ./task command to keep the correct context.

2020-11-18T20:04:52.077700Z

rror: Error creating droplet: POST https://api.digitalocean.com/v2/droplets: 422 .... are invalid key identifiers for Droplet creation. I can only assume my ssh key in the config/ssh-public-key folder is somehow wrong.

2020-11-18T20:08:22.078300Z

I added my computers public ssh key to digital ocean and that didn't work.. though maybe i should wait a minute.

2020-11-18T20:10:37.078700Z

i can't figure out what else it could be. Ill wait 30 minutes and try again.

2020-11-18T20:39:36.080Z

thanks for the experience report--perhaps it would be good to add some checks to the various task commands. so e.g. it could tell you "you need to run ./task init first" etc. did you run ./task build-image successfully?

2020-11-18T20:47:04.081500Z

If so, you should have something like export IMAGE_ID=12345 # Managed by Biff. in config/task.env. If not, that would probably be the cause of the 422 error. I added an issue to the repo: https://github.com/jacobobryant/biff/issues/66

2020-11-18T20:49:25.082200Z

this is another issue that might be a good idea: https://github.com/jacobobryant/biff/issues/59

2020-11-18T22:36:42.083500Z

There is an IMAGE_ID="..." in my config/task file.

2020-11-18T22:38:50.084600Z

I'n not sure what the Error is saying: Error: Error creating droplet: POST <https://api.digitalocean.com/v2/droplets>: 422 c1:de:81:ac:1c:1f:4b:61:1f:f2:4c:a4:f8:1c:b6:75 are invalid key identifiers for Droplet creation. Is that saying the hashmap has invalid keys? or that the values are invalid. If only someone had invented a system which made it easy to tell the difference!

2020-11-18T22:40:19.086Z

ah I see. yes that does look like a problem with the public key.

2020-11-18T22:40:32.086400Z

{
      "webserver" : {
        "image" : "${var.image_id}",
        "name" : "biff-webserver",
        "region" : "nyc1",
        "size" : "s-1vcpu-1gb",
        "private_networking" : true,
        "ssh_keys" : [ "${var.ssh_key_fingerprint}" ],
        "connection" : {
          "host" : "${self.ipv4_address}",
          "user" : "root",
          "type" : "ssh",
          "timeout" : "2m"
        },
        "provisioner" : [ {
          "file" : {
            "source" : "../config/main.edn",
            "destination" : "/home/biff/config/main.edn"
          }
        }, {
          "file" : {
            "content" : "${var.deploy_key}",
            "destination" : "/home/biff/.ssh/id_rsa"
          }
        } ]
      }
    }

We can likely eliminate constants: so its either image_id, ssh_key_fingerprint, ipv4_address, source, destination or deploy_key.

2020-11-18T22:41:06.086700Z

maybe my key has a passphrase and they dont allow that?

2020-11-18T22:41:46.087400Z

ill make a new one.

2020-11-18T22:44:29.090500Z

I'm on my phone at the moment, I'll do some testing when I get home too. the public key thing was a little tricky to get set up. I was hoping to get the config right so that you don't need to add your public key in the digital ocean ui, but I didn't actually test it using a new public key that I hadn't already added to my account

2020-11-18T22:44:53.090900Z

gotcha. no worries.

2020-11-18T22:45:16.091300Z

pass phrase on the ssh key should be fine

2020-11-18T22:55:20.092200Z

its likely that i mixed up the ssh keys. That would be an easy mistake to make here and i took a break inbetween those steps! i probably posted the wrong one.

2020-11-18T23:13:49.093200Z

its working now. Either i mixed up the ssh keys or it was because i never ran git push to get my code to the repo.

2020-11-18T23:35:38.096700Z

ah good to hear. it's probably the ssh keys. without the git push, the ./task tf apply command should still run fine, but there would be an error later when your app attempts to start up