Help understanding how to connect domains
Hey yall. Im currently having trouble understanding how to get my railways apps domain. It seems a bit unclear to me.
My project is backend and its just for mysql and im trying to connect my backend url to the front end however I dont know exactly what information to use.
I go to my settings and check the public network however I dont know what exactly im supposed to do with it. If i copy and past it nothing happens and I get errors. Help explaining this to a fresher would be heavily appreciated. π
Solution:Jump to solution
why are you modifying the environment variables of the mysql database?
you typically leave everything about mysql untouched, then create a new service where you deploy your code...
21 Replies
Project ID:
N/A
N/A
not sure where id even find project id
go to the service settings of your backend service and generate a domain
Did that, however when I do that and go back to my environment variable for some reason generating a domain removes port and host
which im assuming I need for this no?
please send uncropped screenshots
not sure what that means? you mean fuller like this?
im not sure why those 2 variable specificlly get turned into an empty string after generating a domain but am i supposed to just make the port 3306 and themsqlhost the domain url that was generated or do something else?
Solution
why are you modifying the environment variables of the mysql database?
you typically leave everything about mysql untouched, then create a new service where you deploy your code
I havent, thats what im saying. after I generate a domain they change. This is like the 5th time ive restarted trying to do this. Im kinda new to this whole hosting thing So I dont understand that much. I just know I need to connect the environment variables given to me by railway in my code snippet I showed above, and then add my other backend variables to railway. My main problem has been trying to get a connection to my backend with the domain url.
So im just using one container for mysql, and I have netlify running my front end
thats not your backend though, thats the database, you should not be modifying anything about it
oh?
so you have to make a db and then another container for the backend code?
yes correct
that explains alot lol
lawd
but you have for sure broken that database beyond reasonable repair by now, so best to delete it and make a new one, and then also make an empty service for your code (in the same project)
so wonder it wasnt working, I was trying to use a domain to connect to a database ffs π
are there not docs that go over this very thing that im missing? I feel like I remember doing this but i thought that was because i ran my frontend on there and thats why i had 2 containers
well yeah thats one of the issues
if you run a frontend, backend, and database on railway you would need 3 services total
Yeah my slow self thought you could do the db and backend in one but yeah no that makes sense
should put me on the right track, ill post again if something comes up. thank you @Brody π
no problem!