Deploying a website
How can I deploy Vite + React website on Railway? I already have an existing repository on GitHub.
63 Replies
Project ID:
N/A
can you share the repo?
It's private
I can send you screenshot of its structure if you want
send the Dockerfile please
This one's used for backend
use this dockerfile, but move it to the backend folder
Railway will detect it even tho it's in backend folder?
nope, go into the service settings and set the root dir to
/backend
Okay, what about website itself?
The one in frontend folder
we will, one thing at a time
what kind of python app is this btw? im worried you might be running it in development mode thus increasing your running costs and lowering performance
Flask right now but will switch to waitress once it's fully ready
I am just testing it for now
okay then in that case for your future referance you would need to use a start command like this
the
--listen=*:$PORT
is the most important
and to give me a better idea what you have going on, can i see a screenshot of your railway projectSo instead of
CMD ["python3", "main.py"]
, that?
Which part exactly?correct
the railway project, a screenshot of the browser window if you dont mind?
Also I assume I should change
$PORT
to 8080
rightno, you want
$PORT
aha okay
oh you are already using waitress?
Yeah I am
whats your new start command (CMD)
It's all working fine, backend wise
perfect, then we can move on to the frontend
you will need to create a new railway service in the same project, and set its root dir to
/frontend
Okay, sec
https://github.com/brody192/vite-react-template
you will also need to copy the nixpacks.toml and Caddyfile from this repo into your frontend folder
done
and whats the verdict?
wdym
I still don't have Dockerfile in frontend set up if that's what you mean
does the frontend work?
you dont need one?
Oh
Give me a second
new service
set
/frontend
root dir
copy those two files
add repo
No idea why is it mentioning Docker tho
in the future, use this https://bookmarklets.up.railway.app/log-downloader/
railway uses docker for all apps, and will automatically generate a dockerfile for you
as for the error, make sure you have your dist and node_modules folders in your .gitignore file and not in the repo
And error is still the same
make sure those folders dont exist in the repo on github
Oh right my bad
its
node_modules/
btwNow I am getting this
As for this site, it's not working for me for some reason
When I go to it it says "This site is designed to be used with Railway"
please follow the instructions on the page
Yeah I did, is there some video explanation?
no sorry, its only 3 steps
Can you take a look at screenshot while I try to figure it out
make sure your files are cased correctly, github does not seem to normally track a filename casing.
you could be importing
Logo.jsx
just fine locally, but on github the file could be called logo.jsx
It was working fine until I deleted node_modules from github repo
If you're on Windows, for instance, you could be able to import it case-insensitively locally
make sure the file is named
Logo.css
and not logo.css
coincidence haha
.jsx
.css
look at the error
interesting
Yep, that's the problem. Rename
logo.css
to Logo.css
.he can’t it wasn’t downloaded with the bookmarklet
Brody isn’t allowed to look at screenshots, that’s why he always asks for the bookmarklet
i mean you arent wrong, if it wasnt a blurry image i would have seen it lol
Random question, but why can't you see images?
adam is joking, i can see images, but unless i look at the image in the browser, the image is small and i miss stuff
thats why i am adamant about using the bookmarklet
Aha
Well, looks like it's working now
Thank you so much 😄
no problem!