Correct environment variables
beryberykz
HOBBYOP

2 years ago

environment variables
DATABASEURL REDISURL
Is this correct or should I specify the value from the database and redis ?

99 Replies

beryberykz
HOBBYOP

2 years ago

8b1e4ae6-f221-4948-a158-23868f94c7db


dev
MODERATOR

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


beryberykz
HOBBYOP

2 years ago

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.

1217400824997744600


dev
MODERATOR

2 years ago

yea, unfortunately regions is a feature limited to Pro Plan at the moment


beryberykz
HOBBYOP

2 years ago

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)


dev
MODERATOR

2 years ago

Sounds good, best of luck


beryberykz
HOBBYOP

2 years ago

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


dev
MODERATOR

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:


beryberykz
HOBBYOP

2 years ago

ok, I think I did everything according to the guide, but so far I don’t see anything on the link

1217404442056593400


dev
MODERATOR

2 years ago

mind sharing your link?


beryberykz
HOBBYOP

2 years ago

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


dev
MODERATOR

2 years ago

oh, awesome!


beryberykz
HOBBYOP

2 years ago

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

1217413260077170700
1217413260328960000


beryberykz
HOBBYOP

2 years ago

i use

  • railway login
    -railway link


dev
MODERATOR

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


dev
MODERATOR

2 years ago

the second one, idk, i've never used the medusa CLI before ( i didn't even know that existed )


beryberykz
HOBBYOP

2 years ago

That correct ?

1217418033266561000


dev
MODERATOR

2 years ago

seems like you're on the right path


dev
MODERATOR

2 years ago

oh hold on though, what do you mean by this? " I want to install a new user for the admin panel"


beryberykz
HOBBYOP

2 years ago

Now if I write ~railway shell~, will I be inside cmd railway?


dev
MODERATOR

2 years ago

Railway doesn't allow for SSH access unfortunately


dev
MODERATOR

2 years ago

there's no way to directly interact with your container


beryberykz
HOBBYOP

2 years ago

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


dev
MODERATOR

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


beryberykz
HOBBYOP

2 years ago

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..

1217418962778849300


dev
MODERATOR

2 years ago

ooh i see, sorry I'm unfamiliar with medusa, let me skim through the docs real quick


dev
MODERATOR

2 years ago

it creates a new user on the database, that makes sense


dev
MODERATOR

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 project
railway run runs a command locally but with the same env as your railway project


beryberykz
HOBBYOP

2 years ago

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..

1217420709190570000


dev
MODERATOR

2 years ago

yea, like I said here, railway run runs a command locally but with the same environment variables as your railway project


beryberykz
HOBBYOP

2 years ago

How can I transfer user data to log in?


beryberykz
HOBBYOP

2 years ago

https://discord.com/channels/713503345364697088/1097967314655268925/1098005657258578070
There was a similar task here, but he somehow managed it, as I understand it


dev
MODERATOR

2 years ago

yea right now I'm trying to figure out why you're getting this error

1217422269433778200


dev
MODERATOR

2 years ago

do you have a database connected to your medusa service?


beryberykz
HOBBYOP

2 years ago

i think so

1217425297666871300


beryberykz
HOBBYOP

2 years ago

1217425481217998800


dev
MODERATOR

2 years ago

dang


dev
MODERATOR

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


dev
MODERATOR

2 years ago

I have no idea why you're getitng that error, it's an issue with Medua CLI though


beryberykz
HOBBYOP

2 years ago

Thank u


beryberykz
HOBBYOP

2 years ago

3


beryberykz
HOBBYOP

2 years ago

@Fragly hi
Can i asq u again pls?


dev
MODERATOR

2 years ago

about this same error?


beryberykz
HOBBYOP

2 years ago

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

1230135351658414000


beryberykz
HOBBYOP

2 years ago

1230135441324507100


dev
MODERATOR

2 years ago

Definitally seems like it yes, do you need help correctly setting it up?


