3 months ago
Hi i need help please I already have a discord bot coded n all I want to know how I can keep it up with railway
114 Replies
3 months ago
Could you send me a screenshot of the project structure?
not exactly sure what a project structure is but these are js the files composed for the bot
Attachments
3 months ago
thats exactly what I was looking for
3 months ago
neat, looks good
3 months ago
do you have this on GitHub?
3 months ago
There's 2 ways you can go about deploying this on Railway:
- via GitHub (recommended)
- via CLI
GitHub would require a lot more setup while the CLI is faster
3 months ago
Either way is fine, it's up to you
3 months ago
If you already know how to use GitHub then I'd recommend the GitHub way now
otherwise i'd recommend the CLI way just to get it up and running, then you can figure out GitHub later
3 months ago
no problemo
3 months ago
I'm assuming you dont have the CLI installed
3 months ago
command line interface
3 months ago
What operating system are you using?
3 months ago
could open the search bar, type in cmd and hit enter, Command Prompt should pop up
3 months ago
try entering:
npm --version3 months ago
i'm trying to see if you have npm installed or not
3 months ago
if you do then we can install railway's cli via npm
3 months ago
if not then i'm going to give you a different command to install something called scoop which you can use to install railway cli
3 months ago
just lmk what it says
3 months ago
oh okay
3 months ago
in that case we can install scoop ()
in the command prompt window, try entering:
powershellthis'll append PS a the far left of the command line, let me know if you see that
3 months ago
what this does is we're switching from command prompt over to powershell because scoop's install command requires us to use powershell
Attachments
3 months ago
perfect!
3 months ago
the next step is the installation step
3 months ago
you'll want to copy and paste this in there:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression-# Note: dont just run random commands that people give you online, its bad security practice, you can copy and paste the command directly from the scoop's website via the link I shared above
3 months ago
neat, now can you try running
scoop install railway3 months ago
now can you try running:
railway --version3 months ago
just to verify that Railway's CLI was installed
this good?
Attachments
3 months ago
yes that is exactly what we needed
3 months ago
Railway's CLI is installed now, so we're almost done
3 months ago
you'll want to run
railway loginand follow the steps
this will log you in on the CLI so you can upload your project, once you're done, run:
railway whoamiso you can confirm you're logged in
3 months ago
perfect, now switching to
you'll want to make a project if you havent already, and then an empty service
3 months ago
we need to do this so we have a destination for your project when we upload it
the empty service will be its destination
3 months ago
perfect, now on window's file explorer you'll want to go to your project files
3 months ago
right here
3 months ago
once you're there, do you see this top bar?
mine says "Downloads/SomeProject", yours will say something else
Attachments
3 months ago
you'll want to click on it, erase everything and type cmd
3 months ago
this will open command prompt on the destination of your project
3 months ago
now just to make sure we're on the right location, try typing dir in there
3 months ago
then make sure it shows your main.py, requirements.txt and so on
3 months ago
we dont want to accidentally upload your entire computer to railway, we just want your project, so its important we make sure its at the right location
its showing this instead
Attachments
3 months ago
ah, you're on your C drive, good thing we checked, that would unironically have tried uploading your entire computer 💀
3 months ago
I'm not sure how that happened <:Thinking:1360710341239242762> it should've opened command prompt at your project's location
should i replicate file and move the entire thing in a separate location?
3 months ago
no matter, can you go back to your project folder and then do the same thing I asked you before but instead of erasing everything and typing cmd, just copy it
3 months ago
no no you're fine
3 months ago
if the file path itself isn't sensitive, could you paste it here?
3 months ago
🤨 .zip
3 months ago
is that the folder's name?
3 months ago
yea you're gonna need to unzip that first
3 months ago
awesome, and that Attendance folder holds your main.py and requirements.txt right?
3 months ago
my bad, im back, had to go help a friend with something
3 months ago
now go back to command prompt and type:
cd C:\Users\X-Game\OneDrive\Documents\UKM\Attendance3 months ago
this will take you to that folder
3 months ago
feel free to run dir again to make sure you see main.py and requirements.txt
3 months ago
nice
3 months ago
now, you can run railway link
3 months ago
run through the steps and select the empty service we created earlier
3 months ago
once you've done that, you can run railway up to upload your project to railway
3 months ago
yea
this is what im seeing after typing it
Attachments
3 months ago
yea you're gonna wanna select the project you created earlier
3 months ago
which i assume is that one right there
3 months ago
then the service you created earlier
done <:salute:1137099685417451530>
Attachments
3 months ago
niceee
3 months ago
now final step
3 months ago
railway up3 months ago
to upload it to that service
3 months ago
then you can go back to the UI and watch it deploy
3 months ago
hopefully Railway will automatically detect the project structure and you wont have to do anything else
3 months ago
but otherwise if it fails we might need some more manual configuration
tysm for guiding me through it step by step i heavily appreciate it <:salute:1137099685417451530>
3 months ago
it's no problem at all
3 months ago
im just happy i could help
3 months ago
the bot as well?
3 months ago
nice congratulations on hosting your first college project
3 months ago
I'd heavily heavily heavily recommend learning GitHub and using GitHub for future deploys, it's the standard way to not only store your projects but also deploy them to any other hosting service like Railway
3 months ago
but for now the CLI should work fine, if you update your code then just run railway up again
3 months ago
(make sure you run it from a command prompt that is set to your project folder)
oh sorry one last thing is there any way for me to stop/pause it? I don't want to use up all my free credits in one go <:mildpanic:804271964587819059>
3 months ago
there's no way to pause it through the UI unfortunately, but you can achieve the same thing by going to the service on railway's website, clicking on the 3 dots and clicking "Remove" - if you ever want it running again you can just go to the removed deployment, click on the 3 dots and click "Redeploy" (or just run railway up again)
ok thats it for me again tysm you've been really sweet <:salute:1137099685417451530>
3 months ago
I'm happy I could help 🙂
Status changed to Solved dev • 2 months ago