sftp put doesn't save files onto server (node.js)

I was creating my mini file hosting server and I was trying to find ways to upload files onto the server, and discovered fly sftp shell

Except when I push a file onto the machine, it becomes visible and then when the machine shuts down and wakes up again, the uploaded file becomes deleted. How do I avoid this?

Okay just realized deleting files isn’t permanent either. I’m using auto-stop and auto-start methods on my node.js app to save resources, but I want to avoid having to turn both these settings off

For persistent storage, you need a volume: Fly Volumes overview · Fly Docs

Thanks for the response, I’ve added a volume but me manually pushing files to the volume via sftp isn’t permanent for some reason. Am I doing something wrong?

I’ve also updated my app to incorporate an uploading system, and the same issue occurs - the files saved onto the volume do not persist after machine reboots.

Can you show me the output of fly ssh console -C df?

Here’s what I get with my application:

% fly ssh console -C df
Connecting to fdaa:0:cfd4:a7b:e:9c79:ac1d:2... complete
Filesystem     1K-blocks    Used Available Use% Mounted on
devtmpfs          485244       0    485244   0% /dev
none             8154588    7084   7711692   1% /
shm               497784       0    497784   0% /dev/shm
tmpfs             497784       0    497784   0% /sys/fs/cgroup
/dev/vdd         3005464 2281504    551112  81% /data

The last line of the above output is my volume.

I encourage the use of fly ssh console and exploring. It might be worth temporarily changing your fly.toml during these explorations:

auto_stop_machines = false

Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 98748 0 98748 0% /dev
/dev/vda 8154588 215388 7503388 3% /
shm 111288 0 111288 0% /dev/shm
tmpfs 111288 0 111288 0% /sys/fs/cgroup
/dev/vdb 997076 24 929060 1% /files

I went into the root/files directory instead of app/files and found a lost+found file but that’s about it. Nothing is in the /dev/vdb volume

I uploaded some files via my web app which uploades to the /files area and yet the vdb volume remains unaffected…

Wow okay, found something weird. It’s probably a simple configuration error but using sftp put in the root/files volume seems to control that direct volume.

I’ve done a restart of the machine and that file in the root/files is persisting, so I think I found my error. I’ll check back later

Yep, its working now

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