/okerr-cat

Primary LanguagePythonMIT LicenseMIT

okerr-cat

Install

# apt install uwsgi uwsgi-plugin-python3 nginx
# python3 -m venv /opt/venv/okerr-cat
# cd /opt/venv/okerr-cat
# . bin/activate
(okerr-cat)# mkdir run
(okerr-cat)# chown www-data:www-data run
(okerr-cat)# pip3 install git+https://github.com/yaroslaff/okerr-cat
(okerr-cat)# cp contrib/okerr-cat.default /etc/default/okerr-cat
(okerr-cat)# ln -s /opt/venv/okerr-cat/contrib/okerr-cat.service /etc/systemd/system
(okerr-cat)# cp contrib/okerr-cat.nginx /etc/nginx/sites-available/okerr-cat
(okerr-cat)# ln -s /etc/nginx/sites-available/okerr-cat /etc/nginx/sites-enabled/
(okerr-cat)# systemctl enable okerr-cat
(okerr-cat)# systemctl status okerr-cat
(okerr-cat)# systemctl reload nginx

Upgrade

# /opt/venv/okerr-cat/bin/activate
# pip3 install -U git+https://github.com/yaroslaff/okerr-cat
# systemctl daemon-reload
# systemctl restart okerr-cat

Configuration

Okerr-cat uses environment variables ROLE, MYIP, FAILSTART. You can configure it in /etc/default/okerr-cat

Development start

As any other simple Flask application.

$ export FLASK_APP=cat.py
$ export FLASK_ENV=development
$ flask run
$ flask run --host=0.0.0.0

Cheatsheet

Get cloudflare wildcard certificate

  • pip3 install certbot-dns-cloudflare
  • certbot plugins
  • https://dash.cloudflare.com/profile/api-tokens (User Profile > API Tokens)
  • /etc/my/cloudflare.ini: dns_cloudflare_api_token = ...
  • certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/my/cloudflare.ini --dns-cloudflare-propagation-seconds 60 -d "cat.okerr.com" -d "*.cat.okerr.com"

Other okerr resources