A Definitive Guide to Self-hosting Modmail
- Fork the repo (Best to make it private).
- Define a
Procfile
in the root of the directory and fill the contents withworker: python3 launcher.py
. - Create a new app on Heroku and deploy the repo you've just forked.
- Go to "elements" and install the PostgresQL and Redis add-ons to your new app.
-
Gather the credentials from the PostgresQL add-on.
-
Go to your config file on your repo and fill in the following credentials:
# Bot's token token = "" # ... # Do it unless you want Prometheus testing = True # ... # Postgres database credentials database = { # The fields come from the credentials generated "database": "", "user": "", "password": "", "host": "", "port": 5432, }
-
Gather the credentials from the Redis add-on.
-
Go to the config file and set
ipc_channel = ""
to any name e.g.ipc_channel = "modmail"
. -
Navigate to
classes/bot.py
and modify the redis_pool connection to this format:"redis://<host>:<port>", minsize=5, maxsize=10, loop=self.loop, db=0, password="<password>"
(Parts in<>
come from the add-on credentials). -
Deploy to your heroku app.
Note: Make sure you've defined yourself in the owners = []
list in config.py
.
- Open up the
schema.sql
file cloned from the repo. - Navigate to a channel and run the command
=sql
passing the argument as one table in the schema. You must do all the tables individually or the command will not run e.g.=sql CREATE TABLE public.preference ( identifier bigint NOT NULL, confirmation boolean NOT NULL, PRIMARY KEY (identifier) );
.
- Deploy all the changes to GitHub so that the app on Heroku will be updated.
- On the Heroku app navigate to the
Resources
tab and there you should see the worker appear under your Dynos. - Click the pencil icon and enable the dyno and you are good to go! 🎉
Want to contribute to this guide to support more platforms? Awesome! Just drop waterflamev8#4123 a DM on Discord or chat with me on the ModMail Support Server
- Josh133#0001(Heroku guide)
Hello what is your discord, i might need your help tho. I am having trouble