modmail-dev / logviewer

An external website that allows moderators and administrators to view past Modmail threads. It provides a convenient way for moderators to track previous conversations and helps them to maintain a record of user interactions.
GNU General Public License v3.0
85 stars 1.28k forks source link
discord discord-api discord-bot discord-modmail modmail modmail-bot python python3

Modmail Log Viewer

A simple webserver to view your selfhosted modmail logs.

Deploy to Heroku Support Donate on Patreon Made with Python 3.9 Coding Style Black AGPL License

What is this?

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.

Updating

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.

Self-Hosting Setup

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.

Prerequisites

e.g. on Ubuntu:

sudo apt install software-properties-common python3.9 python3-dev python3-pip

Deployment

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.

Advanced

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.

Discord OAuth2

Protecting your logs with a login (Discord Oauth2 support) is a premium feature, only available to Patrons.

Contributing

If you can make improvements in the design and presentation of logs, please make a pull request with changes.