Turso Embedded Replicas not working on Fly.io

Update: Not sure why, but choosing /data/turbo.db instead of /data/db/turso.db seems to have fixed it. Looks like the app could not create the folder by itself. But it can locally, so that’s weird. Anyways if anything else comes I’ll make sure to update anybody interested/experimenting with this issue.

I have a Bun app tha’t’s working fine with embedded replicas locally. When I try to deploy it to fly.io, I create a volume and provide the local path as a secret (expected). Then it breaks stating:

Smoke checks for 5683dd71a04528 failed: the app appears to be crashing
Check its logs: here's the last lines below, or run 'fly logs -i 5683dd71a04528':
  Setting up volume 'data'
  Opening encrypted volume
  Configuring firecracker
   INFO Sending signal SIGINT to main child process w/ PID 313
   INFO Main child exited with signal (with signal 'SIGINT', core dumped? false)
   INFO Starting clean up.
   INFO Umounting /dev/vdb from /data
   WARN hallpass exited, pid: 314, status: signal: 15 (SIGTERM)
  2024/01/11 06:59:58 listening on [fdaa:0:344a:a7b:e4:d212:75f8:2]:22 (DNS: [fdaa::3]:53)
  [   47.348480] reboot: Restarting system
  [    0.036416] PCI: Fatal: No config space access function found
   INFO Starting init (commit: 8995e367)...
   INFO Mounting /dev/vdb at /data w/ uid: 0, gid: 0 and chmod 0755
   INFO Resized /data to 1069547520 bytes
   INFO Preparing to run: `/usr/local/bin/docker-entrypoint.sh bun src/index.ts` as root
   INFO [fly api proxy] listening at /.fly/api
  2024/01/11 06:59:59 listening on [fdaa:0:344a:a7b:e4:d212:75f8:2]:22 (DNS: [fdaa::3]:53)
  thread '<unnamed>' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-rustls-0.24.2/src/config.rs:48:9:
  no CA certificates found
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   INFO Main child exited with signal (with signal 'SIGABRT', core dumped? false)
   INFO Starting clean up.
   INFO Umounting /dev/vdb from /data
   WARN hallpass exited, pid: 314, status: signal: 15 (SIGTERM)
  2024/01/11 07:00:00 listening on [fdaa:0:344a:a7b:e4:d212:75f8:2]:22 (DNS: [fdaa::3]:53)
  [    2.279501] reboot: Restarting system
  machine did not have a restart policy, defaulting to restart
  [    0.039774] PCI: Fatal: No config space access function found
   INFO Starting init (commit: 8995e367)...
   INFO Mounting /dev/vdb at /data w/ uid: 0, gid: 0 and chmod 0755
   INFO Resized /data to 1069547520 bytes
   INFO Preparing to run: `/usr/local/bin/docker-entrypoint.sh bun src/index.ts` as root
   INFO [fly api proxy] listening at /.fly/api
  2024/01/11 07:00:02 listening on [fdaa:0:344a:a7b:e4:d212:75f8:2]:22 (DNS: [fdaa::3]:53)
  thread '<unnamed>' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-rustls-0.24.2/src/config.rs:48:9:
  no CA certificates found
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   INFO Main child exited with signal (with signal 'SIGABRT', core dumped? false)
   INFO Starting clean up.
   INFO Umounting /dev/vdb from /data
   WARN hallpass exited, pid: 314, status: signal: 15 (SIGTERM)
  2024/01/11 07:00:03 listening on [fdaa:0:344a:a7b:e4:d212:75f8:2]:22 (DNS: [fdaa::3]:53)
  [    2.282793] reboot: Restarting system
  machine did not have a restart policy, defaulting to restart
  [    0.036194] PCI: Fatal: No config space access function found
   INFO Starting init (commit: 8995e367)...
   INFO Mounting /dev/vdb at /data w/ uid: 0, gid: 0 and chmod 0755
   INFO Resized /data to 1069547520 bytes
   INFO Preparing to run: `/usr/local/bin/docker-entrypoint.sh bun src/index.ts` as root
   INFO [fly api proxy] listening at /.fly/api
  2024/01/11 07:00:05 listening on [fdaa:0:344a:a7b:e4:d212:75f8:2]:22 (DNS: [fdaa::3]:53)
  thread '<unnamed>' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-rustls-0.24.2/src/config.rs:48:9:
  no CA certificates found
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   INFO Main child exited with signal (with signal 'SIGABRT', core dumped? false)
   INFO Starting clean up.
   INFO Umounting /dev/vdb from /data
  2024/01/11 07:00:06 listening on [fdaa:0:344a:a7b:e4:d212:75f8:2]:22 (DNS: [fdaa::3]:53)

-------
 ✖ Machine 5683dd71a04528 [app] update failed: smoke checks for 5683dd71a04528 failed: the app appears to be crashing
-------

When I commented the code for the embedded replica it works fine on fly.io as well. Not sure why it can’t create the SQLite db by itself.

This part looks suspicious.

How did you make your container image? Have you installed the CA certificates?

Hi, I don’t think I need to have a certificate since it works fine without it when I don’t enable the embedded replica feature. My Dockerfile looks like this:

FROM oven/bun:alpine

WORKDIR /app

COPY package.json .
COPY bun.lockb .

RUN bun install --production

COPY src src
COPY services services
COPY tsconfig.json .
# COPY public public

ENV NODE_ENV production
CMD ["bun", "src/index.ts"]

EXPOSE 3000

Update: Not sure why, but choosing /data/turbo.db instead of /data/db/turso.db seems to have fixed it. Looks like the app could not create the folder by itself. But it can locally, so that’s weird. Anyways if anything else comes I’ll make sure to update anybody interested/experimenting with this issue.

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