Finds all blog pages in the Pelican output directory (set by "father_root", see claps.py) by traversing the directory tree. Then calling "https://api.applause-button.com/get-multiple" with a json-list of the blog pages (care taken that get-multiple does not allow more than 100 entries in the list at the same time). The returned value is parsed and rendered through a template file.
Claps depends on requests, flask and gunicorn, installation below. ufw needs to be configured to open the port used by gunicorn (see claps_gunicorn.conf). Supervisor is used to monitorn gunicorn.
$ python3 -m venv ./venv # in the claps directory
$ source venv/bin/activate
$ pip3 install requests
$ pip3 install flask
$ pip3 install gunicorn
As ufw allows incoming connection from all nodes on subnet 192.168.1.X, no ufw updates are needed.
Configure gunicorn and have systemd monitor. Create this script and place in /home/pi/rpi2/etc/systemd/user
, call
the script claps.service
:
[Unit]
Description=Wlog claps
After=network.target
[Service]
# To enable this, systemctl needs to be done in the following order
# $ sudo systemctl enable /home/pi/rpi2/etc/systemd/user/claps.service
# $ sudo systemctl start claps.service
# The first (enable) command will create symlink and enable the service so it get started at reboot
#
Type=simple
WorkingDirectory=/home/pi/app/claps
User=pi
Group=www-data
ExecStart=/home/pi/app/claps/venv/bin/gunicorn -b :8098 --reload claps:app
Restart=always
[Install]
WantedBy=multi-user.target