2 years ago
environment variables
DATABASEURL REDISURL
Is this correct or should I specify the value from the database and redis ?
99 Replies
2 years ago
that looks correct to me, although one thing to keep in mind is that you're using the public url of the databases which will result in egress usage, you'd typically want to use the private_url when possible but this should work nonetheless
I understand well, it can show that this is a link to the created database.
Please tell me, I can’t change the region in any way?
I need to be in Asia because I’m from Kazakhstan. I'm not going to change it after that.

2 years ago
yea, unfortunately regions is a feature limited to Pro Plan at the moment
OK !
I hope this doesn't affect the speed too much.
In any case, I'll test it for now. Perhaps in September I will be able to develop an application-website forum and then I will choose a plan and choose Asia for myself)
2 years ago
Sounds good, best of luck
2 years ago
if you want to expose your service to the internet then you can go to your service settings and generate a domain for it ( or add a custom domain )
once you've done that then your app should be live on that domain
although one thing to note is that your app should be listening on the port that Railway provides which can be found in an environment variable called PORT
in nodejs you can get the port by doing something like this:
ok, I think I did everything according to the guide, but so far I don’t see anything on the link

2 years ago
mind sharing your link?
oh everything worked! you just had to wait!
THANK YOU VERY MUCH ! I'M SO HAPPY !
I WISH YOU ALL THE KINDEST AND BEST THIS DAY AND THIS YEAR!
THIS IS JUST GORGEOUS! THANK YOU !
Now works
https://stroyberymedusabackend-production.up.railway.app/app/login
2 years ago
oh, awesome!
Can I ask for more? Am I doing everything right?
More likely, what am I doing wrong? I want to install a new user for the admin panel


2 years ago
for the first one, you're supposed to run railway link, this will lead you through a few steps where you can select which project to use
2 years ago
the second one, idk, i've never used the medusa CLI before ( i didn't even know that existed )
2 years ago
seems like you're on the right path
2 years ago
oh hold on though, what do you mean by this? " I want to install a new user for the admin panel"
2 years ago
Railway doesn't allow for SSH access unfortunately
2 years ago
there's no way to directly interact with your container
In Medusa you need to write the command npx medusa user --email admin@medusa-test.com --password supersecret
in cmd so you can log into the admin panel
I can’t figure out how to connect to the cmd of my project to write this command
2 years ago
even if you could, it wouldn't be much help, your app doesn't run in a traditional VM on Railway but rather an ephimeral container
so anything you do in that container is going to be wiped when you redeploy your project
https://docs.medusajs.com/deployments/server/deploying-on-railway#deploying-with-the-backend
but in the official documentation at the end it says to do this..

2 years ago
ooh i see, sorry I'm unfamiliar with medusa, let me skim through the docs real quick
2 years ago
it creates a new user on the database, that makes sense
2 years ago
I can’t figure out how to connect to the cmd of my project to write this command
On railway there isn't really anyway to run commands in the container of your projectrailway run runs a command locally but with the same env as your railway project
I don't understand, did I miss something?
It's like it goes into the railroad, but then it does it locally on my PC..

2 years ago
yea, like I said here, railway run runs a command locally but with the same environment variables as your railway project
https://discord.com/channels/713503345364697088/1097967314655268925/1098005657258578070
There was a similar task here, but he somehow managed it, as I understand it
2 years ago
yea right now I'm trying to figure out why you're getting this error

2 years ago
do you have a database connected to your medusa service?
2 years ago
dang
2 years ago
yea I'm completely out of ideas, I did find
although the solutions there seems like workarounds instead of actual solutions, although maybe some of the workarounds will work for you
2 years ago
I have no idea why you're getitng that error, it's an issue with Medua CLI though
2 years ago
about this same error?
Maybe.
Please tell me this column, is it related to the fact that I connected the database incorrectly?
This is the value for 2 or 3 days
Seems strangely big

2 years ago
Definitally seems like it yes, do you need help correctly setting it up?
2 years ago
Alright, mind opening your own thread?
2 years ago
ooh wait
2 years ago
this is your thread 🤣
https://docs.medusajs.com/deployments/server/deploying-on-railway
I'm working with this
2 years ago
In the service you're connecting Postgres to, in this case "stroyberyMedusa…"
could you go verify that your database variables still look like this?

