Skip to content

Commit 7d1ac0a

Browse files
authored
Reorganise and update the self-hosting guide
1 parent 1df49c4 commit 7d1ac0a

File tree

1 file changed

+39
-16
lines changed

1 file changed

+39
-16
lines changed

README.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +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.
3535

3636
## Self-Hosting Setup
3737

38-
There are a couple ways you can go about hosting the logviewer. Below is a simple set of instructions to get started!
38+
The method of hosting the logviewer depends on your server configurations.
3939

40-
First, I recommend setting up a vhost and reverse proxy via nginx for the log viewer. Otherwise you'll be accessing it from <IP_OF_VPS>:<LOGVIEWER_PORT>
41-
A [Guide to setup a reverse proxy](https://www.hostinger.com/tutorials/how-to-set-up-nginx-reverse-proxy/) to help get started.
42-
Next, ensure you're running Python 3.9 or above [A Quick Guide on how to do this](https://linuxize.com/post/how-to-install-python-3-9-on-ubuntu-20-04/), along with ensuring pip (On Ubuntu, generally `sudo apt-get install python3-pip` is sufficient) is installed as well.
40+
Below are some general instructions to help you get started on a Linux machine.
4341

44-
Run the following:
45-
`git clone https://github.com/kyb3r/logviewer`
46-
`cd logviewer`
47-
`python3 -m pip install pipenv`
48-
`cp .env.example .env`
42+
### Prerequisites
4943

50-
Edit the `.env` file and fill in your Mongo connection string. If you wish to customize the bind IP and port, you may do so, but I'll be referencing the default port below (8000)
44+
- A [Python 3.9 installation](https://www.python.org/downloads/) with `pip`
45+
- `git` for your system
5146

52-
`pipenv install`
53-
`chmod +x logviewer.sh`
47+
e.g. on Ubuntu:
48+
```shell
49+
sudo apt install software-properties-common python3.9 python3-dev python3-pip
50+
```
5451

55-
Then to start the app, run `./logviewer.sh`
5652

57-
The app will start by default listening on all interfaces, if unmodified running on port 8000. You can test this is working by navigating to <IP_OF_SERVER>:8000 and should be greeted with the Modmail Logviewer Main Page.
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.
5881

5982
## Discord OAuth2
6083

0 commit comments

Comments
 (0)