Confused setting up LiteFS


I am trying to get LiteFS setup on my existing Remix IndieStack project. I have followed both the Speedrun and the Getting Started docs.

Below I have included my Dockerfile, fly.toml and litefs.yml files. The things that are confusing me at the moment:

  • Do I need to delete the original Volume? i.e. does the new 10GB litefs volume replace the 1GB one originally set up with the project?
  • what should the exec section of the litefs.yml file look like for a project that uses a to run?
  • What does this error mean Error: machine 7843d27b205948 [app] can't update the attached volume litefs with name 'vol_vd36ml687q7we2xr' by 'data'

Thanks for any help or guidance

app = "in-touch"
primary_region = "lhr"
kill_signal = "SIGINT"
kill_timeout = 5
processes = [ ]

allowed_public_ports = [ ]
auto_rollback = true
cmd = ""
entrypoint = "sh"

source = "litefs"
destination = "/data/litefs"

internal_port = 8_080
processes = [ "app" ]
protocol = "tcp"
script_checks = [ ]

  hard_limit = 25
  soft_limit = 20
  type = "connections"

  handlers = [ "http" ]
  port = 80
  force_https = true

  handlers = [ "tls", "http" ]
  port = 443

  grace_period = "1s"
  interval = "15s"
  restart_limit = 0
  timeout = "2s"

  interval = "10s"
  grace_period = "5s"
  method = "get"
  path = "/healthcheck"
  protocol = "http"
  timeout = "2s"
  tls_skip_verify = false
  headers = { }
  dir: '/litefs'
  dir: '/data/litefs'
exit-on-error: false
  addr: ':8080'
  target: 'localhost:3000'
  db: 'db'
    - '*.ico'
    - '*.png'

  - cmd: npx prisma migrate deploy
    if-candidate: true
  - cmd: npm start

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

    url: '${FLY_CONSUL_URL}'
    key: '${FLY_APP_NAME}/primary'
# base node image
FROM node:21-bookworm-slim as base

# set for base and all layer that inherit from it
ENV NODE_ENV production

# Install openssl for Prisma
RUN apt-get update && apt-get install -y openssl sqlite3 ca-certificates fuse3

# Install all node_modules, including dev dependencies
FROM base as deps

WORKDIR /myapp

ADD package.json package-lock.json .npmrc ./
RUN npm install --include=dev

# Setup production node_modules
FROM base as production-deps

WORKDIR /myapp

COPY --from=deps /myapp/node_modules /myapp/node_modules
ADD package.json package-lock.json .npmrc ./
RUN npm prune --omit=dev

# Build the app
FROM base as build

WORKDIR /myapp

COPY --from=deps /myapp/node_modules /myapp/node_modules

ADD prisma .
RUN npx prisma generate

ADD . .
RUN npm run build

# Finally, build the production image with minimal footprint
FROM base

ENV DATABASE_URL=file:/data/sqlite.db
ENV PORT="8080"
ENV NODE_ENV="production"

# add shortcut for connecting to database CLI
RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli

WORKDIR /myapp

COPY --from=production-deps /myapp/node_modules /myapp/node_modules
COPY --from=build /myapp/node_modules/.prisma /myapp/node_modules/.prisma

COPY --from=build /myapp/build /myapp/build
COPY --from=build /myapp/public /myapp/public
COPY --from=build /myapp/package.json /myapp/package.json
COPY --from=build /myapp/ /myapp/
COPY --from=build /myapp/prisma /myapp/prisma

# is this right directory?
COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs 

ENTRYPOINT litefs mount

Hi… The cause of this is probably intertwined with your first question about volumes, but, just to be sure, what is the output of fly vol list for this app?

Added volumes

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