|
13 | 13 | <img src="https://img.shields.io/badge/patreon-donate-orange.svg?style=for-the-badge&logo=Patreon" alt="Donate on Patreon">
|
14 | 14 | </a>
|
15 | 15 | <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"> |
17 | 17 | </a>
|
18 | 18 | <a href="https://github.com/psf/black">
|
19 | 19 | <img src="https://img.shields.io/badge/Code%20Style-Black-black?style=for-the-badge" alt="Coding Style Black">
|
|
25 | 25 |
|
26 | 26 | ## What is this?
|
27 | 27 |
|
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. |
29 | 29 |
|
30 | 30 | ## Updating
|
31 | 31 |
|
32 | 32 | You can automatically update the logviewer in your Heroku account whenever changes are made to this repo.
|
33 | 33 |
|
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. |
35 | 81 |
|
36 | 82 | ## Discord OAuth2
|
37 | 83 |
|
|
0 commit comments