a year ago
how do i create a redis db in railway and use it for caching
92 Replies
REDISURL="redis://default:${{REDISPASSWORD}}@${{RAILWAYPRIVATEDOMAIN}}:6379"
a year ago
In your project, you can right click, click on Database, and click on Add Redis
From there you can connect to redis using the REDIS_URL variable which you can find in the Variables tab (you can set up a shared variable to directly link it into your service's variables)
REDIS_URL="redis://default:${{REDIS_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:6379"
REDISHOST="${{RAILWAY_PRIVATE_DOMAIN}}"
REDISPASSWORD="${{REDIS_PASSWORD}}"
REDISPORT="6379"
REDISUSER="default"a year ago
check the REDIS_PASSWORD variable for the password and service settings for private domain
or click on the eye icon to see what the final value is
a year ago
that's the public domain, the private domain would be a railway.internal domain
a year ago
it's much easier just clicking on the eye icon next to the variable to see the actual value though
a year ago
yes
a year ago
correct
a year ago
that looks about right (assuming pass is your password)
a year ago
It's recommended you use [reference variables]() instead of defining the variable manually (although doing it manually will still work)
a year ago
REDIS_STRING="${{Redis.REDIS_URL}}"a year ago
You get 0.5GB on trial, 5GB on hobby and up to like 250GB or something on pro
a year ago
yup
a year ago
yes, your bot will run 24/7 on Railway
a year ago
true!!
a year ago
well, idk if there's a limit on projects, projects are just a container for services so the real question is how many services
a year ago
there isn't a service limit on hobby or pro (at least that I know of)
a year ago
there is one on trial, I'm not exactly sure how many that is
a year ago
yea, your app is deployed into a docker container
i was trying to add a postgresql database for my discord bot in railway
a year ago
how many services do you currently have?
a year ago
Here's a rundown of Railway's terminology

a year ago
yeaa 😬 it's likely you hit that service limit I mentioned earlier
a year ago
My recommendation would be to host databases outside of Railway, MongoDB could go on MongoDB atlas for example
I used to do that and it worked very well, great for saving on costs too
a year ago
that, or just upgrade to hobby plan, if you're a hobbyist developer then you probably won't regret it
a year ago
yea that's a whole can of worms, hosting your databases yourself could work perfectly for sure
although it's probably easier just finding free database hosting solutions online (e.g, atlas for mongodb)
a year ago
then your actual code can stay on Railway
a year ago
yea, though exposing it is definitely possible but outside the scope of this help thread
a year ago
my suggestion: find free database hosting solutions online and host your code on Railway
a year ago
oh fair
You can create a template and add as many services as you'd like. All you need to do is give us a service name and a link to the GitHub URL where the code for the service is located. You can still configure service-level environment variables along with default values and descriptions for each variable.
a year ago
what's that in reference to?
a year ago
why do you want to make a template?
Error: SequelizeConnectionError: password authentication failed for user "arrow" postgresql error in railway
a year ago
sorry I was eating a hotdog
a year ago
yes, you can go to the Deployments tab, click on the hamburger menu thingy and you'll see an option to remove the running deployment
a year ago
going to bed will check back when I wake up
a year ago
I'm back, was there anything else you needed help with or am I free to mark as solved?
a year ago
Use a proper database client like dbgate
a year ago
Google it! better you read the docs than trust everything we say
a year ago
Again, google it.
a year ago
Both Railway and dbgate have docs you can read
a year ago
@glitchdetected1 can I finally mark this as solved <:PinkPlead:1033655200659026020>
a year ago
<:whyy2:820544722572673045>
a year ago
I can't wait that long, marking as solved, feel free to open another one if you need more help
a year ago
!s
Status changed to Solved dev • about 1 year ago