Application is not responding?
Hi guys!
I'm trying to deploy my personal project using Railway and I'm running into some trouble.
It was working perfectly fine and then.. it's not responding anymore and giving me an error sign.
Github repo: https://github.com/marchingkoala/Doggle
Project ID: 1efb1a40-f8f8-4c10-9633-10f48a4d8e7e
If you see my history, you can see I went back and forth using the full railway psql url and .env way. It would work when I used process.env instead of the full url WITH commented out url underneath for some reason but when I remove the commented out line, it would break.
That's probably purely coincidental and not the real problem. Anyway, after all that, it was working and now it's broken again. I'm really stumped on this. Can someone take a look and help out a newb?
Thank you
GitHub
GitHub - marchingkoala/Doggle
Contribute to marchingkoala/Doggle development by creating an account on GitHub.
63 Replies
Project ID:
1efb1a40-f8f8-4c10-9633-10f48a4d8e7e
1. you do not want to use nodemon when running your app on railway
2. please show me a screenshot of your railway service variables
Hi Brody. Thank you for commenting. Oof, I did not know that I could not use nodemon 😦
I checked the variable option and I have none. Is this the main source of problem?
well you can use nodemon, but on railway it's just a pure waste of resources and can cause instabilities. it's only meant for local development purposes
show me a screenshot of your full browser window of the railway project
Sorry I'm not sure what screenshot you are asking for... screenshot browser screenshot of the same thing?
omg I'm sorry
fixed
like this?
yeah that's it
okay so where's the database lol
oh.. it's..in a different project. in 'glistening-bikes' God these names are horrible lol
I...can't do that?
you can change the names lol
but yeah you want the database in the same project
OH
I am an idiot sandwich
and then you will want to setup the variable references for the database
https://docs.railway.app/develop/variables#reference-variables
I didn't know you can add the database in the same project
is it there you can add the database? '+environment'?
not quite, close the service and there will be a New button at the top right
omg
OMG
THANK YOU
ok so this is why 😂
so show me a screenshot of the service variables now?
does it look correct?
i selected DATABASE_URL and then pasted in the url in the value slot
it's not correct unfortunately
you will want to setup the variable references for the database
https://docs.railway.app/develop/variables#reference-variables
but you do have the database in the same project now, so that's progress
when you say set up the variable references, you mean I just add that in without changing anything? I don't have to copy paste the url where `${{}}' is?
I'm sorry for asking so many questions
if you used the drop-down on the left to achieve that result, then yes that's correct. with variable references you do not need to copy paste anything
no worries at all, that's what this channel is for! railway help 🙂
OH. ok. last time, I used the drop-down and copy pasted the url
let me try this and see what happens
just as a sanity check, screenshot again please
haha i love a sanity check
second screenshot is good
now are you using that same name for the database variable in code?
yes
perfect
huh. I'm still getting an error
at least it's a different error tho
my db in raiway has no tables for some reason
well yeah you just made a brand new database
is there a way to move my already set up local db into it?
not from within railways ui, you want to use the two cli tools pg_dump and pg_restore, but I don't know the exact commands you would need to run surrounding those cli tools, however I'm sure someone has made a friendly guide for those two tools
just do a little searching and I'm sure you will find a good tutorial
ahhh ok. yeah I really don't want to start from the scratch
thank you so much Brody!
I will dig around!
dbgate also has a data exporter tool that may be able to copy tables from one database to another, but i still don't know the exact procedure for that, it may be an option if you want a gui based tool instead of a cli tool
sounds good. I'm sure either here or stackoverflow will have an answer for me
Thank you 🙂
I do have a small question. it's weird because the previous db I set up in the separate project did have all my tables
I did set that up a long time ago. maybe I did some kind of data dump and forgot...
oh you have a seed command
i used npm run seed on my local
that would create your tables at least
now you will want to use the railway cli
railway run npm run seed
no local .env files neededdo i need to set up a script command? or just copy paste railway run npm run seed straight into the terminal?
the railway cli command I gave you would be just ran in the terminal
ok.. I'm getting an error in my terminal
well you do need to install the railway cli
https://docs.railway.app/develop/cli#installation
rename your current start script to
dev
and add a new start
script node server/index.js
ok...
and you would also need a proper build command, not sure exactly what that would be with webpack, but make sure it does not watch for file changes
i installed it and ran the 'railway run npm run seed' and it's asking me to login?
of course it is
ugh I'm so sorry that i'm so new... this is getting harder than I thought haha
yeah this can all be a bit much, so no worries, take your time
omg
IT'S WORKING
OMG
SCREAM
Brody!!! Thank you so much!!!!!
now just fix up your scripts, add a proper build and start command
right now I have this.
so instead of 'build-watch', just do 'build'?
no build-watch is for local development, leave that
you need a new build script
...I'm gonna have to google to learn how to properly build that
I have to go help make dinner now but I will come back to this
it's probably just
webpack
lol
without the -w
flag, since I'm guessing that starts some type of file watcher, and you don't want to run a file watcher on railway because of the whole using unnecessary resources and instability thingLol that was so simple. Thank you. I learned so much with you
im not sure thats just a guess, id never use webpack myself
or at least directly like you are