Can't figure out how to deploy Node.js project from CLI.
Good day everyone, I'm having issues figuring out how to deploy project from local terminal using railway CLI.
I'm new to Railway, but I've went through docs.
Basically I have files (.js, .json) inside
/build
folder that I would like to just deploy, but I can't understand how to do that locally.
Why do I need to do that locally -- I have .json file that is .gitignored and should not go into git repo, so running build command from GitHub repo won't work in my case.
What I tried: I tried linking project, service with railway link
, then running railway up
that seems to run build script, which is great, but then it can't finish build as it can't locate gitignored files.
Maybe there would be a flag to include gitignored files into building scope?
And I'm trying to copy that file into /build
folder via webpack script:
Solution:Jump to solution
I have removed
.gitignore
, have run railway up
, so it succesfully built, deployed my app to remote and now I can revert removal with 2 clicks.25 Replies
Project ID:
N/A
N/A
if your code needs these files, why are you gitignore'ing them?
@Brody
So I have a couple of files:
chatgpt-presets.default.json
is file with default strings I use to prompt ChatGPT. Basically usecase for that file is to be used by other devs when they are trying out my application.
chatgpt-presets.local.json
is "production" file that I put personalized prompts inside. I don't want to share these on web with anyone, this file is for local development only and it happens that I want to deploy build with using that file instead default one.
basically same principle as with .env
, .env.default
, .env.dev
files
is there a way I can just scoop everything from /build and deploy it to remote via CLI?
or is there a way I can provide that file to deployment via website interface? I haven't seen such an option, only env variables can be set, but that's itcan you cd into the build folder locally and then link to that folder, then railway up from that folder?
doesn't look like, that is what I've got:
Same thing on railway logs from website.
But when I was creating service on website, I have selected "empty service", could that be a problem?
ah yeah railway isn't knowing what to do with the contents of that folder
maybe find another way to provide that json file to your app? like through S3 storage
Lmao that is out of scope of my competence. I've developed simple telegram bot in a couple of hours and don't want to go as far as spreading project files across multiple webservices :D
I just hope to deploy it remotely so it won't be spinning on my local machine )
you need another way to provide this file to your app that isn't through your project files, maybe a private gist or something
So there's no way of including gitignored files in build process?
I guess I will try to remove gitignore just for
railway up
commandnope that's what gitignore is there for
hell yeah, it works at least!
Solution
I have removed
.gitignore
, have run railway up
, so it succesfully built, deployed my app to remote and now I can revert removal with 2 clicks.I guess if there's no other way to seed files into deployments yet, then that is one of few ways to make it work :)
sounds good, happy you found a solution that worked for you
@Brody thank you too! and have a good evening
you can put files onto a volume, but that's pretty convoluted tbh
hm I haven't seen how to do that
does that json file ever change?
Sometimes it does, yes, when I edit prompts and such, so as often as code changes
damn could you quickly remind me how to mark problem as resolved?
then it isn't worth it to put it onto a volume since it's a hassle
thank you)
users can't do that anymore, sorry
no problem!
@Brody sorry for off-topic question, but do you know how to access deployed files as my bot writes some files and I would like to have access to them?
Or is deployment basically unaccessible?
basically, yes