How do I export service files
gromir55
FREEOP

a month ago

How do I export service files? I have a TG bot that I deployed via a GitHub repo. I need to export data from the data folder. How do I do this?

Solved$10 Bounty

7 Replies

ilyassbreth
FREE

a month ago

you need to use the railway volume dump template since railway doesn't have built-in file downloads

  1. go to your project and click "+ new"

  2. search for "railway volume dump" template and deploy it

  3. temporarily disconnect your volume from your telegram bot service

  4. mount that same volume to the volume dump service you just deployed

  5. it'll generate a url and password in the service variables

  6. run this command: curl -OJ https://your-url -H "password: your-password"

  7. it downloads everything as a zip file

  8. disconnect volume from dump service and reconnect it back to your bot

that's the official way to do it. here's the template: https://railway.com/deploy/EBwdAh

hope this was clear


ilyassbreth

you need to use the railway volume dump template since railway doesn't have built-in file downloadsgo to your project and click "+ new"search for "railway volume dump" template and deploy ittemporarily disconnect your volume from your telegram bot servicemount that same volume to the volume dump service you just deployedit'll generate a url and password in the service variablesrun this command: curl -OJ https://your-url -H "password: your-password"it downloads everything as a zip filedisconnect volume from dump service and reconnect it back to your botthat's the official way to do it. here's the template: https://railway.com/deploy/EBwdAhhope this was clear

gromir55
FREEOP

a month ago

I changed the volume in the download template. If I change something in the bot, will the volume change? Or do I need to reassign the volume to the bot? The bot constantly restarts, so it's inconvenient.


gromir55

I changed the volume in the download template. If I change something in the bot, will the volume change? Or do I need to reassign the volume to the bot? The bot constantly restarts, so it's inconvenient.

ilyassbreth
FREE

a month ago

while the volume is connected to the dump service, your bot can't see it at all , that's why it keeps restarting any changes your bot tries to make right now won't affect the volume because they're not connected

you need to finish downloading the zip with that curl command asap , then disconnect the volume from the dump service , after that ; remount it back to your telegram bot (same mount path as before like /data or whatever it was) , at the end bot will stop restarting once it has access to the volume again

yeah it's annoying but volumes can only be mounted to one service at a time. try to do the whole download process quick during a low traffic time. once you remount it back to your bot everything goes back to normal


yusufmo1
PRO

a month ago

the volume dump template works well for this. deploy it to your project, disconnect the volume from your bot, mount it to the dump service, then run the curl command with the generated url and password from the service variables. once you've got the zip file, disconnect from the dump service and remount the volume back to your bot using the same path it had before.

your bot keeps restarting because volumes can only be attached to one service at a time. while it's connected to the dump service, your bot can't access the data folder so it crashes. just do the whole process quick and reconnect it right after.

if you need to do this often, check out the filebrowser template instead - gives you a web ui for downloading files. same volume shuffling required though. longer term you might want to add a download endpoint to your bot or use railway's object storage so you don't have to keep swapping volumes around.


gromir55
FREEOP

a month ago

I understand, thank you all


gromir55

I understand, thank you all

yusufmo1
PRO

a month ago

no worries!


Status changed to Open brody about 2 months ago


gromir55

I understand, thank you all

ilyassbreth
FREE

a month ago

glad that worked! the volume dump template is definitely the cleanest way to handle this. if you end up needing to do this regularly, the filebrowser template mentioned above is worth checking out too


Status changed to Solved gromir55 about 1 month ago


Loading...