I currently have a local sqlite db, it’s called “dev.sqlite”.
This db resides in a folder prisma/dev.sqlite the db has data in it. I can verify this by checking locally.
I then deploy to fly.io
My docker looks like this:
FROM node:18-alpine
EXPOSE 8081
WORKDIR /app
COPY . .
ENV NODE_ENV=production
RUN npm install
RUN npm remove @shopify/app @shopify/cli
RUN npm run build
CMD ["npm", "run", "docker-start"]
My package.json for npm run build is:
"scripts": {
"build": "remix build",
...
I have a column table named “Tags” when I try to call it, it always comes back empty.
I’m wondering if the database gets reset on the push? Or why woudln’t I be able to access the data?
My schema.prisma contains this:
datasource db {
provider = "sqlite"
url = "file://data/dev.sqlite"
}
If the database is reset on deploy, then it is not on the volume.
If it always comes back empty, the question turns to what process loads this data? Is this something the application itself does? Is there some seed data that you need to load?
I’m familiar with node and prisma, but I don’t know the shopify app that you are deploying.
Yes I need to load some seed data. How would I achieve this? I assumed loading the data in the database would retain it and it would just copy over the files and deploy with the data.
I’m going to make a few assumptions. I assume that you loaded the data into the database on your machine, and that that database is either in the same directory as your Dockerfile, or in a subdirectory of that directory.
If so, your loaded database will be deployed to /app/dev.sqlite3, or /app/path/dev.sqlite3, where path is the name of the directory.
The commands you will want are:
fly ssh console
This will give you a prompt. At that prompt type:
cp /app/path/dev.sqlite /data/dev.sqlite3
exit
Once the seed data is on the volume, it will survive subsequent deploys.