From 32855fb50db12e06a40f30329b26df134ca39d2b Mon Sep 17 00:00:00 2001 From: Tech Date: Tue, 27 Mar 2018 20:02:47 +0200 Subject: [PATCH] added deployment instructions and fixed some deployment issues. --- README.md | 34 ++++++++++++++++++++++++------- config.py | 0 deployment/ticketfrei-web.service | 1 + deployment/uwsgi.ini | 4 ++-- wsgi.py | 6 ++++++ 5 files changed, 36 insertions(+), 9 deletions(-) mode change 100644 => 100755 config.py create mode 100644 wsgi.py diff --git a/README.md b/README.md index 1d2225d..7abf5ed 100644 --- a/README.md +++ b/README.md @@ -74,14 +74,12 @@ We wrote these installation notes, so you can set up the website easily: To Do: ```shell -sudo apt install python3 virtualenv uwsgi uwsgi-plugin-python3 nginx +sudo apt install python3 virtualenv uwsgi uwsgi-plugin-python3 nginx git +cd /srv +sudo git clone https://github.com/b3yond/ticketfrei +cd ticketfrei ``` -* set up nginx -* set up LetsEncrypt https://certbot.eff.org/ -* set up mariadb -* set up uwsgi - Install the necessary packages, create and activate virtualenv: ```shell @@ -105,6 +103,12 @@ vim config.toml This configuration is only for the admin. Users can log into twitter/mastodon/mail and configure their personal bot on the settings page. +Set up LetsEncrypt: +```shell +sudo apt-get install python-certbot-nginx -t stretch-backports +sudo certbot --authenticator webroot --installer nginx --agree-tos --redirect --hsts +``` + Deploy ticketfrei with uwsgi: ```shell @@ -115,7 +119,8 @@ sudo sed -r "s/example.org/$DOMAIN/g" deployment/example.org.conf > /etc/nginx/s # create folder for socket sudo mkdir /var/run/ticketfrei -sudo chown tech:www-data -R /var/run/ticketfrei +sudo chown www-data:www-data -R /var/run/ticketfrei +sudo chown www-data:www-data -R /var/log/ticketfrei # start up nginx sudo service nginx restart @@ -125,3 +130,18 @@ sudo cp deployment/ticketfrei-web.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl start ticketfrei-web.service ``` + +### Logs + +There are several logfiles which you can look at: + +``` +# for the uwsgi deployment: +less /var/log/ticketfrei/uwsgi.log + +# for the systemd service: +less /var/log/syslog + +# for the nginx web server: +less /var/log/nginx/example.org_error.log +``` diff --git a/config.py b/config.py old mode 100644 new mode 100755 diff --git a/deployment/ticketfrei-web.service b/deployment/ticketfrei-web.service index 9ffbd00..b98d76f 100644 --- a/deployment/ticketfrei-web.service +++ b/deployment/ticketfrei-web.service @@ -3,6 +3,7 @@ Description=Ticketfrei Web Application After=syslog.target network.target [Service] +WorkingDirectory=/srv/ticketfrei ExecStart=/usr/bin/uwsgi --ini /srv/ticketfrei/deployment/uwsgi.ini # Requires systemd version 211 or newer RuntimeDirectory=uwsgi diff --git a/deployment/uwsgi.ini b/deployment/uwsgi.ini index bcb8257..4fc73ad 100644 --- a/deployment/uwsgi.ini +++ b/deployment/uwsgi.ini @@ -4,8 +4,8 @@ master = true uid = www-data gid = www-data processes = 1 -# logto = /var/log/ticketfrei.log +logto = /var/log/ticketfrei/uwsgi.log socket = /var/run/ticketfrei/ticketfrei.sock chmod-socket = 660 wsgi-file = /srv/ticketfrei/frontend.py -virtualenv = /srv/ticketfrei/venv +virtualenv = /srv/ticketfrei diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..0e5a3be --- /dev/null +++ b/wsgi.py @@ -0,0 +1,6 @@ +import sys + +sys.path.insert(0, '/srv/pythonenv/lib/python3.5/site-packages/') + +# import web application +from frontend import application