I was trying to deploy a SvelteKit app following the docs and ran into a problem.
For additional context, I am using better-sqlite3.
The problem I am facing is at the final step when hitting fly deploy.
I am currently getting this: Error: failed to provision seed volumes: failed creating volume: The GraphQL API no longer supports volume operations, please use the machines API instead (or update your flyctl version): https://docs.machines.dev/swagger/index.html#/Volumes
I am new to fly, this is my very first app, actually, so please help out if you can.
Hey hi @davis
Welcome to the fly’s community
In order for the sqlite to store the database you need persistent volumes or else the database is deleted when you restart.
This is my Dockerfile. Is there any other relevant file you’d like to take a look at? I’m happy to accomodate.
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.18.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime="Node.js"
# Node.js app lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV="production"
# Install pnpm
ARG PNPM_VERSION=8.8.0
RUN npm install -g pnpm@$PNPM_VERSION
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y build-essential pkg-config python-is-python3
# Install node modules
COPY --link .npmrc package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod=false
# Copy application code
COPY --link . .
# Build application
RUN pnpm run build
# Remove development dependencies
RUN pnpm prune --prod
# Final stage for app image
FROM base
# Copy built application
COPY --from=build /app /app
# Setup sqlite3 on a separate volume
RUN mkdir -p /data
VOLUME /data
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
ENV DATABASE_URL="file:///data/sqlite.db"
CMD [ "pnpm", "run", "start" ]
Here’s some other bits of info I think could give you more context. This logs at the end after hitting fly deploy.
Creating 1GB volume 'data' for process group 'app'. Use 'fly vol extend' to increase its size
Error: failed to provision seed volumes: failed creating volume: The GraphQL API no longer supports volume operations, please use the machines API instead (or update your flyctl version): https://docs.machines.dev/swagger/index.html#/Volumes
It’s nothing remote. It’s embedded. I’m using better-sqlite3 package.
And about that previous reply, I didn’t create a volume myself. I thought it was automatic.
But, allow me to ask. What are the best ways to handle databases here on fly?
I don’t want to worry about backing up and/or replications, or configuration. I came here because a friend recommended that Fly.io and sqlite is a great combo, if that’s not case, I’m really open to alternatives.
Please make sure you are on the latest version of flyctl. That error message indicates it’s using a deprecated/removed GraphQL endpoint for creating a volume.
I followed @JP_Phillips 's advice and tried upgrading flyctl.
A problem, though, is that when using brew it failed. It’s like it was stuck on version v0.1.62 and I tried uninstalling it and installing again, and then upgrading, but the version remained the same. Not sure if the problem is with brew or flyctl.
After using curl -L https://fly.io/install.sh | sh and the guide in the documentation here, it worked just fine.
Now, as a goodbye note, may anyone point me in the right direction, doc-wise, so that I can learn about managing my database, because this has me worried.
In order for the sqlite to store the database you need persistent volumes or else the database is deleted when you restart.
Again, thanks for the help.
P.S: @JP_Phillips if you do ever find a fix for flyctl from brew, is there a way you might let us know. Because I want for an easier way to upgrade to the newest version whenever its out. Thanks.
Go to JavaScript on Fly.io · Fly Docs and review The Basics on the left side bar. Quick summary: if you want the data in your sqlite3 database to survive restarts of your machine including deploying new versions of your software you will want to put that database on a volume.
If those pages don’t answer your questions, ask them here.