Remix + LiteFS deployment issue. Can not fetch cluster ID connection refused

I am trying to deploy a shopify remix app with liteFS to handle the SQLite. Before I go any further, I have read this similar question: Elixir SQLite LiteFS dns_cluster - cannot fetch cluster ID

and the recommended doc page Disaster Recovery from LiteFS Cloud · Fly Docs

This hasn’t helped. Additionally, just to make sure the key gets properly rotated, I deleted the app, changed the app name and redeployed (since key is derived from app name) and I am getting this error from the get go.

2024-07-05T18:35:41.723 app[e825de9f705908] dfw [info] level=INFO msg="cannot fetch cluster ID from \"consul\" lease, retrying: Get \"\": dial tcp connect: connection refused"

2024-07-05T18:35:42.724 app[e825de9f705908] dfw [info] level=INFO msg="cannot fetch cluster ID from \"consul\" lease, retrying: Get \"\": dial tcp connect: connection refused"

2024-07-05T18:35:43.538 app[e825de9f705908] dfw [warn] Virtual machine exited abruptly


FROM node:18-alpine



COPY . .

ARG LITEFS_CONFIG=/etc/litefs.yml

RUN npm install

RUN npm run build

# You'll probably want to remove this in production, it's here to make it easier to test things!

RUN rm -f prisma/dev.sqlite

# for alpine-based images

RUN apk add ca-certificates fuse3 sqlite

COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs

ADD /etc/litefs.yml /etc/litefs.yml

ENTRYPOINT litefs mount

Per this question, running of the main app has been moved to LiteFs supervisor


# The fuse section describes settings for the FUSE file system. This file system
# is used as a thin layer between the SQLite client in your application and the
# storage on disk. It intercepts disk writes to determine transaction boundaries
# so that those transactions can be saved and shipped to replicas.
  dir: "/litefs"

# The data section describes settings for the internal LiteFS storage. We'll 
# mount a volume to the data directory so it can be persisted across restarts.
# However, this data should not be accessed directly by the user application.
  dir: "/var/lib/litefs"

# This flag ensure that LiteFS continues to run if there is an issue on starup.
# It makes it easy to ssh in and debug any issues you might be having rather
# than continually restarting on initialization failure.
exit-on-error: false

# This section defines settings for the option HTTP proxy.
# This proxy can handle primary forwarding & replica consistency
# for applications that use a single SQLite database.
  addr: ":8080"
  target: "localhost:8081"
  db: "my.db"
    - "*.ico"
    - "*.png"

# This section defines a list of commands to run after LiteFS has connected
# and sync'd with the cluster. You can run multiple commands but LiteFS expects
# the last command to be long-running (e.g. an application server). When the
# last command exits, LiteFS is shut down.
#- cmd: "litefs-example -addr :8081 -dsn /litefs/db"
  - cmd: "npm run docker-start"

# The lease section specifies how the cluster will be managed. We're using the
# "consul" lease type so that our application can dynamically change the primary.
# These environment variables will be available in your application.
  type: "consul"
  advertise-url: "http://${HOSTNAME}.vm.${FLY_APP_NAME}.internal:20202"
  candidate: ${FLY_REGION == PRIMARY_REGION}
  promote: true

    url: "${FLY_CONSUL_URL}"
    key: "litefs/${FLY_APP_NAME}-lts"

fly.toml (internal port pointing to the proxy as mentioned in the docs):

# fly.toml app configuration file generated for kronos-vip-on-site on 2024-07-05T22:17:29+03:00
# See for information about how to use this file.

app = 'kronos-vip-on-site'
primary_region = 'dfw'


  PORT = '8081'
  SCOPES = 'read_all_orders,read_customers,read_orders,write_customers,write_products'
  SHOPIFY_API_KEY = '84c89114f79877c5a5e2486fe93ce548'

  source = 'litefs'
  destination = '/var/lib/litefs'

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

  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

Any help would be appreciated