R
Railwayβ€’12mo ago
Bordin

DiscordBot Deployment

Hi! I made a discord bot with a database and i want to deploy it for free since it is just a small project, I heard railway is a good place to look into . I tried deploying from github but then i remembered I have a gitignore that removes .env files which caused the deployment to crash. How can I avoid this issue?
30 Replies
Percy
Percyβ€’12mo ago
Project ID: N/A
Bordin
Bordinβ€’12mo ago
I dont want to post my mongodb connection string on github
Brody
Brodyβ€’12mo ago
well first I have to say, railway isn't fee
Bordin
Bordinβ€’12mo ago
Oh I thought its free
root
rootβ€’12mo ago
You can add your environment variables in the Variables tab.
Brody
Brodyβ€’12mo ago
you get a free trial, but that only gives you a one time credit of 5$ and yeah what aleks said, have a look at these docs https://docs.railway.app/develop/variables
Bordin
Bordinβ€’12mo ago
so it only hosts for a month?
Brody
Brodyβ€’12mo ago
that depends on how resource hungry your bot is
root
rootβ€’12mo ago
You can use https://docs.railway.app/develop/variables#reference-variables to hook up to a railway-provided mongodb
Railway Docs
Variables | Railway Docs
Documentation for Railway
root
rootβ€’12mo ago
although if you want low resource usage I wouldn't recommend hosting mongodb on railway
Brody
Brodyβ€’12mo ago
since railway is usage based. if your app is resource efficient, you could run your bot for a few months. or if your bot uses a lot of resources you would chew through those 5$ fast
root
rootβ€’12mo ago
What language is your bot written in? that could give some idea of the resource usage
Bordin
Bordinβ€’12mo ago
javascript discord.js Its a very small bot i dont think it will
root
rootβ€’12mo ago
Yeah, you'll probably be able to run it for a couple of months, maybe more
Brody
Brodyβ€’12mo ago
I'm in agreement with aleks
Bordin
Bordinβ€’12mo ago
do you think i can find a better solution? a better alternative
Brody
Brodyβ€’12mo ago
than railway? not really no
root
rootβ€’12mo ago
maybe hop
Brody
Brodyβ€’12mo ago
you get 5$ on the trial plan, run your bot for as long as you can and see if you like the platform, if you like railway upgrade to the hobby plan once you run of of trial credits πŸ™‚
root
rootβ€’12mo ago
Hop
Hop enables you to deploy and scale high-bandwidth realtime apps with ease
Brody
Brodyβ€’12mo ago
aleks 😠
root
rootβ€’12mo ago
πŸ€·β€β™‚οΈ
Brody
Brodyβ€’12mo ago
you're not a very good shill
Bordin
Bordinβ€’12mo ago
It's a very small project, i dont really want to spend money on it as I am not the owner, and the owner wouldn't spend money can I host on replit?
root
rootβ€’12mo ago
hop should work for that on the free plan iirc replit is more expensive, let me check yeah, currently $6.40/month
Bordin
Bordinβ€’12mo ago
nvm ;-;
root
rootβ€’12mo ago
it says there's also a PAYG plan coming, but that's still not free honestly, I'd take a look at hop
Bordin
Bordinβ€’12mo ago
alr, thank you btw i still dont know what to do with my .env files
Brody
Brodyβ€’12mo ago
nothing, keep them in your gitignore and store the variables in the railway service variables me and aleks have both sent links to documentation, please read them
Bordin
Bordinβ€’12mo ago
Ok, thanks