DATABASETYPE=postgres PGHOST=${{Postgres.PGHOST}} PGPASSWORD=${{Postgres.PGPASSWORD}} PGPORT=${{Postgres.PGPORT}} PGUSER=${{Postgres.PGUSER}} PORT=9000 REDISHOST=${{Redis.REDISHOST}} REDISPASSWORD=${{Redis.REDISPASSWORD}} REDISPORT=${{Redis.REDISPORT}} REDISUSER=${{Redis.REDISUSER}} REDISURL=${{Redis.REDISURL}} CACHEREDISURL=${{Redis.REDISURL}}
STORECORS=/vercel.app$/ ADMINCORS=/vercel.app$/
MEDUSABACKENDURL=https://stroyberymedusabackend-production.up.railway.app
DATABASEURL=${{Postgres.DATABASEURL}}
2 years ago
oh, cool, that works too
2 years ago
I changed your public database URLs to private URLs
My only concern is that you also seem to specify parts of the connection string as well (PGHOST, PGPORT, REDISHOST, etc..)
The problem is that railway doesn't show the service variables for private urls connection parts by default
if you're using those individual parts to build a connection somewhere in your script then it's possible you'll still be connected over the public network
there is of course a way to show the private connection string parts in a database but that would involve using a different service for the database which may take some more work to set up, and I'm personally unsure of how to transfer data between such services (I'm not all that knowledgeable about databases)
Do you know if you're using those individual connection parts to connect to the database or do you use the entire connection string (DATABASE_URL and REDIS_URL), if you're only using the entire connection string then the above configuration should work fine
The documentation only lists these variables, I think I'll delete everything else

2 years ago
oh fantastic!
2 years ago
then the above configuration should work fine
2 years ago
nope, replace:
with
Should I still have settings here?
It's a pity that you don't have remote access.


2 years ago
yes don't change anything in the database services
2 years ago
very likely
I also have a long delay when I request data from the server
I can tunnel through the cli, or do a trace, ping, to understand whether this is a problem in my code or in the remoteness of the server?

2 years ago
I can tunnel through the cli
Railway doesn't support SSH or anything like that if that's what you're asking
trace route or ping could probably help you debug though
I'm in South Africa with a website hosted in US-West on Railway and I have about 400ms response time
so unless you're further away from US-West than I am it's likely an issue with your code
I am in Kazakhstan.
Thank you very much !
I'm going home from work.
I set a hard limit of $10 just in case to avoid getting a heart attack in the morning 😄 I will try to work on the site
2 years ago
Sounds good, hope this new configuration works out 🙂
2 years ago
after reading this thread, I think it would be best if you could show us all your raw variables (the ones that aren't sensitive) for your medusa backend, I'm not quite sure you have followed fragly's instructions perfectly
When I have (private) I get this error
DATABASETYPE=postgres PGHOST=${{Postgres.PGHOST}} PGPASSWORD=${{Postgres.PGPASSWORD}} PGPORT=${{Postgres.PGPORT}} PGUSER=${{Postgres.PGUSER}} PORT=9000 REDISHOST=${{Redis.REDISHOST}} REDISPASSWORD=${{Redis.REDISPASSWORD}} REDISPORT=${{Redis.REDISPORT}} REDISUSER=${{Redis.REDISUSER}} REDISURL=${{Redis.REDISURL}} CACHEREDISURL=${{Redis.REDISURL}}
STORECORS=/vercel.app$/ ADMINCORS=/vercel.app$/
MEDUSABACKENDURL=https://stroyberymedusabackend-production.up.railway.app/
DATABASEURL=${{Postgres.DATABASEURL}}

2 years ago
you didn't do anything fragly has said, please review his messages
DATABASEURL=${{Postgres.DATABASEPRIVATEURL}} REDISURL=${{Redis.REDISPRIVATEURL}}
Here yea ?
When I put this
I get an error, screenshot of which is aboveI think I can remove all other variables, but I can’t put (private)
Because I get an error
Both at the back and at the front



2 years ago
you need to check the deployment logs
}
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal
at GetAddrInfoReqWrap.onlookup as oncomplete
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal
at GetAddrInfoReqWrap.onlookup as oncomplete
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal
at GetAddrInfoReqWrap.onlookup as oncomplete
Error: getaddrinfo ENOTFOUND redis.railway.internal
at GetAddrInfoReqWrap.onlookup as oncomplete {
errno: -3007,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'redis.railway.internal'
}
2 years ago
update the redis variable to -
2 years ago
no problem
2 years ago
no, but what kind of app is this again?
2 years ago
do you have a volume mounted to it?
2 years ago
haha that was a yes or no question
2 years ago
please check
2 years ago
yep thats what i asked, do you have one mounted to the medusa backend?
2 years ago
please check
2 years ago
look at the service on the project canvas, does it have a volume?







