diff --git a/examples/systemd/hledger-web.service b/examples/systemd/hledger-web.service new file mode 100644 index 000000000..89efea871 --- /dev/null +++ b/examples/systemd/hledger-web.service @@ -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 diff --git a/examples/systemd/hledger.nginx b/examples/systemd/hledger.nginx new file mode 100644 index 000000000..dd12b97fa --- /dev/null +++ b/examples/systemd/hledger.nginx @@ -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; + } +} diff --git a/examples/systemd/readme.md b/examples/systemd/readme.md new file mode 100644 index 000000000..7672b9054 --- /dev/null +++ b/examples/systemd/readme.md @@ -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.