a year ago
I have a service app which required files in config folder and assets folder so i have attached a volume with /app/data then,
I deployed filebrowser template but it already comes with a volume, so i'm confused how do I use filebrowser to create those folders and upload my files. which is attached to my service app
volumes:
- ./config:/app/config
- ./assets:/app/assetsor is there a way to attach the same volume for both the services, or is there any other workaround please help
47 Replies
a year ago
unfortunately you can't add two volumes to the same service or have a shared volume between 2 services
maybe MinIO could help?
a year ago
Railway doesn't have a way to directly alter the volume in-app yet, so the easiest way to do that is by using the Filebrowser template to ask a intermediary
The steps are as follows:
Right click on your project canvas
Deploy from template
Deploy Filebrowser
Delete the volume Filebrowser comes with
Dismount and Remount your volume to Filebrowser on path
/dataSet the variable
USE_VOLUME_ROOT(or something like that) to1Enter filebrowser using the creds in its service variable and make the changes
Dismount the volume from filebrowser and reconned to your application
now should i create /app folder and then subfolders as required or is there any other step

a year ago
/app would be the directory for your actual app, if you were to mount the volume on /app then it'll overwrite everything within your application
there is no workaround for having both a volume /app/config and /app/assets on your service, you'll either have to use one or the other or use somehting like MinIO (if possible)
a year ago
what're you deploying?
is a go app i want to deploy for my own usecase and also want to create a template
a year ago
if it's your own app, why not just move config and assets to a data directory and then mount the volume to /app/data ?
a year ago
or is it a premade go app?
a year ago
ooh okay, you can check the open source project's docs to see if it has any MinIO or S3 support, if it does then you can just use that but if not then unfortunately you'll only be able to choose one path to store in a volume, (either config or assets, can't store both since Railway doesn't support multiple volumes yet)
a year ago
Ah, dang 😔
ok i have an option where i can use only one config path but still need a way do create files in the config folder path how should i do that
a year ago
if it's for a template, then you might have to create the files dynamically within the start command of the application
I did something similar for the Dashy template since it doesn't populate a default config itself
If it's just for personal use then you could just pop the volume into a Filebrowser deployment (make sure USE_VOLUME_ROOT is set to 1) and populate the volume with the appropriate files then mount it back to your service under /app/config
actually i did check your dashy template but i didnt understand how does it download yml file from the url to dashy volume, do we need to have the variable name in dashy, i mean in the dashy's official repo
so here i should change the volume to /app/config right and then use the env var for the yml file url

a year ago
if you deploy it you can go look at its start command, all the magic happens there
a year ago
no worries
a year ago
it should but you can pretty much condense any command I can think of into a single line
For my personal usecase I need a way to download multiple files in the given path
one doubt what would be the health check path if this is given
HEALTHCHECK --timeout=10s --start-period=60s --interval=60s \
CMD wget --spider -q http://localhost:8080/api/healthzis it http://localhost:8080/api/healthz or /api/healthz or /healthz
one doubt what should be the health check path if this is given, i did check the docs but didnt understand
HEALTHCHECK --timeout=10s --start-period=60s --interval=60s \
CMD wget --spider -q http://localhost:8080/api/healthzis it http://localhost:8080/api/healthz or /api/healthz or /healthz
a year ago
it depends on the application, but it's a path not a url so it wouldn't be the first one
here's the template for which i was asking for volumes
https://railway.com/template/ZHBnkG?referralCode=vishify
thanks for the magic command some how i figured it out a working start command
a year ago
Awesome!! Glad you got it working
a year ago
that's a cool template
but it requires more other files so i was trying to enhance the start command if you can guide me through this
/bin/sh -c 'for VAR in CONFIG_FILES; do URLS=$(eval echo \$$VAR); for URL in $(echo "$URLS" | tr "," " "); do [ -n "$URL" ] && FILE_NAME=$(basename "$URL") && DEST_PATH="/app/config/$FILE_NAME" && echo "Downloading $FILE_NAME..." && wget -O "$DEST_PATH" "$URL" && echo "$FILE_NAME has been downloaded."; done; done; for VAR in CUSTOM_CSS FAVICON LOGO; do URL=$(eval echo \$$VAR); [ -n "$URL" ] && FILE_NAME=$(basename "$URL") && DEST_PATH="/app/config/$FILE_NAME" && echo "Downloading $FILE_NAME..." && wget -O "$DEST_PATH" "$URL" && echo "$FILE_NAME has been downloaded."; done; echo "Starting Glance..." && ./glance --config /app/config/glance.yml'a year ago
I'm honestly not really that good at making such complex one line shell commands I usually just have chatgpt aid me 🤣
btw even i used chatgpt, but i'm missing the logic will the railway support downloading multiple files to the same volume
a year ago
of course
a year ago
railway should be able to do basically anything the command is able to do
this works actually, now i'm able to download multiple yml files, it was my bad i missed one path
a year ago
nice work :D
a year ago
!s
Status changed to Solved dev • about 1 year ago