In order for you to view your self-hosted logs, you have to deploy this application. Before you deploy the application, create a config var named MONGO_URI
and put your MongoDB connection URI from the previous section into the value slot. Take the URL of this app after you deploy it and input it as a config var LOG_URL
in the Modmail bot app.
You can automatically update the logviewer in your Heroku account whenever changes are made to this repo.
To enable auto-updates, fork this repo and install the Pull app in your fork. Then go to the Deploy tab in your Heroku account, select GitHub and connect your fork. Turn on auto-deploy for the master branch.
The method of hosting the logviewer depends on your server configurations.
Below are some general instructions to help you get started on a Linux machine.
- A Python 3.9 installation with
pip
git
for your system
e.g. on Ubuntu:
sudo apt install software-properties-common python3.9 python3-dev python3-pip
Run the following shell commands:
git clone https://github.com/modmail-dev/logviewer
cd logviewer
python3 -m pip install pipenv
pipenv install
cp .env.example .env
Edit the .env
file (e.g. nano .env
) and fill in your MongoDB connection URI.
You can also customize the bind IP and port in the
.env
file.
Then to start the app, run:
pipenv run logviewer
You can verify the logviewer is working by navigating to http://<IP_OF_SERVER>:8000
(if you didn't change the bind IP / port) and should be greeted with the Logviewer main page.
To run the program in the background, you can use screen
. Or you can use a service manager, such as systemd
, which can also auto-restart the logviewer on failure and after system reboot.
We recommend setting up Nginx reverse proxy to port forward external port 80 to your internal logviewer port and cache static web contents (tutorial).
To accept requests from a domain instead of your server IP, simply set an A
/AAAA
record from your DNS record manager that forwards your domain to your server IP.
Protecting your logs with a login (Discord Oauth2 support) is a premium feature, only available to Patrons.
If you can make improvements in the design and presentation of logs, please make a pull request with changes.