beryberykz
HOBBYOP

2 years ago


beryberykz
HOBBYOP

2 years ago

40 gb 2 day.. yes please


dev
MODERATOR

2 years ago

Alright, mind opening your own thread?


dev
MODERATOR

2 years ago

ooh wait


dev
MODERATOR

2 years ago

this is your thread 🤣


beryberykz
HOBBYOP

2 years ago

<:salute:1137099685417451530>


beryberykz
HOBBYOP

2 years ago


dev
MODERATOR

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?

1230137616154890500


beryberykz
HOBBYOP

2 years ago

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}}


dev
MODERATOR

2 years ago

oh, cool, that works too


beryberykz
HOBBYOP

2 years ago

I'm not sure I need that much


dev
MODERATOR

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


beryberykz
HOBBYOP

2 years ago

The documentation only lists these variables, I think I'll delete everything else

1230140198491390000


dev
MODERATOR

2 years ago

oh fantastic!


dev
MODERATOR

2 years ago

then the above configuration should work fine


beryberykz
HOBBYOP

2 years ago

i can use just that ?

1230141088392544300


dev
MODERATOR

2 years ago

nope, replace:

with


beryberykz
HOBBYOP

2 years ago

Ok


beryberykz
HOBBYOP

2 years ago

Is this the reason why I had 40 GB?@Fragly


beryberykz
HOBBYOP

2 years ago

Should I still have settings here?
It's a pity that you don't have remote access.

1230142496504549400
1230142497016123400


dev
MODERATOR

2 years ago

yes don't change anything in the database services


dev
MODERATOR

2 years ago

very likely


beryberykz
HOBBYOP

2 years ago

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?

1230144282589921300


dev
MODERATOR

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


beryberykz
HOBBYOP

2 years ago

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


dev
MODERATOR

2 years ago

Sounds good, hope this new configuration works out 🙂


brody
EMPLOYEE

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


beryberykz
HOBBYOP

2 years ago

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}}

1230377363527700500


brody
EMPLOYEE

2 years ago

you didn't do anything fragly has said, please review his messages


beryberykz
HOBBYOP

2 years ago

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

1230400545701892000
1230400545953681400
1230400546213593000


brody
EMPLOYEE

2 years ago

you need to check the deployment logs


beryberykz
HOBBYOP

2 years ago

}

[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'

}


brody
EMPLOYEE

2 years ago

update the redis variable to -


beryberykz
HOBBYOP

2 years ago

I'll try it now thanks

1230403561850929200


beryberykz
HOBBYOP

2 years ago

Holy! it works ! Thank you very much


brody
EMPLOYEE

2 years ago

no problem


beryberykz
HOBBYOP

2 years ago

I didn't change anything but my images disappeared.

1233321383132663800


beryberykz
HOBBYOP

2 years ago

@BrodyCould this be due to the settings we used?


brody
EMPLOYEE

2 years ago

no, but what kind of app is this again?



brody
EMPLOYEE

2 years ago

do you have a volume mounted to it?


beryberykz
HOBBYOP

2 years ago

What do you have in mind?


brody
EMPLOYEE

2 years ago

haha that was a yes or no question


beryberykz
HOBBYOP

2 years ago

I don't know


brody
EMPLOYEE

2 years ago

please check


beryberykz
HOBBYOP

2 years ago

volume mounted?


brody
EMPLOYEE

2 years ago

yep thats what i asked, do you have one mounted to the medusa backend?


beryberykz
HOBBYOP

2 years ago

More likely no than yes.
This is the first time I've ever heard of this


brody
EMPLOYEE

2 years ago

please check


beryberykz
HOBBYOP

2 years ago

In any case, I don't even know how to do it


brody
EMPLOYEE

2 years ago

look at the service on the project canvas, does it have a volume?


beryberykz
HOBBYOP

2 years ago

here?

1233324142716260400


beryberykz
HOBBYOP

2 years ago

I don't understand what canvas you're talking about


Loading...