;imp: added systemd and nginx files to examples dir

This commit is contained in:
Alan Young 2021-07-04 11:44:47 -06:00 committed by Simon Michael
parent eb6accf94f
commit a4470c2a4d
3 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,24 @@
[Unit]
Description=hledger-web -- plain text accounting, made easy
Documentation=https://hledger.org/index.html
After=network.target
[Service]
# Your account environment is not available if you are not logged
# in--e.g., on system startup. This sets the variables you need.
Environment="LANG=en_US.UTF-8"
Environment="LEDGER_FILE=/fully/qualified/path/to/your/journal"
Environment="BASE_URL=--base-url=https://your.domain"
# The default of 'view,add' is a good starting point, but if you need
# to, this is where you would set these capabilities.
# Environment="CAPABILITIES=--capabilities=view,add,manage"
Environment="PORT=--port=6001"
ExecStart=/usr/bin/hledger-web --serve --strict $BASE_URL $PORT $CAPABILITIES
Restart=always
[Install]
WantedBy=default.target

View File

@ -0,0 +1,13 @@
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name your.domain;
access_log /var/log/nginx/hledger_access.log main;
error_log /var/log/nginx/hledger_error.log info;
location / {
proxy_pass http://127.0.0.1:6001;
}
}

View File

@ -0,0 +1,22 @@
# Setup hledger-web with a service file and reverse proxy
## Systemd service file
This setup describes a user service file setup, with hledger-web serving it's web app.
Copy the template service file in this directory to `$HOME/.config/systemd/user`.
Edit your service file and change the settings for your needs.
Start the web app by running `systemctl --user start hledger-web.service`.
If you want your app to start on bootup, then run `systemctl --user enable hledger-web.service`.
## Reverse proxy
### Nginx
The `hledger.nginx` file in this directory has the basics of what you'll need to setup a reverse proxy server.
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
this document.