Correct environment variables
environment variables
DATABASE_URL
REDIS_URL
Is this correct or should I specify the value from the database and redis ?
85 Replies
Project ID:
8b1e4ae6-f221-4948-a158-23868f94c7db
8b1e4ae6-f221-4948-a158-23868f94c7db
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.
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)
Sounds good, best of luck
Last stupid question 😄
How can I navigate the path now?
Previously, when I was on localhost, I wrote
localhost:7001
.. now I don’t see a path that I can take
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
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
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
i use
- railway login
-railway link
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
the second one, idk, i've never used the medusa CLI before ( i didn't even know that existed )That correct ?
seems like you're on the right path
oh hold on though, what do you mean by this? " I want to install a new user for the admin panel"
Now if I write ~railway shell~, will I be inside cmd railway?
Railway doesn't allow for SSH access unfortunately
there's no way to directly interact with your container
In Medusa you need to write the command npx medusa user --email [email protected] --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
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..
Deploy Your Medusa Backend to Railway | Medusa
Learn step-by-step.
ooh i see, sorry I'm unfamiliar with medusa, let me skim through the docs real quick
it creates a new user on the database, that makes sense
I can’t figure out how to connect to the cmd of my project to write this commandOn railway there isn't really anyway to run commands in the container of your project
railway run
runs a command locally but with the same env as your railway projectI don't understand, did I miss something?
It's like it goes into the railroad, but then it does it locally on my PC..
yea, like I said here,
railway run
runs a command locally but with the same environment variables as your railway projectHow can I transfer user data to log in?
https://discord.com/channels/713503345364697088/1097967314655268925/1098005657258578070
There was a similar task here, but he somehow managed it, as I understand it
yea right now I'm trying to figure out why you're getting this error
do you have a database connected to your medusa service?
i think so
dang
yea I'm completely out of ideas, I did find https://github.com/medusajs/medusa/issues/4449
although the solutions there seems like workarounds instead of actual solutions, although maybe some of the workarounds will work for you
I have no idea why you're getitng that error, it's an issue with Medua CLI though
Thank u
3
@Fragly hi
Can i asq u again pls?
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
Definitally seems like it yes, do you need help correctly setting it up?
40 gb 2 day.. yes please
Alright, mind opening your own thread?
ooh wait
this is your thread 🤣
:salute:
https://docs.medusajs.com/deployments/server/deploying-on-railway
I'm working with this
Deploy Your Medusa Backend to Railway | Medusa
Learn step-by-step.
In the service you're connecting
Postgres
to, in this case "stroyberyMedusa..."
could you go verify that your database variables still look like this?DATABASE_TYPE=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}}
REDIS_URL=${{Redis.REDIS_URL}}
CACHE_REDIS_URL=${{Redis.REDIS_URL}}
STORE_CORS=/vercel.app$/
ADMIN_CORS=/vercel.app$/
MEDUSA_BACKEND_URL=https://stroyberymedusabackend-production.up.railway.app
DATABASE_URL=${{Postgres.DATABASE_URL}}
oh, cool, that works too
I'm not sure I need that much
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 fineThe documentation only lists these variables, I think I'll delete everything else
oh fantastic!
then the above configuration should work fine
i can use just that ?
nope, replace:
with
Ok
Is this the reason why I had 40 GB?@Fragly
Should I still have settings here?
It's a pity that you don't have remote access.
yes don't change anything in the database services
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?
I can tunnel through the cliRailway 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
Sounds good, hope this new configuration works out 🙂
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
DATABASE_TYPE=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}}
REDIS_URL=${{Redis.REDIS_URL}}
CACHE_REDIS_URL=${{Redis.REDIS_URL}}
STORE_CORS=/vercel.app$/
ADMIN_CORS=/vercel.app$/
MEDUSA_BACKEND_URL=https://stroyberymedusabackend-production.up.railway.app/
DATABASE_URL=${{Postgres.DATABASE_URL}}
you didn't do anything fragly has said, please review his messages
DATABASE_URL=${{Postgres.DATABASE_PRIVATE_URL}}
REDIS_URL=${{Redis.REDIS_PRIVATE_URL}}
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
you need to check the deployment logs
}
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
Error: getaddrinfo ENOTFOUND redis.railway.internal
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26) {
errno: -3007,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'redis.railway.internal'
}
update the redis variable to -
I'll try it now thanks
Holy! it works ! Thank you very much
no problem
I didn't change anything but my images disappeared.
@BrodyCould this be due to the settings we used?
no, but what kind of app is this again?
Get started with Next.js for e-commerce | Medusa
Learn how to get started with a Next.js storefront and Medusa. The Next.js Starter includes ready-integrations with plugins like Stripe and Algolia. It offers features like customer accounts, cart and checkout flows, and more.
do you have a volume mounted to it?
What do you have in mind?
haha that was a yes or no question
I don't know
please check
volume mounted?
yep thats what i asked, do you have one mounted to the medusa backend?
More likely no than yes.
This is the first time I've ever heard of this
please check
In any case, I don't even know how to do it
look at the service on the project canvas, does it have a volume?
here?
I don't understand what canvas you're talking about