LiteFS + Docker deployed but app does not stay up

I have deployed an app successfully with fly.io that works well, then I tried to add litefs and connect to it with no success at all, the app keeps dying and I cant even debug…

litefs.yml

fuse:
  dir: "/litefs"

data:
  dir: "/var/lib/litefs"

exit-on-error: false

proxy:
  addr: ":8080"
  target: "0.0.0.0:9000"
  db: "db"
  passthrough: 
    - "*.ico"
    - "*.png"

exec:
  - cmd: "uvicorn books.main:app --host 0.0.0.0 --port 9000 --proxy-headers"

lease:
  type: "consul"
  advertise-url: "http://${HOSTNAME}.vm.${FLY_APP_NAME}.internal:20202"
  candidate: ${FLY_REGION == PRIMARY_REGION}
  promote: true

  consul:
    url: "${FLY_CONSUL_URL}"
    key: "litefs/${FLY_APP_NAME}"

fly.toml

app = 'books-pyapi'
primary_region = 'ams'

[build]
  dockerfile = "Dockerfile.fly"

[[env]]
  DB_PATH = "/litefs/db"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[vm]]
  size = 'shared-cpu-1x'

[mounts]
  source = "litefs"
  destination = "/var/lib/litefs"

Log:

2024-04-10T19:22:19Z runner[6e825165ad5487] ams [info]Setting up volume 'litefs'
2024-04-10T19:22:19Z runner[6e825165ad5487] ams [info]Opening encrypted volume
2024-04-10T19:22:19Z runner[6e825165ad5487] ams [info]Configuring firecracker
2024-04-10T19:22:34Z proxy[6e825165ad5487] ams [info]Starting machine
2024-04-10T19:22:34Z app[6e825165ad5487] ams [info][    0.036544] PCI: Fatal: No config space access function found
2024-04-10T19:22:34Z app[6e825165ad5487] ams [info] INFO Starting init (commit: 5b8fb02)...
2024-04-10T19:22:34Z app[6e825165ad5487] ams [info] INFO Mounting /dev/vdb at /var/lib/litefs w/ uid: 0, gid: 0 and chmod 0755
2024-04-10T19:22:34Z app[6e825165ad5487] ams [info] INFO Resized /var/lib/litefs to 1056964608 bytes
2024-04-10T19:22:34Z app[6e825165ad5487] ams [info] INFO Preparing to run: `litefs mount` as root
2024-04-10T19:22:34Z app[6e825165ad5487] ams [info] INFO [fly api proxy] listening at /.fly/api
2024-04-10T19:22:34Z app[6e825165ad5487] ams [info]2024/04/10 19:22:34 listening on [fdaa:9:16b8:a7b:42:9f1a:a0af:2]:22 (DNS: [fdaa::3]:53)
2024-04-10T19:22:34Z runner[6e825165ad5487] ams [info]Machine started in 458ms
2024-04-10T19:22:34Z app[6e825165ad5487] ams [info]ERROR: config file not found
2024-04-10T19:22:35Z app[6e825165ad5487] ams [info] INFO Main child exited normally with code: 2
2024-04-10T19:22:35Z app[6e825165ad5487] ams [info] INFO Starting clean up.
2024-04-10T19:22:35Z app[6e825165ad5487] ams [info] INFO Umounting /dev/vdb from /var/lib/litefs
2024-04-10T19:22:35Z app[6e825165ad5487] ams [info][    1.331479] reboot: Restarting system

Hi… It looks like you may not have copied litefs.yml into your Machine’s root filesystem.

(I wish litefs would identify itself more in its error messages.)

Typically, this would happen in your Dockerfile.fly.

Hope this helps!

Added litefs

You nailed it, thanks!
Maybe that part of the doc could be more explicit, I got a bit confused.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.