Using wireguard to display a table like structure for stored prisma sqlite db

Hey All,

Uploaded Remix app to fly.io shared 256mb instance. Right now, the app works fine and as expected. I have installed wireguard and activated.

command like these are also working fine
dig +noall +answer _apps.internal txt

Would like to add/update/delete the sqlite prisma db through my local machine? Please guide in how to proceed ahead.

Please let me know if I am missing anything.

Regards
Ajay

You should be able to run fly ssh console -C "sqlite3 /path/to/database.db" and get a sqlite3 shell. .schema will show you all the tables, you can read here for other commands: Command Line Shell For SQLite

If this is a Remix Indie stack project, you can run fly ssh console -C database-cli. If it’s a custom Docker Image, you can add this to your Dockerfile to create the same command:

RUN echo "#!/bin/sh\nset -x\nsqlite3 /path/to/database.db" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli

Thank You for replying.

Both commands work Awesomely and I can edit db with sql commands.

Is their any way if I can do the same operation using prisma studio which basically provides a UI to update the underlying DB. prisma studioruns https://localhost:5555 on remote and I have wireguard configured on local machine for remote fly server. Any way if I could connect both of them and manage db through my local machine using an UI?

local Url → wireguard middleware → remote machine localhost:5555 for managing the DB.

Hope it’s clear. Please let me know if any more is needed.

1 Like

I was able to get Prisma studio on my deployed instance working locally! First, in one terminal tab I ran:

fly proxy 3001:5555

Then, in a separate tab, I ssh’d into my app:

fly ssh console
cd your-app-name
npx prisma studio

I didn’t see anything after that, so wasn’t sure it worked, but sure enough, I opened a browser to http://localhost:3001 and there was my prod data. Not too long after I got an email saying my instance had run out of memory and crashed :laughing:. I guess prisma uses a lot.

6 Likes

That’s bound to happen and totally understandable. Awesome Man!!

From How To to Questions / Help

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