Skip to content

Commit a290ac3

Browse files
authored
Merge pull request modmail-dev#54 from Coolguy3289/patch-2
Add Self-host instructions
2 parents 9e611e5 + 7d1ac0a commit a290ac3

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

README.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<img src="https://img.shields.io/badge/patreon-donate-orange.svg?style=for-the-badge&logo=Patreon" alt="Donate on Patreon">
1414
</a>
1515
<a href="https://www.python.org/downloads/">
16-
<img src="https://img.shields.io/badge/Made%20With-Python%203.7-blue.svg?style=for-the-badge&logo=Python" alt="Made with Python 3.7">
16+
<img src="https://img.shields.io/badge/Made%20With-Python%203.9-blue.svg?style=for-the-badge&logo=Python" alt="Made with Python 3.9">
1717
</a>
1818
<a href="https://github.com/psf/black">
1919
<img src="https://img.shields.io/badge/Code%20Style-Black-black?style=for-the-badge" alt="Coding Style Black">
@@ -25,13 +25,59 @@
2525

2626
## What is this?
2727

28-
In order for you to view your selfhosted 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.
28+
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.
2929

3030
## Updating
3131

3232
You can automatically update the logviewer in your Heroku account whenever changes are made to this repo.
3333

34-
To enable autoupdates, fork this repo and [install the Pull app in your fork](https://github.com/apps/pull). Then go to the Deploy tab in your Heroku account, select GitHub and connect your fork. Turn on auto-deploy for the master branch.
34+
To enable auto-updates, fork this repo and [install the Pull app in your fork](https://github.com/apps/pull). Then go to the Deploy tab in your Heroku account, select GitHub and connect your fork. Turn on auto-deploy for the master branch.
35+
36+
## Self-Hosting Setup
37+
38+
The method of hosting the logviewer depends on your server configurations.
39+
40+
Below are some general instructions to help you get started on a Linux machine.
41+
42+
### Prerequisites
43+
44+
- A [Python 3.9 installation](https://www.python.org/downloads/) with `pip`
45+
- `git` for your system
46+
47+
e.g. on Ubuntu:
48+
```shell
49+
sudo apt install software-properties-common python3.9 python3-dev python3-pip
50+
```
51+
52+
53+
### Deployment
54+
55+
Run the following shell commands:
56+
```shell
57+
git clone https://github.com/kyb3r/logviewer
58+
cd logviewer
59+
python3 -m pip install pipenv
60+
pipenv install
61+
cp .env.example .env
62+
```
63+
Edit the `.env` file (e.g. `nano .env`) and fill in your MongoDB connection URI.
64+
65+
> You can also customize the bind IP and port in the `.env` file.
66+
67+
Then to start the app, run:
68+
```shell
69+
pipenv run logviewer
70+
```
71+
72+
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.
73+
74+
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.
75+
76+
### Advanced
77+
78+
We recommend setting up Nginx reverse proxy to port forward external port 80 to your internal logviewer port and cache static web contents ([tutorial](https://www.hostinger.com/tutorials/how-to-set-up-nginx-reverse-proxy/)).
79+
80+
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.
3581

3682
## Discord OAuth2
3783

0 commit comments

Comments
 (0)