Railway
Deploy Modmail on Railway PaaS.
What is Railway?
Railway is a deployment platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Requirements
A credit card.
An email account.
A GitHub account.
You have completed the initial steps: invited your bot and created a MongoDB database.
Costs
Their lowest plan starts at $5 per month. Visit the pricing page for the up-to-date pricing info.
Fork our GitHub repositories
You will need to fork our repositories to deploy onto Railway.
Make sure you're logged in to GitHub. You will need to fork two repositories.
First we fork the Modmail repository. Head over to https://github.com/modmail-dev/modmail/fork, leave all the settings as default, and click Create fork.
Next do the same for the Logviewer repository by heading over to https://github.com/modmail-dev/logviewer/fork, leave all the settings as default, and click Create fork.
Next, to keep your Modmail and Logviewer up to date, you will need to install the Pull app. Simply head over to https://github.com/apps/pull, click Install, choose Only select repositories, then select both the Modmail and Logviewer repositories that you forked in the previous step.
Your GitHub should now be all set. Next step, create a Railway account to deploy your bot.
Create a Railway account
Head over to Railway's website and create an account. It will ask you to create a new project, choose Deploy from GitHub repo. Then, you will be asked to connect your GitHub account.
Next, you will be asked to Configure a GitHub App. You will be directed to the GitHub authentication page. Choose Only select repositories, then select both the Modmail and Logviewer repositories, as you have done before. Finally, click Install & Authorize.
The next step is to deploy Modmail onto Railway. This is split into two parts. You will need to complete both parts to fully Modmail.
Part 1: Deploying the Logviewer
From the New Project page, create the project by selecting your Logviewer repository, then select Add variables.
Click New Variable, set left to be CONNECTION_URI
, then on the right, paste your revised MongoDB connection string from your Notepad (if this is new to you, go back and read the initial steps).
Don't add any other variables, nor use the suggested variables section. You should see a new variable named CONNECTION_URI
added under variables once you're done.
Next, go to the Deployments tab, look at the latest deployment, is it successful? You may need to wait up to 10 minutes. If you click the URL, you should be taken to your Logviewer homepage (see screenshot below). Save this URL into your Notepad as we will need it for the next step, we will be referring to this as your Logviewer URL.
Part 2: Deploying the Modmail bot
From the New Project page, create the project by selecting your Modmail repository, then select Add variables.
Click New Variable. We will be adding 5 variables in total, so repeat this step until you've added all 5 variables.
Variable Name (left) | Variable Value (right) | Example |
---|---|---|
| The MongoDB Connection string from your Notepad. | |
| The Discord bot token from your Notepad. | |
| The Logviewer URL from your Notepad. Remember to add | |
| Your Discord ID. If you have multiple owners, separate your IDs with a comma. | |
| The ID of the Discord server for your Modmail bot. | |
Complete the setup
Within 10 minutes of saving the Modmail bot variables, your Modmail bot should come online in your server. The default prefix for Modmail is ?
. You need to run ?setup
within your server to complete the setup. If you configured Modmail to use a separate staff server, you must run this command in your staff server. This will create a category for your Modmail threads and a Logs channel for an archive of all past threads.
How to keep your bot running 24/7
You have 10 days to test Modmail without upgrading to the "Developer" plan. As mentioned in the costs section, Railway's Developer plan provides enough free monthly credits to run Modmail for free 24/7 everyday. However, you will need to provide your credit card details to upgrade your plan. More details can be found here.
Usage-based subscription
Head over to the **** Billing Details page, click the Unlock button to unlock Developer plan. Then input your credit card details and hit Subscribe to Developer Plan.
Subscribing to the Developer plan under usage based subscription may incur you unexpected charges. This because Railway does not provide any safe-guards or monthly spending limits. Average Modmail and Logviewer usage should be well below the free threshold. However, if you run resource-intensive code via plugins or due to other means, you credit card may be billed.
If you want to guarantee that your credit card won't get charged for whatever reason, check out the credit-based subscription model instead. Alternatively, you can use a virtual credit card, such as privacy.com, to verify for the Developer plan.
Credit-based subscription (alternative subscription model)
If you rather pay a one-time $5.00 USD non-refundable credit purchase instead of permanently linking your credit card, you can choose to use the credit-based subscription model. As long as you have a non-zero credit balance (which should be forever since the monthly operating cost for Modmail is $0.00), you will be continuously subscribed to the Developer plan.
There you go! Your bot should now be able to run 24/7 without interruptions. Head over to the Usage page to make sure you won't be charged. Add up the estimated price for both your projects and verify that they're well below $5.00 USD.
Updating
Railway is configured to automatically update your Modmail bot and Logviewer whenever new updates become available.
Next steps
Now that you've successfully set up Modmail, visit the Getting Started page to find information on using Modmail.
You can also join our Discord Server to interact with our community or get support for Modmail.
Last updated