Include SystemD configuration (#227)
This commit is contained in:
parent
d27bd782ce
commit
decc9e5139
3 changed files with 47 additions and 11 deletions
39
README.md
39
README.md
|
@ -199,16 +199,16 @@ libreddit
|
|||
Assign a default value for each setting by passing environment variables to Libreddit in the format `LIBREDDIT_DEFAULT_{X}`. Replace `{X}` with the setting name (see list below) in capital letters.
|
||||
|
||||
| Name | Possible values | Default value |
|
||||
|-----------------------|----------------------------------------------------------------------------------------|---------------|
|
||||
| theme | ["system", "light", "dark", "black", "dracula", "nord", "laserwave", "violet", "gold"] | system |
|
||||
| front_page | ["default", "popular", "all"] | default |
|
||||
| layout | ["card", "clean", "compact"] | card |
|
||||
| wide | ["on", "off"] | off |
|
||||
| comment_sort | ["hot", "new", "top", "rising", "controversial"] | hot |
|
||||
| post_sort | ["confidence", "top", "new", "controversial", "old"] | confidence |
|
||||
| show_nsfw | ["on", "off"] | off |
|
||||
| use_hls | ["on", "off"] | off |
|
||||
| hide_hls_notification | ["on", "off"] | off |
|
||||
|-------------------------|------------------------------------------------------------------------------------------|---------------|
|
||||
| `THEME` | `["system", "light", "dark", "black", "dracula", "nord", "laserwave", "violet", "gold"]` | `system` |
|
||||
| `FRONT_PAGE` | `["default", "popular", "all"]` | `default` |
|
||||
| `LAYOUT` | `["card", "clean", "compact"]` | `card` |
|
||||
| `WIDE` | `["on", "off"]` | `off` |
|
||||
| `COMMENT_SORT` | `["hot", "new", "top", "rising", "controversial"]` | `hot` |
|
||||
| `POST_SORT` | `["confidence", "top", "new", "controversial", "old"]` | `confidence` |
|
||||
| `SHOW_NSFW` | `["on", "off"]` | `off` |
|
||||
| `USE_HLS` | `["on", "off"]` | `off` |
|
||||
| `HIDE_HLS_NOTIFICATION` | `["on", "off"]` | `off` |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -228,6 +228,25 @@ proxy_http_version 1.1;
|
|||
```
|
||||
to your NGINX configuration file above your `proxy_pass` line.
|
||||
|
||||
## SystemD
|
||||
|
||||
You can use the SystemD service available in `contrib/libreddit.service`
|
||||
(install it on `/etc/systemd/system/libreddit.service`).
|
||||
|
||||
That service can be optionally configured in terms of environment variables by
|
||||
creating a file in `/etc/libreddit.conf`. Use the `contrib/libreddit.conf` as a
|
||||
template. You can also add the `LIBREDDIT_DEFAULT__{X}` settings explained
|
||||
above.
|
||||
|
||||
When "Proxying using NGINX" where the proxy is on the same machine, you should
|
||||
guarantee nginx waits for this service to start. Edit
|
||||
`/etc/systemd/system/libreddit.service.d/reverse-proxy.conf`:
|
||||
|
||||
```conf
|
||||
[Unit]
|
||||
Before=nginx.service
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
```
|
||||
|
|
2
contrib/libreddit.conf
Normal file
2
contrib/libreddit.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
ADDRESS=localhost
|
||||
PORT=12345
|
15
contrib/libreddit.service
Normal file
15
contrib/libreddit.service
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=libreddit daemon
|
||||
After=network.service
|
||||
|
||||
[Service]
|
||||
DynamicUser=yes
|
||||
# Default Values
|
||||
Environment=ADDRESS=0.0.0.0
|
||||
Environment=PORT=8080
|
||||
# Optional Override
|
||||
EnvironmentFile=-/etc/libreddit.conf
|
||||
ExecStart=/usr/bin/libreddit -a ${ADDRESS} -p ${PORT}
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
Loading…
Reference in a new issue