Unclear about adding Sqlite DB to Fly Volume

Good morning all,

I am attempting to write a sqlite db file to a fly volume named nocodb_vol. I understand that in my fly.toml file I am mounting a fly volume nocodb_vol to a /data directory in my app direcory. I am not sure I understand how to write my sqlite file assisted.db to my fly volume and persist the data.

My sqlite file is stored at /Users/kakuyonmataeh/assisted_mataeh/assisted.db on my host machine. I also have the file on stored as a docker image in container mounted to an arbitrary named volume(nginx-config is the name of the docker volume, assistedtest is the name of the container, and assisted image:latest is the name of the image.

Am I using the correct paths on my mounts in my .toml file? Is the destination expecting a path to the sqlite file on my host machine or perhaps my docker VM image?

Thank you in advance for any assistance.

A Fly Volume just makes a chunk of persistent storage available to your app instance, it’s entirely up to you and your application to fill it with data. With the .toml you mentioned, assuming you’ve already created a volume nocodb_vol and launched an instance in the region with the created volume, there should be a mounted filesystem at the /data path in your application instance when it starts up. It will be empty at first, you can have sqlite create an empty file in this directory and then export/import any existing data into the running process.

If you really need to copy an existing database file (e.g., assisted.db in your example) over to your instance’s volume, some folks have had success with scp for copying database files over to a volume: Persistent Volumes/SCPing of Files

Hey Jordan.

Thank you for your message! I think the best method would be to copy my existence sqlite database like you suggested with scp. When following the example on Persistent Volumes/SCPing of Files the apt-install openssh-client command does not work once I ssh into my apps instance. I am working on a Mac so I figured this is because api-install does not work on Mac. I tried the same command with home-brew “brew-install opens-client” to no avail.

Once I ssh into my app’s instance I am working out of a /bin/sh: shell. Do you have any advice as to why this command is not working as I am trying to scp my .db file?

How to install a package depends on the package manager in the docker image you’re using. You appear to be using nocodb/nocodb which seems to be based on Alpine Linux and the apk package manager, so try apk add openssh.

Yep apk add openssh worked fine in the console thank you. Here is a screenshot of my log once I ran the command.

Now I am at the scp command part of Persistent Volumes/SCPing of Files once I exit the ssh.

My command scp /Users/kakuyonmataeh/assisted_mataeh/assisted.db root@assisted-mataeh.internal:/data/assisted received error “ssh: Could not resolve hostname assisted-mataeh.internal:” nodename nor servname provided, or not known
lost connection

Follow the documentation for steps on setting up private networking:

Thank you so much!

Is the idea here to establish a wrigeuard tunnel to my app so that I can run

scp /Users/kakuyonmataeh/assisted_mataeh/assisted.db root@assisted-mataeh.internal:/data/assisted

at the command line?

If so, how can I reference my wreigaurd tunnel was created and use it to reference my root@myapp.internal?

Yes, that’s the idea, the full set of Fly .internal addresses and how to test the tunnel are detailed in the linked documentation.

Okay great. Before I had the fly wireguard tunnel I was did a bunch of I did a bunch fly issue -agent commands because I was following steps from here: Persistent Volumes/SCPing of Files

I realize now I need a wireguard tunnel to scp my app from my host machine onto my into the volume in my app directory. I am now following the steps here: SSH connection to an instance

I am on step 2 and I can’t use fly establish because of all of my preexisting keys I made from those fly issue-agent commands(see log screenshot) Is there a workaround here so I can use fly establish to create the root org cert, ssh to my application’s root, and scp my file into the data directory.

Quick follow up to this issue.

When I run the command ssh root@fdaa:0:6ed0:a7b:ab3:1:3f0a:2 I get
an operation timed out at port 22 error, failed to connect to host. Im guessing this is because I still have not figured out how to run fly establish to config my tunnel to the root of my app.

I had to override my keys to run fly establish. My fireguard tunnel ws able to activate and I was able to put my file into the backend of my app. It’s up and running now thank you so much!