Added documentation and systemd unit file
This commit is contained in:
parent
1b9386cd1a
commit
0f001ed0ab
24
README.md
Normal file
24
README.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# arec-watcher
|
||||||
|
|
||||||
|
A daemon program that watches an upload directory for new completed uploads
|
||||||
|
from arec recorders and sends a notification to play-api to initiate
|
||||||
|
processing of the uploaded presentation.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
* Clone the repo to `/opt/arec-watcher`
|
||||||
|
* Create a python venv in the project root: `python3 -m venv env`
|
||||||
|
(other names are possible but will cause some minor headaches)
|
||||||
|
* Activate the environment: `source env/bin/activate`
|
||||||
|
* Install dependencies: `pip install -r requirements.txt`
|
||||||
|
|
||||||
|
For development:
|
||||||
|
* Run the program: `python3 -m watcher`
|
||||||
|
|
||||||
|
For production:
|
||||||
|
* Copy `config.ini.example`to `config.ini` and set the proper parameters
|
||||||
|
* Create an `arec-watcher` user
|
||||||
|
* Install the systemd unit file:
|
||||||
|
`sudo cp arec-watcher.service /etc/systemd/system/`
|
||||||
|
* Activate the service: `sudo systemctl enable arec-watcher.service`
|
||||||
|
* Run the service: `sudo systemctl start arec-watcher.service`
|
14
arec-watcher.service
Normal file
14
arec-watcher.service
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description = arec recording upload monitoring daemon
|
||||||
|
After = multi-user.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type = exec
|
||||||
|
Restart = on-failure
|
||||||
|
ExecStart = /opt/arec-watcher/env/bin/python3 -m watcher
|
||||||
|
WorkingDirectory = /opt/arec-watcher
|
||||||
|
User = arec-watcher
|
||||||
|
SyslogIdentifier = arec-watcher
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy = multi-user.target
|
@ -1,6 +1,21 @@
|
|||||||
[arec-watcher]
|
[arec-watcher]
|
||||||
watchdir = /some/uploaddir/to/watch
|
watchdir = /some/uploaddir/to/watch
|
||||||
notify_url = https://example.com/notify
|
notify_url = https://example.com/post/notify
|
||||||
|
|
||||||
[logging]
|
[logging]
|
||||||
level = DEBUG
|
# Logging settings. This entire section is optional.
|
||||||
|
# see https://docs.python.org/3.9/library/logging.html for details
|
||||||
|
|
||||||
|
## What log messages are shown on stderr.
|
||||||
|
## Defaults to ERROR if omitted.
|
||||||
|
## For the spammiest logging, use the number 5 here.
|
||||||
|
## Beware that this can log multiple gigabytes per hour.
|
||||||
|
log_level = DEBUG
|
||||||
|
|
||||||
|
## Mail settings for emailing log messages.
|
||||||
|
## If mail_level is not set, no emails will be sent.
|
||||||
|
## If mail_level is present, all other mail_* fields must be configured.
|
||||||
|
mail_level = ERROR
|
||||||
|
mail_from = messages@example.com
|
||||||
|
mail_to = admin@example.com
|
||||||
|
mail_subject = arec-watcher has encountered an error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user