I am trying to setup litefs with my app and am running into an issue after setting it up. Once I add the setup to my docker config I start getting the below message on deploy:
WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
- 0.0.0.0:8081
Found these processes inside the machine with open listening sockets:
PROCESS | ADDRESSES
-----------------*----------------------------------------
litefs mount | [::]:20202
/.fly/hallpass | [fdaa:3:57fa:a7b:9adb:5b31:85db:2]:22
I am assuming that I need it to be on the port my app is being served over, but im not sure what to configure to get there. Below are my fly.toml, docker file, and litefs.yml
fly.toml
# fly.toml app configuration file generated for bumper-shopify on 2023-10-20T12:06:58-07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = "bumper-shopify"
primary_region = "ord"
[build]
[http_service]
internal_port = 8081
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
[env]
PORT = "8081"
SHOPIFY_APP_URL = "https://xxxxxx.fly.dev"
SHOPIFY_API_KEY = "XXXXXXXXXXXXXXXXX"
SCOPES = "write_products,write_metaobject_definitions,write_metaobjects"
[mounts]
source="data"
destination="/data"
Docker file
FROM node:18-alpine
EXPOSE 8081
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
# packages
RUN apk update && apk upgrade
# 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 ./litefs.yml /tmp/litefs.yml
ADD /prisma/dev.sqlite /tmp/db.sqlite
RUN cp /tmp/litefs.yml /etc/litefs.yml
ENTRYPOINT litefs mount
CMD ["npm", "run", "start"]
litefs.yaml
# note: there should be one template for this, which you can update as necessary.
# note: had to leave the getting started guide and go to the lease management section bc not using fly
# note: lease.hostname and lease.advertise-url are not clear
# note: we should have an example docker-compose setup with everything working both with consul
# and static leases
# This directory is where your application will access the database.
fuse:
dir: "/litefs"
# This directory is where LiteFS will store internal data.
# You must place this directory on a persistent volume.
data:
dir: "/data"
# The lease section defines how LiteFS creates a cluster and
# implements leader election. For dynamic clusters, use the
# "consul". This allows the primary to change automatically when
# the current primary goes down. For a simpler setup, use
# "static" which assigns a single node to be the primary and does
# not failover.
lease:
# Required. Must be either "consul" or "static".
type: "static"
# Required. The URL for this node's LiteFS API.
# Should match HTTP port.
advertise-url: "http://$HOSTNAME:8081"
# Specifies whether the node can become the primary. If using
# "static" leasing, this should be set to true on the primary
# and false on the replicas.
candidate: $IS_PRIMARY