R
Railwayβ€’10mo ago
CookieMonzteh

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. πŸ‘
No description
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...
Jump to solution
21 Replies
Percy
Percyβ€’10mo ago
Project ID: N/A
CookieMonzteh
CookieMonztehOPβ€’10mo ago
N/A not sure where id even find project id
Brody
Brodyβ€’10mo ago
go to the service settings of your backend service and generate a domain
CookieMonzteh
CookieMonztehOPβ€’10mo ago
Did that, however when I do that and go back to my environment variable for some reason generating a domain removes port and host
CookieMonzteh
CookieMonztehOPβ€’10mo ago
No description
CookieMonzteh
CookieMonztehOPβ€’10mo ago
which im assuming I need for this no?
// Railway
export const sequelize = new Sequelize("railway", "root", process.env.MYSQLPASSWORD, {
dialect: "mysql",
port: process.env.MYSQLPORT,
host: process.env.MYSQLHOST,
define: {
freezeTableName: true,
timestamps: false,
},
});
// Railway
export const sequelize = new Sequelize("railway", "root", process.env.MYSQLPASSWORD, {
dialect: "mysql",
port: process.env.MYSQLPORT,
host: process.env.MYSQLHOST,
define: {
freezeTableName: true,
timestamps: false,
},
});
Brody
Brodyβ€’10mo ago
please send uncropped screenshots
CookieMonzteh
CookieMonztehOPβ€’10mo ago
not sure what that means? you mean fuller like this?
CookieMonzteh
CookieMonztehOPβ€’10mo ago
No description
CookieMonzteh
CookieMonztehOPβ€’10mo ago
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
Brody
Brodyβ€’10mo ago
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
CookieMonzteh
CookieMonztehOPβ€’10mo ago
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
Brody
Brodyβ€’10mo ago
thats not your backend though, thats the database, you should not be modifying anything about it
CookieMonzteh
CookieMonztehOPβ€’10mo ago
oh? so you have to make a db and then another container for the backend code?
Brody
Brodyβ€’10mo ago
yes correct
CookieMonzteh
CookieMonztehOPβ€’10mo ago
that explains alot lol lawd
Brody
Brodyβ€’10mo ago
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)
CookieMonzteh
CookieMonztehOPβ€’10mo ago
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
Brody
Brodyβ€’10mo ago
well yeah thats one of the issues if you run a frontend, backend, and database on railway you would need 3 services total
CookieMonzteh
CookieMonztehOPβ€’10mo ago
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 πŸ™
Brody
Brodyβ€’10mo ago
no problem!
Want results from more Discord servers?
Add your server