2 years ago
So im either slow and or the documentation doesnt do a good job of describing whats going on and its very confusing to me. Im currently trying to setup my monorepo and the way I have my project setup is like so with the image ive attacheched. This would fall under a shared mono repo and Im trying to follow the docs and it says to run a custom start command like nom run start:backend but I dont understand what that means or how it works. The way my project currently works is I run npm run start for my frontend and npm run dev for my server so I assumed id just add 2 start commands but thats not the case?
"scripts": {
"start": "react-scripts start",
"dev": "npx nodemon server.js",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},Im extremely new when it comes to hosting and deploying so it feels a bit all over the place in trying to understand these things and it seems like the docs take you from one link to another very frequently rather than having everything you need on a page and its kinda overwhelming and hard to understand so any resource, docs, or explanation for setting something like this up would be very appreciated 🙏
571 Replies
The way im somewhat understanding this is that you make 2 seperate services using the same monorepo but im guessing and i dont want to just be guessing
2 years ago
the documentation doesnt do a good job of describing whats going on
it really doesn’t, the documentation on mono repos of any kind needs a lot of love, its absolutely not you.The way im somewhat understanding this is that you make 2 seperate services using the same monorepo but im guessing and i dont want to just be guessing
you have guessed correctly, two services, from the same repo, and you would set the start commands (in the service settings) to the applicable command for what you want that service to run.
2 years ago
only issues im seeing here is that your start script for the frontend starts a development server, this will have very poor performace and use quite a lot of resources.
same with the dev script for the backend, you never want to use nodemon in production.
the whole reason i went back to using my mono repo was so i didnt have to do this 🤦♂️
ive been working for weeks trying to get my project thats pretty much already done hosted and its been such a nightmare
2 years ago
two apps need two railway services
so just to clarify my ignorance…theres no such thing as a single full stack hosted service anywhere? or is that just in railways case?
2 years ago
there is, but your frontend and backend are two apps, even if they share types, so they need two services
currently I technically already have 2 services setup, my backend is on railway and front end on netlify…but ive been having a bunch of cors issues and a guy thats been helping me told me to use the mono repo I had before and setup a proxy so I dont have the issues that ive been having
2 years ago
yeah you still need two services for that, we can setup a proxy if thats what you would like
2 years ago
yeah just give me a second cuz now I have to rethink and understand a bunch of stuff, imma check the link rq
2 years ago
theres really not much you need to do to get your mono repo deploying on railway, you are just starting dev servers, and not doing that is an easy fix
2 years ago
the link is what your project should look like (maybe minus a database)
2 years ago
(i have a template for the proxy)
Oh yeah no thats not the issue at all, its just I started trying to work in a way that allowed me to use a single service for this so I could use creact react apps proxy because the way i was previously working before was how you mentioned but the guy helping me just told me that having them split up like that makes everything harder which I could honestly verify because ive yet to get my sessions, cookies, and cors issues to work.
"if everything is in the same project (ie one git clone will give you everything you need) then you can do a multi-stage docker build that build your frontend and then pass that to the backend as static assets to be served as part of the api
and that approach will also make it easier to diagnose locally since you can run the build on your own computer and do a production build to make sure it works properly before handing it to railway"
2 years ago
yes you can have your backend serve the frontend, that is certainly one way, personally its not something i would do
because doing it that way hasnt worked for me and I dont know why so doing this is at least progress towards something
2 years ago
three options
two railway services
two railway services + a proxy
one service - serve the frontend from the backend
2 years ago
you pick, ill help with whatever you pick
2 years ago
what option?
2 years ago
good choice
2 years ago
of course
does it have to be 2 railway apps specifically? because like i mentioned earlier I already have a bakcend service and my frontend is on railway so its still 2 services but one of them in netlify? does that matter for setting up the proxy?
2 years ago
did you want to keep the frontend on netlify?
it doesnt make a difference to me tbh but id maybe lean to keep it there because I wanna keep my cost down on railway id guess
2 years ago
keeping it on netlify would have the reverse effect, since if kept on netlify you will be charged extra egress from the proxy communications to the off-site frontend
oh? so it would cost more not having it in railway…interesting. I always see that word egress but didnt know thats what it meant
2 years ago
it would also have far more latency
2 years ago
egress is the amount of data out of the network
interesting, guess that makes sense. I thought storage would have cost more but goes to show how little i know lol
2 years ago
the frontend doesn't use any charge-able storage on railway
2 years ago
you will need to make some changes to your repo though, because as mentioned before, you are running both the frontend and backend in development modes
2 years ago
we want to save money here not burn it
2 years ago
the less resources your services use, the cheaper they are to run
oh yeah you mentioned alot of stuff earlier about not using nodemon and whatnot
2 years ago
share or add me to your repo and I'll see what changes need to be made
sry if i didnt catch everything i was talking back and forth with someone
2 years ago
no worries
2 years ago
you have a mono repo, it is only one repo? wdym both?
2 years ago
nope, no VC needed
ahhh, my apologies. I keep confusing people with this so I essentially have 3 repos. one is the monorepo and the 2 other ones are a divide of that mono repo so my frontend and backend. What i currently have hosted is the 2 seperate repos not my mono repo. Should I start from scratch and just use that monorepo instead of the two?
2 years ago
yeah that's quite convoluted, you should remove those two repos designated backend and frontend
2 years ago
then add me to the first repo, my gh username is brody192
2 years ago
unless it's public, in that case just send the link
2 years ago
looking
no worries, im looking over stuff to and trying to make it work again in local dev
2 years ago
dont get too dug in, theres a good chance theres some changes we need to make that might interfere with what you are doing
mmm yeah…. every since i hosted my stuff the singular thing thats given me a problem and even now in local dev is giivng me an issue is user authentications / sessions / cookies…im just at a loss on what to do in that regard.
2 years ago
well this repo is technically a monorepo, its mushed together, this makes both it hard to run both locally and on railway
2 years ago
i can't see how this makes anything easier, there is a right and a wrong way to do a shared monorepo, and this is not what you want to do, we will get you fixed up though
2 years ago
ill try my hand at a pr to get this repo in shape
I gtg to work but ill be back and go over the changes. oddly enough my local dev sessions arent saving either which is the same problemI had when i had it hosted so in a way this could be a good thing or a hint since again its most likely configs
2 years ago
sounds good
if theres any repos or documentation you follow or suggest for how to properly set a monorepo up rather than slapping them all in the root directory like I did lmk to 👍
2 years ago
I just googled how to setup a npm workspace haha
2 years ago
did you see my branch?
was it this? https://docs.npmjs.com/cli/v7/using-npm/workspaces
2 years ago
yep thats it
2 years ago
okay so do you wanna walk through how to deploy my branch?
I think I should quickly look over how all this works rq first, when I finish reading this and going over it ill lyk
2 years ago
sounds good
2 years ago
side note, I tried to separate the two apps best I could, but it's likely that I left bits and pieces of them in either folder, so when you have the time go through and clean that up
2 years ago
of course
for example the
"workspaces": ["./packages/*"]is just return an array of both folder paths? so its essentially a shorter version of?
"workspaces": ["./packages/frontend", "./packages/backend"]2 years ago
correct, there may be a time when you don't want every folder in the packages directory to be a workspace, but we currently do, so a wildcard is easiest
ah wait i just read more oops lol they tell you that down below. Ok yeah this makes sense. The only thing im noticing that im not seeing is this? what are these?
2 years ago
railway does not run a frontend like netlify or vercel, it will run your app as is, and use the default start script, the default start script starts a development server, so that is what railway would run, so we need to provide a custom build plan to download caddy and run it.
nixpacks.toml installs caddy
the Caddyfile is the config for caddy
and the start command runs caddy
2 years ago
this isn't my first rodeo
clearly lol must have been a headache, I just assumed that it would handle it or at the very least recognize that and make a custom build command but i would have never guessed having to manually do this yourself
2 years ago
nope railway is not like that, your code is ran as is, and if it's only setup to run a development server, than that's what will be ran
hmm I think I understand, so netlfy and vercel essentially make it for you but like you said railway makes it as is, so why isnt my backend caddy server.js for example? because node is setting up a backend server therefor node for backend is what caddy is for the front end on build/run commands?
2 years ago
you can think of caddy as a file server, nothing to do with node. its simply serving the built website files
2 years ago
locally?
2 years ago
okay cool, there is a procedure to deploy onto railway, so let me know when you wanna do that
just attempted running it and I think the root package.json file needs a start script
2 years ago
nope
2 years ago
npm run frontend:dev
and npm run backend:dev
2 years ago
please see the commands i have sent here
I meant i get the same error except instead of start its combplaining about the dev
2 years ago
did you change anything? it works for me
2 years ago
nope, it just works for me, show me your package.json from your backend
{
"name": "paragon-app-backend",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@aws-sdk/client-s3": "^3.377.0",
"@aws-sdk/s3-request-presigner": "^3.252.0",
"axios": "^1.2.1",
"bcrypt": "^5.1.0",
"connect-session-sequelize": "^7.1.7",
"html-react-parser": "^3.0.8",
"lodash": "^4.17.21",
"multer": "^1.4.5-lts.1",
"mysql2": "^2.3.3",
"passport": "^0.6.0",
"passport-google-oauth2": "^0.2.0",
"sequelize": "^6.32.1",
"uuid": "^9.0.0",
"web-vitals": "^2.1.4"
},
"scripts": {
"dev": "npx nodemon server.js",
"start": "node server.js"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.22.9",
"nodemon": "^2.0.20"
}
}2 years ago
can you run start
2 years ago
you are running that command from the root right?
yep, you can see the command and the directory in the sc, i tried both start and dev and get that error
tried npm installing to make sure and restarded and yep i still get them,
imma see if i can figure it out but i think its most likely something do do with this
2 years ago
it still works for me locally, something is misconfigured on your end, try deleting and redownloading the branch
only other solution im seeing is to delete my node modules and resinstall
2 years ago
cant hurt to try
2 years ago
lmao
just noticed something different but could you screen shot what your root directory looks like
2 years ago
what version of node are you using
2 years ago
ok thats what I thought. Yeah for some reason I had a nodemodules folder in my root, but now mine looks like that and i have one module folder in the frontend and backend folders….still getting that error though 💀 , and the error doesnt give much context
2 years ago
have you tried this?
2 years ago
i saw that too
just so we are on the same page….git checkout -t origin/branch-name is what im doing for that branch?
i might just make a completely seperate local repo and clonse it just to make sure
2 years ago
i dont know, i dont use git cli
yeah no you can only clone from the master branch and get the branches through it
2 years ago
what node verison are you using
2 years ago
im on 18 lts
14 is far too old, please update
2 years ago
or maybe i left it out of the backend's package.json by accident
2 years ago
dont add it to the package.json at the root
there was 1 or 2 missing in the frontend too but i just copy and pasted it in and npm i should work
2 years ago
lets see your package.json in the root please
{
"name": "paragon-app",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"frontend:build": "npm run build -w packages/frontend",
"frontend:start": "npm run start -w packages/frontend",
"frontend:dev": "npm run dev -w packages/frontend",
"frontend:test": "npm run test -w packages/frontend",
"backend:start": "npm run start -w packages/backend",
"backend:dev": "npm run dev -w packages/backend"
},
"workspaces": ["./packages/*"]
}i should have asked for your node version earlier 💀 why that solved it is beyond me
2 years ago
node 14 too old
2 years ago
i dont think thats quite how the saying goes
gonna take like another 2 minutes prob to fix these files cuzz i remember having to fix them when i split up my repos like this
hmmm… question..I need 2 env files in each of these instead of in my root directory dont i?
2 years ago
what are the env files for
app.use(
session(
// secret is used to sign the id session cookie
{
name: "user-session",
resave: false,
saveUninitialized: false,
secret: process.env.SESSION_SECRET,
store: myStorage,
cookie: {
maxAge: 1000 * 60 * 60 * 2,
sameSite: "none",
secure: inProduction
},
}
)
);2 years ago
then yeah
aaaaand theres a node_modules folder in my root again for some reason….I think its being carried over from my master branch?
2 years ago
i dont think its a problem tbh
2 years ago
whats wrong with the frontend
seems like a package issues thats now broken of course. gotta get rdy for work but repo wise its working. After i resolve that and whatever comes up ill lyk when its rdy for deploy. Thanks again fam, not many people will take the time to do this and im learning alot 👍
2 years ago
happy to help!
alright so I fixed it and both the frontend and backend now work…now im back where I started as far as my original issue…and thats my sessions not saving…im going to go ahead and say this is probably why
Looks like everythings fine, only error im getting right now is this whenever I go to my landing page
2 years ago
haha well what's going on with the manifest?
from what ive searched up it might have something to do with the index.html file…but again its only for the / landing page
2 years ago
well see what the manifest response contains
2 years ago
easy enough to find out what's going on
opened up the project to get the error and all the sudden its not showing me that error anywhere when i didnt change anything….
2 years ago
problem solved
2 years ago
deploy to railway time?
2 years ago
show me your current railway project please
assuming we following the isolated one?https://docs.railway.app/guides/monorepo
2 years ago
nope
2 years ago
okay add a new empty service
2 years ago
after every step please send a screenshot so we stay on the correct track
2 years ago
this is going to be your backend, so give it an applicable name
2 years ago
boring, use capital case and spaces like your database name has
2 years ago
yeah that's for the domain, add a space on either side of the dash, make the name look presentable
2 years ago
okay now we talking
2 years ago
now hit deploy, then generate a domain
2 years ago
now do all the same, but make a frontend service
2 years ago
now what variables does your backend need?
2 years ago
the frontend should have a domain by now
2 years ago
for FRONTEND_URL you would want to use [https://${{AquaPrime](https://${{AquaPrime) - Frontend.RAILWAY_PUBLIC_DOMAIN}}
2 years ago
same idea for all the database related variables
2 years ago
use the reference variable i provided please
2 years ago
make sure you use the same syntax for your database variables
mm yeah i see now, imma have to change my code, for some reason I have it to this
2 years ago
that doesnt matter, you can set your own variable name
2 years ago
you dont need to change anything in code
2 years ago
also, you would likely want to do a REACT_APP_BACKEND_URL in the same way on your frontend so you can use it in code
2 years ago
when you're done setting up the variables, show me (hide things that are sensitive though)
2 years ago
yeah looks good to me, after you deploy the changes you would be able to check if they render properly with the given eye icon
2 years ago
so when you do finish adding the variables, deploy and then check them with the eye icon
```https://${{AquaPrime - Backend.RAILWAYPUBLICDOMAIN}}/auth/google/oauth2callback
```
2 years ago
what service are you setting that variable on
2 years ago
what service are you setting that variable on
2 years ago
if you are referencing a variable from the same service you are setting it on you dont need the service name
https://${{RAILWAY_PUBLIC_DOMAIN}}/auth/google/oauth2callback2 years ago
all variables are done?
2 years ago
we will be deploying the backend code first
2 years ago
on the backend service set the start command to npm run backend:start
2 years ago
attach your repo
2 years ago
then i think thats all, you can then deploy
2 years ago
for the frontend you would need to set npm run frontend:build for the build command and npm run frontend:start for the start command, but lets make sure the backend is operational first
finished, technically didnt fail but alot of errors, I know how to fix a few of them by uncommenting some code
2 years ago
for this error, in the backend's package.json, set the start script to sleep 3 && node server.js
also…wtf is that sorcery? its like a timeout before running the start script?
2 years ago
yeah?
howd you think of having to do that? something the error said? race condition? 🤔
2 years ago
dns not ready
what exaclty is this side of development considered? backend? devops? Feels like a whole new realm the moment i put my foot into hosting more complicated sites
2 years ago
i have no clue 🙂
2 years ago
does your database have a tcp proxy?
2 years ago
well no is a bad answer
2 years ago
we want a tcp proxy in this case
2 years ago
check if your database has a tcp proxy please
2 years ago
wdym?
not sure if that fixes this specific problem but ik it will causes a problem regardless.
2 years ago
maybe
2 years ago
likely because we are installing frontend packages as well as backend packages when deploying the backend
oh really? thought it would just do the backend ones since we are only using our custom start command, or does it run all the commands from the root package.json? 🤔
2 years ago
it runs npm ci at the root, meaning it installs everything from both packages, nothing to do the start command
2 years ago
we can fix that
still get the same error, i went back and lookated the the database environments and the host was weird but i fixed it because i saw a host error but yea still
2 years ago
what did you fix, there should be no need to fix anything as long as you are using reference variables properly
so its connecting to the database but for some reason its having an issue with sequalize syncing
sequelize
.sync({ alter: true })
.then(() => {
runInitData();
})
.catch((err) =>
console.log("error when syncing and or running init data", err)
);2 years ago
i do, but let put a pin in that issue for the moment. lets get the separate install commands working
2 years ago
2 years ago
your backend will now need a NIXPACKS_CONFIG_FILE variable set to packages/backend/nixpacks.toml
set this before you merge the pr
2 years ago
no, its so the backend deployment only installs the backend packages
2 years ago
have you set that variable?
2 years ago
set this before you merge the pr
2 years ago
this is a service variable
2 years ago
what would process.env be used for?
didnt know if it was something that woudl be used in development but I guess its hosting specific
2 years ago
show me the build table at the top of the build logs please
2 years ago
yeah looks good, the new install command is working, are builds faster?
2 years ago
nice
2 years ago
missing some packages prob
possible that it ran faster because it through out an error faster not sure, but now the connected to database log isnt even there, omit still there and a new uuid import error is there
2 years ago
add uuid to your packages
2 years ago
also, dotenv can be moved to dev packages
2 years ago
yes lol
listen you gotta explain to me like a 4 year old if u havent noticed by now just making sure 😂
uncommented my function when syncing sequalize as well to make things cleared, should be a minute
if it keeps crashing imma do more digging myself then get back to u im just waiting now
2 years ago
we don't need to worry about that, please ignore
2 years ago
so does the backend work? open the domain!
i mean technically i get this but its supposed to be like that because i dont use a root route but yeah no it works
2 years ago
that's awesome, test it with postman? or similar? or do you just wanna deploy your frontend now?
2 years ago
is your frontend code setup to use that react app backend url variable?
2 years ago
for everything?
2 years ago
perfect
2 years ago
see this isn't too hard as long as you have your project structured correctly
also that recent pr you made wasnt mandatory right it was just to make builds faster right?
2 years ago
no not strictly needed, just needed so dependencies aren't cross installed
2 years ago
you've opened the Caddyfile right?
2 years ago
well you can always look back, it's in plain English and fully self documenting
2 years ago
on the frontend you will need a variable NIXPACKS_CONFIG_FILE set to packages/frontend/nixpacks.toml
your build command will be npm run frontend:build
and your start command will be npm run frontend:start
2 years ago
yeah you can connect your repo too and then deploy all the changes in one go
2 years ago
unless im forgetting something, but i guess we shall find that out
i need to save our convo somehow by the time this is done, taking notes like sanat clause
2 years ago
its not going anywhere
also i just realized but when i update the repo both of them will redeploy
2 years ago
yeah you can use watchpaths for that
like in their respective nixpacks? quickly glossing over it while i fix deploy issues
2 years ago
in the service settings
2 years ago
no clue tbh, ive never used that feature, you will have to play around
2 years ago
why do you say that?
2 years ago
we dont want caddy to do https, railway handles that
2 years ago
admin endopoint is also useless
2 years ago
send link?
also i have to change some settings in my google cloud console since its in production now one sec
2 years ago
i got the manifest error, but then i did a hard refresh and the error went away
2 years ago
2 years ago
blame cache
deploy is fine but still having some issues that imma see if I can refix rq
resetting client secrets and a bunch of other stuff so this will take a while
Alright so I gave it like half a day in terms of hours to make sure, as far as deploying goes Im 99% sure its fine…but now im back to square one with my original problem with sessions.
// SESSIONS
// When hosting we have to drop expresses way of session storage (store) since it stores it in memory and causes memory leaks and our memeory is finite.
const SequelizeStorage = SequelizeStore(session.Store)
const myStorage = new SequelizeStorage({
db: sequelize
})
// This env variable would only exist on hosted services and not local dev
let inProduction = process.env.NODE_ENV === "production"
app.use(
session(
// secret is used to sign the id session cookie
{
name: "user-session",
resave: false,
saveUninitialized: false,
secret: process.env.SESSION_SECRET,
store: myStorage,
cookie: {
maxAge: 1000 * 60 * 60 * 2,
sameSite: "none",
secure: inProduction
},
}
)
);however I feel like im missing something. This is essentially the catalyst of my problem. This is kind of where i was when I initially started and had my repos split up before we started
definitely feel like im missing something but ive just followed as much of the docs as i could as well as research on cookie / sessions settings to make this work. <:bladerunner:1209570643377528892>
as far as deploying goes though liek i said im pretty sure its done successfuly so I can make another post for this if need be
actually now that I think about it this is the part where everyone was telling me to setup a proxy to resolve this issue and I think we havent set that up yet 🤔
switched to a dev environment where i commented these out for local host and it works
app.use(
session(
// secret is used to sign the id session cookie
{
name: "user-session",
// resave: false,
// saveUninitialized: false,
secret: process.env.SESSION_SECRET,
// store: myStorage,
// cookie: {
// maxAge: 1000 * 60 * 60 * 2,
// sameSite: "none",
// secure: inProduction
// },
}
)
);found this post. I feel like this can be done without a proxy and its just a matter of me missing pieces to this puzzle, Ive had a feeling like I should be able to send a cookie to the browser manually when creating or retreiving a user but idk
2 years ago
you have to remember that your app sits behind a proxy on railway, your app runs in http mode, so it doesn't like setting secure cookies when running in http mode, you want to find a way to let it know that it's indeed being accessed from https, this is usually done by trusting the proxy headers that railway sets
2 years ago
in this case, specifically the X-Forwarded-Proto that railway sets to https
2 years ago
no no it's not blocking anything, I'm not sure how you came to that conclusion
well if the proxy wasnt there then it would just be normal https no? which is why it works on local host and not railway because of the proxy? 🤔
2 years ago
no, and no
2 years ago
no proxy knowledge needed, railway sets that header for you, you just need to trust it's value
2 years ago
you are trying to set secure cookies.
your app will not set the secure cookies when it thinks it's being accessed over http.
trust the X-Forwarded-Proto header that's set to https.
now your app thinks it's being accessed over https.
now you can set secure cookies.
aaah ok, that makes a bit more sense now. I just assumed it would be https autamtically because its a hosted domain
2 years ago
it is https externally, but express doesn't know that unless it trusts the header
2 years ago
express has a really nice guide
2 years ago
app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal']);mmmm ok, it kinda reminds me of cors how you have to specify the domain but in this case you specify that its https and from where 🤔
2 years ago
not quite
2 years ago
wdym?
like would it be from the frontend service or backend service? or is there a universal proxy for railway that everyone uses?
2 years ago
every service that's accessed externally will use a proxy
2 years ago
your frontend already handles this, look into the Caddyfile and there's a line about trusting the proxy
2 years ago
though that is strictly only so you get the correct client IP in the logs, nothing more
2 years ago
just look at the link I sent
yeah thats what im trying to understand 💀 . the main takeaways im understanding is that it changes/adds onto the request about details from the external service?
2 years ago
from the actual request the client made, yes
so in that case then what? after setting that up which im kinda now understanding is for any external thing we just do conditionals in our code checking if its railway?
2 years ago
maybe this will give you a good visual?
this endpoint echoes back all the http headers that the app sees during a request
2 years ago
why do you need code to check if it's Railway, trust the proxy and then set your secure cookies and job done (hopefully)
I think you're over complicating and over thinking this
probably 😂 , mind is trying to make sense of what looks like gibberish rn.
i guess the one thing thats a bit confusing to me is this code even after reading the docs but might just take some time and doing rathern than reading
2 years ago
it trusts the headers the proxy sets, but it only trusts the headers if they where set by a local IP address
imma stick with that explanation and read more after 😂 , trust me you're explaining it perfectly its just gonna take me a second. its building rn so lets cross fingers 🤞
2 years ago
close enough
question while this builds but, is this the norm with most services when hosting? that they sit behind a proxy of that service? liek if i was using vercel or fly.io they would sit behind one or is that just something you have to do your research on?
asking because i would have never gotten this on my own and idk if its common knowledge
2 years ago
yes every similar service would use a proxy, without a proxy there would be no way for the platform to route incoming traffic to the correct deployment
for some reason there seems to be liek this limited amount of resources for this ive felt like but maybe thats just me, any answer id look up would just talk about cookie configs or sessions but never proxies
2 years ago
express is just being picky
2 years ago
picky, but makes sense
you dont understand when i say….ive spent weeks just trying to see this 😂
2 years ago
deployment is easy once you have your code in order and understand how the platform works
bru hand thats the part that scares me, you really have to invest in your hosting service like no other and railway makes alot of things easy for you so imagine fly.io 💀 . coming from using netlify for static sites and comparing it i didnt think this would be the beast that it is but you can correct me if im wrong but im asssuming this is like everything else (language, framework), but after you learn one well enough you kinda understand how to work with others. This is my first time rlly working with a hosting service like this. Definitely made it look easy though. I got so much studying and looking over after this, thanks a thousand man ❤️
unironically I think that adding that one line of code you showed me at the end might have solved my issue when I had it setup the way I did but the structure you showed me is invaluable too 👍
2 years ago
yeah railway definitely has more of a learning curve than something like netlify, but that's just because you can run so much more on railway, and that's in part why railway doesn't just figure it out for you, because the scope of what railway can host is far too broad
yeah thats why i always assumed 😂 but after doing all this it makes sense because its made to be flexible
2 years ago
exactly, railway is flexible, that's why you need to provide a way for railway to properly host the frontend site, by getting it to install caddy and have caddy actually serve the built site files
im probably just gonna look and stare at this screen in aw for a few minutes. 😂 , I have some questions about my sesson store but imma wait on that and make a seperate post cuz i wanna soak all this in.
2 years ago
but accidentally running a development server on railway is something that is incredibly common, and unfortunately if left unchecked would end up in a $5+ bill just for the frontend service
2 years ago
that's around 600mb of ram, and what's your frontend using? sub 20mb?
yeah thats another side of it too that I have to learn. Is there a doc or forum you follow that tells you things like this as far as cost effectiveness for hosting services? 🤔
2 years ago
more so about a rule of thumb, don't run development servers
2 years ago
but the alternatives are a case by case basis, and I only have experience with caddy
2 years ago
caddy for website hosting is definitely the most user friendly, so it works quite well
2 years ago
have you checked out the metrics service tabs?
nope lol I havent had a need to because ive had nothing in my project other than the database usually, am now tho
2 years ago
yeah what about it?
shouldnt the network be inbound because the backends on railway? or am i reading that wrong <:thonk:969365165688635464>
2 years ago
network traffic goes both ways, in and out
imma take a quick break and then start studying this and messing with the application. Im not a wiz yet but if you need to learn how to make a mean chicken stew im your guy 👍 😎
2 years ago
I like chicken