iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🚄

Hosting a Discord Bot on Railway

に公開

I tried hosting a Discord Bot on a service called Railway.

Registration

It seems you can register via email or GitHub integration.
The fact that "Login" also serves as registration is a bit confusing.

Deployment


Go to the Dashboard and click the New Project button.



Since you can deploy from a user's repository via GitHub integration, I'll use that for this deployment.
https://github.com/sevenc-nanashi/BCDice4d



When I entered the repository name, it gave me good suggestions.



Since environment variables need to be set, I'll proceed with Add variables.



I moved to the environment variable configuration screen. At this stage, if you have a .env.sample file, it helpfully suggests them as candidates to add.



Once registered, set the startup command in Settings. (It seems it recognizes a Procfile if it's there.) Just wait for the redeployment to finish, and you're done.

Trying it out

It's easy. It might be a good choice for those looking to migrate from Heroku.

Also, for a single simple bot, it costs about $0.25 per month. Since the free tier is $5 (up to $10 with credit card registration, though you'll be charged if you exceed it), a simple calculation shows you can host about 12 bots for free.



By the way, the Pricing section mentions $3 for a Discord Bot, but since that includes Postgres and Redis, it might not be a very relevant reference.

Conclusion

Since it reads the Procfile and provides a database client, it might be worth considering a move from Heroku.
Thank you for reading to the end.

By the way

The bot (BCDice4d) in this article is made with discorb. I'd be happy if you used it (and bug reports are welcome too).

Discussion