splitgraph / seafowl

Analytical database for data-driven Web applications 🪶
https://seafowl.io
Apache License 2.0
420 stars 11 forks source link

Update docs to describe process of deploying to Fly machines platform #332

Closed milesrichardson closed 1 year ago

milesrichardson commented 1 year ago

Fly recently migrated from their (now legacy) "Nomad platform" to the new "machines platform." There are some significant differences in terms of how volumes are mounted to an app. For example you now need "at least two volumes per app," and volumes need to be pinned to a "machine," but once you've launched a machine, it's not possible to assign a volume to it unless you destroy the machine.

We need to update the docs to reflect this, but in the meantime I've changed the docs to suggest users add the --force-nomad flag to fly launch, which opts into the legacy Nomad platform.

If you were following our Seafowl docs about deploying to Fly, and you had the latest fly CLI but didn't add the --force-nomad flag, the first time you would notice this is when you try to mount a volume to an app (following the guide in our docs):

~/exp/fly-seafowl
❯ fly volumes create seafowl_data --region lhr --size 1
Warning! Individual volumes are pinned to individual hosts. You should create two or more volumes per application. You will have downtime if you only create one. Learn more at https://fly.io/docs/reference/volumes/
? Do you still want to use the volumes feature? Yes
        ID: vol_e628r6gojodvwmnp
      Name: seafowl_data
       App: splitgraph-testing
    Region: lhr
      Zone: b6a7
   Size GB: 1
 Encrypted: true
Created at: 30 Mar 23 21:17 UTC

~/exp/fly-seafowl
❯ vi fly.toml 
# Added this:
# [mounts]
#  source="seafowl_data"
#  destination="/seafowl-data"

~/exp/fly-seafowl
❯ fly deploy
==> Verifying app config
Validating /Users/mjr/exp/fly-seafowl/fly.toml
Platform: machines
✓ Configuration is valid
--> Verified app config
==> Building image
Searching for image 'splitgraph/seafowl:nightly' remotely...
image found: img_nr0lpjql8x9v5q98
Error error machine 148edd1f345e08 does not have a volume configured and fly.toml expects one with destination /seafowl-data; remove the [mounts] configuration in fly.toml or use the machines API to add a volume to this machine

The command that it seems we want is flyctl machines update 148edd1f345e08 --volume seafowl_data:/seafowl-data, to add a volume to a machine, but this doesn't work:

Searching for image 'registry-1.docker.io/splitgraph/seafowl:nightly@sha256:cfc47e2079c0581849239529ee41ee3bd81290bf05478e7f3f609e697d49b1ca' remotely...
image found: img_nr0lpjql8x9v5q98
Image: registry-1.docker.io/splitgraph/seafowl:nightly
Image size: 68 MB

Configuration changes to be applied to machine: 148edd1f345e08 (patient-morning-987)

      ... // 10 identical lines
              "fly_release_version": "5"
          },
-         "restart": {},
+         "mounts": [
+             {
+                 "path": "/seafowl-data",
+                 "volume": "vol_0zy6r7l0key4djng"
+             }
+         ],
+         "restart": {
+             "policy": "always"
+         },
          "services": [
              {
      ... // 26 identical lines
              "cpus": 1,
              "memory_mb": 256
-         }
+         },
+         "dns": {}
      }

? Apply changes? Yes
Updating machine 148edd1f345e08
Error could not stop machine 148edd1f345e08: failed to update VM 148edd1f345e08: unable to add volume after machine is created

Relevant Fly docs:

We probably want to update our docs to include two guides:

Once we figure all this out, we should remove the warnings about the legacy API that I added to the docs in this commit: https://github.com/splitgraph/marketing/commit/640d9f5190c18859203d1c1c7264eb2c13dd2871

onpaws commented 1 year ago

AFAICT, flyctl v0.1.63 appears to 1) have dropped --force-nomad 2) fixed the volume provisioning bug you ran into. More info

onpaws commented 1 year ago

This got merged in https://github.com/splitgraph/marketing/pull/279

Closing