Skip to content

Commit a4470c2

Browse files
harleypigsimonmichael
authored andcommitted
;imp: added systemd and nginx files to examples dir
1 parent eb6accf commit a4470c2

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[Unit]
2+
Description=hledger-web -- plain text accounting, made easy
3+
Documentation=https://hledger.org/index.html
4+
After=network.target
5+
6+
[Service]
7+
# Your account environment is not available if you are not logged
8+
# in--e.g., on system startup. This sets the variables you need.
9+
Environment="LANG=en_US.UTF-8"
10+
Environment="LEDGER_FILE=/fully/qualified/path/to/your/journal"
11+
12+
Environment="BASE_URL=--base-url=https://your.domain"
13+
14+
# The default of 'view,add' is a good starting point, but if you need
15+
# to, this is where you would set these capabilities.
16+
# Environment="CAPABILITIES=--capabilities=view,add,manage"
17+
18+
Environment="PORT=--port=6001"
19+
20+
ExecStart=/usr/bin/hledger-web --serve --strict $BASE_URL $PORT $CAPABILITIES
21+
Restart=always
22+
23+
[Install]
24+
WantedBy=default.target

examples/systemd/hledger.nginx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
server {
2+
listen 443 ssl http2;
3+
listen [::]:443 ssl http2;
4+
5+
server_name your.domain;
6+
7+
access_log /var/log/nginx/hledger_access.log main;
8+
error_log /var/log/nginx/hledger_error.log info;
9+
10+
location / {
11+
proxy_pass http://127.0.0.1:6001;
12+
}
13+
}

examples/systemd/readme.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Setup hledger-web with a service file and reverse proxy
2+
3+
## Systemd service file
4+
5+
This setup describes a user service file setup, with hledger-web serving it's web app.
6+
7+
Copy the template service file in this directory to `$HOME/.config/systemd/user`.
8+
9+
Edit your service file and change the settings for your needs.
10+
11+
Start the web app by running `systemctl --user start hledger-web.service`.
12+
13+
If you want your app to start on bootup, then run `systemctl --user enable hledger-web.service`.
14+
15+
## Reverse proxy
16+
17+
### Nginx
18+
19+
The `hledger.nginx` file in this directory has the basics of what you'll need to setup a reverse proxy server.
20+
21+
I would strongly suggest you integrate some kind of security in place to protect your data. How to do that is beyond the scope of
22+
this document.

0 commit comments

Comments
 (0)