Logviewer
Hosting the logviewer on the cloud or on your own computer.
Prerequisites
This logviewer hosting tutorial is written assuming you have already set up your bot and are running Ubuntu 20.04-22.04.
Downloading the files
You must have git installed on your system. If you do not, run
sudo apt install gitto install it.
You can download the logviewer files by running the following command:
git clone https://github.com/modmail-dev/logviewer logviewer
Once done, you can use `cd logviewer` to enter the directory.
Installing the dependencies
First, install pipenv by running the following command:
Pipenv must be installed. Since this is also used for the bot, you can skip this step if you have already installed it.
python -m pip install pipenvInstalling the dependencies is done by running the following command:
pipenv install
Configuring the .env
To configure the .env file, you can use the following command:
nano .env.exampleThis will open the example .env file in nano. You can then edit the file with your info. You will need to enter the same mongo URI as your bot uses. The rest of the configs can be left to the default values, unless you have a specific reason to change them.
Then save the file and exit nano by pressing ctrl + x, then y, change the name from .env.example to .env and then enter.
Running the logviewer
Now you can start the logviewer with the following command
sudo pipenv run logviewer(Optional) Keep logviewer running in the background with pm2
Pm2 can keep your logviewer automatically online in the background even if you close your terminal. To install pm2, run the following command:
sudo apt install npm -y && sudo npm i pm2 -gOnce installed, you can start the logviewer with pm2 by running the following command:
sudo pm2 start logviewer.sh --name "logviewer" && sudo pm2 saveMore info on how to use pm2 can be found on pm2's website.
Last updated
Was this helpful?