a year ago
Hello
I'm having trouble finding information about deploying Django REST backend and React front end on Railway.
Could someone shed some light on this for me?
Thank you
0 Replies
a year ago
okay, go into that service and remove the custom domain
a year ago
then delete the entire service
a year ago
then create a new project, with an applicable name "My Portfolio"
and an empty service within that project, name it as well
then add your custom domain to it, setting up the cname as needed
then deploy your code to it
Ok, can we just do that later ? Because i'll have to connect to cloudflare, i don't remember exactly what i did to set up the proxy so it's maybe going to take a while
a year ago
sure we can do that later, for now we will ignore the portfolio service
a year ago
did you have a custom domain for this new app? or where you just going to use the railway provided domain for now?
no because i have to see with my client for the custom domain so i was just going to use the railway domain
a year ago
gotcha
a year ago
okay go and generate a domain, this will be the backend's domain so name the subdomain applicably
a year ago
what do you have in mind for the frontend railway domain?
musiquizapp.fr for the custom domain name
a year ago
thats a custom domain? you said you didnt have one yet
a year ago
ah gotcha
a year ago
okay the service now has that domain?
a year ago
did you commmit the railway.json to the repo?
a year ago
okay in the service settings, set the root directory to /Back-End
a year ago
add the repo to the service
ok just one thing tho. In media, i wasn't able to download all the audio files that are needed for the game. For now they are on the media file on my computer. Will we be able to bundle them with all the other files for the deployment ?
a year ago
how much audio do you have size wise?
a year ago
is this dmca free audio or do you have the rights to it?
a year ago
doesnt sound like something you should be uploading to github then, especially when the repo is being deployed to railway.
look into a cdn you can upload the media to, but thats slightly out of the scope of this thread
what if i use the cli in vs code to deploy the project ? The files are in the folder. That's what i did for my portfolio but only had images
a year ago
railway does not want you uploading/playing/using music you dont have the rights to, thats why music bots are a big no no and often get people banned
a year ago
id strongly recommend you host the music elsewhere on a cdn, just dont want you getting banned
a year ago
thats also far more data than you can railway up to the service (max 40 or 50mb i forget the exact number)
Ok so like if i host the samples on soundcloud for example, then i'll just have to modify their address on the db and it'll be good to go
a year ago
sounds about right, dont know if soundcloud would like that, but as long as its not on railway im good with it
a year ago
sounds good, but in the mean time, would your backend fail to deploy without those audio files?
a year ago
okay are you gonna update your code and then after that continue with the railway deployment?
He said that he will download the songs on soundcloud but doesn't know when. So i think i'll wait until he's done it to continue. I'll send you a DM, is it ok for you ?
a year ago
we can continue this thread when you are ready
a year ago
you can ping me here
a year ago
no problem!
Hey Brody, the music is hosted on a CDN, we can continue if that's ok for you !
a year ago
haha sure, but unfortunately im not available right now due to some irl stuff
a year ago
I am now
a year ago
where did we leave off
a year ago
hey @Dadz did you still need help with this?
Hey Brody, yes i do, don't know why i didn't receive the notification of your answer
a year ago
no worries
a year ago
lets pick up where we left off
a year ago
did you share your github repo with me?
I tried to deploy, i was missing pillow and python-dotenv in requirements.txt, i'm currently trying to deploy again
a year ago
haha okay let's slow down a bit
a year ago
let me get caught up before we try things again
a year ago
can I have a screenshot of your railway project canvas
a year ago
haha every screenshot but none of them are the project canvas
a year ago
going forward these cropped screenshots are not the best, can you please send full screenshots of the browsers viewport, I can always zoom in if I need to
a year ago
for all I know you could very well have a 3rd service off the to the left of those two
Ok i didn't think the other services would matter as they don't link to MusiQuiz. Here you have the full screen
a year ago
every little bit of information matters
We discussed about the fact that i had the database for MusiQuiz set up in my portfolio project (a mistake) and decided to keep it that way because the db had data so it would have been better to move the portfolio but as i have a private domain name with cloudflare as a proxy it would take too much time to remove the custom domain
a year ago
okay so would you be interested in adding me to both of your railway projects (for the portfolio and music quiz) and your github repo for music quiz? that way i can make all the changes needed without the back and forth
The thing is i would like to understand the changes so that i'll be able to deploy this type of configuration by myself in the future
a year ago
fair enough
a year ago
then we shall walk through it
a year ago
so what was the situation with the database again?, does both your portfolio and musicquiz app have data on that same database?
a year ago
can we remove the music quiz service from the project then? and start fresh in a new project
a year ago
well you said the database is only used by the portfolio, so you dont need to touch it and it can stay in that project
a year ago
oops, my bad
a year ago
so we can move the portfolio to another project, since its easier to move an app service than it is to move a database
Yes that is what you told me last time we talked but remember i asked you if this was necessary as moving the portfolio project would require to remove the custom domain and i didn't remember what i did exactly to set up the proxy so it would maybe take a while. You told me then let's ignore the portfolio service
a year ago
you wouldnt actually need to do any dns setup given the fact that you have already done the dns setup once
a year ago
just remove the domain from old service and then add it to the new service, and it will work instantly with zero dns setup, at least it always has for me
Ok that's done but i get Internal Server Error for the first version of the portfolio
a year ago
check its logs?
a year ago
okay now you can remove the domain from the old service and then add it to the new service, ignore any dns setup as it is not needed
a year ago
okay now you can remove those two old services and rename the project
a year ago
you didnt
a year ago
ignore any dns setup as it is not needed
a year ago
it will work instantly with zero dns setup
a year ago
yes, but it wasn’t strictly needed, no harm either way though
a year ago
i was just trying to simplify the process for you by telling you it wasnt needed
a year ago
can i have a screenshot of the project now?
a year ago
perfect
a year ago
rename that service to MusiQuiz - Frontend
since it will be the frontend service
a year ago
and then add a new empty service that is named MusiQuiz - Backend
you get the point 😉
a year ago
the domain name would suggest otherwise
a year ago
frontend domain -> [musiquizapp.up.railway.app](musiquizapp.up.railway.app)
backend domain -> api-[musiquizapp.up.railway.app](musiquizapp.up.railway.app)
at least until you add your custom domains
a year ago
let me know when you have that done!
I'm solving a lot of issues since my last message haha, serving of static files for django rest, fetching the right api, chunks of code i forgot to push on my git hub repo, and now i'm struggling on Django Admin Panel CSRF token validation
a year ago
okay no worries, let me know when you are ready to proceed, just make sure you arent trying to get django to serve the frontend
a year ago
you have your frontend and backend running as seprate services?
a year ago
what have you done to not run your frontend as a dev server?
a year ago
then you are likely running a development server for your frontend
a year ago
thats going to cause random issues and cost a lot when running on railway
a year ago
https://github.com/brody192/vite-react-template
Copy the nixpacks.toml and Caddyfile from this repo into your frontend folder.
If you have any build or start commands set in the frontend's service settings, please remove them.
a year ago
and let me know if there any issues with the new deployment
a year ago
full build logs please
a year ago
can you link your repo again?
a year ago
why do you now have two seprate repos?
a year ago
oh i see what i did wrong
a year ago
i linked you the wrong repo
a year ago
use the nixpacks.toml and Caddyfile from this repo instead
a year ago
show me the source settings you have on your frontend service please
a year ago
in your railway service
a year ago
i dont even know how thats working
a year ago
set the root directory to /Front-End/musiquizapp/
a year ago
wrong directory
a year ago
i think so haha
a year ago
happy to help