- Create a user and adjust permissions to write at least into /opt/schort/data
sudo mkdir -p /opt/schort
sudo groupadd schort
sudo useradd -d /opt/schort -g schort -M -s /sbin/nologin schort
sudo chown -R schort:schort /opt/schort
sudo -u schort git clone https://github.com/sqozz/schort.git /opt/schort
sudo chmod 770 /opt/schort/data
- Install requirements:
sudo -u schort virtualenv /opt/schort/venv
sudo -u schort -s
source ./venv/bin/activate
pip install -r requirements.txt
- Configure your wsgi or fcgi server:
- Check the docs of your preferred server. E.g. gunicorn, uwsgi, fastcgi, …
- uwsgi example:
/usr/bin/uwsgi --master --daemonize /dev/null --disable-logging --plugin python39 --wsgi-file /opt/schort/schort.wsgi --post-buffering 1 --enable-threads --socket /tmp/uwsgi_schort.sock --processes 1 --fileserve-mode /opt/schort/schort.wsgi --pidfile /var/run/uwsgi_schort/schort.pid
- Configure your webserver that he talks to your wsgi/fcgi server:
- Check the docs of your preferred webserver. E.g. nginx, apache, …
- nginx example (you should really look into securing your server with https):
server {
listen 80;
listen [::]:80;
server_name schort.your.domain;
sendfile on;
client_max_body_size 20M;
keepalive_timeout 0;
location / { try_files $uri @schort; }
location @schort {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi_schort.sock;
}
}
Module | Explanation |
---|---|
Flask | Flask handels all HTTP-stuff in this application |
sqlite3 | In gentoo this useflag needs to be set while compiling python3 |
The schort.wsgi file can be set as UWSGI_PROGRAM if you use uWSGI. Keep in mind, that the UWSGI_DIR needs to be set to the path where schort.py resists. This is because schort is not installed in a global scope. Since schort.wsgi imports schort.py it needs his workspace in the same folder.