added deployment instructions and fixed some deployment issues.

This commit is contained in:
Tech 2018-03-27 20:02:47 +02:00
parent 670a1a6d8f
commit a3e33c36c6
5 changed files with 36 additions and 9 deletions

View file

@ -74,14 +74,12 @@ We wrote these installation notes, so you can set up the website easily:
To Do: To Do:
```shell ```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: Install the necessary packages, create and activate virtualenv:
```shell ```shell
@ -105,6 +103,12 @@ vim config.toml
This configuration is only for the admin. Users can log into This configuration is only for the admin. Users can log into
twitter/mastodon/mail and configure their personal bot on the settings page. 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: Deploy ticketfrei with uwsgi:
```shell ```shell
@ -115,7 +119,8 @@ sudo sed -r "s/example.org/$DOMAIN/g" deployment/example.org.conf > /etc/nginx/s
# create folder for socket # create folder for socket
sudo mkdir /var/run/ticketfrei 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 # start up nginx
sudo service nginx restart sudo service nginx restart
@ -125,3 +130,18 @@ sudo cp deployment/ticketfrei-web.service /etc/systemd/system/
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl start ticketfrei-web.service 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
```

0
config.py Normal file → Executable file
View file

View file

@ -3,6 +3,7 @@ Description=Ticketfrei Web Application
After=syslog.target network.target After=syslog.target network.target
[Service] [Service]
WorkingDirectory=/srv/ticketfrei
ExecStart=/usr/bin/uwsgi --ini /srv/ticketfrei/deployment/uwsgi.ini ExecStart=/usr/bin/uwsgi --ini /srv/ticketfrei/deployment/uwsgi.ini
# Requires systemd version 211 or newer # Requires systemd version 211 or newer
RuntimeDirectory=uwsgi RuntimeDirectory=uwsgi

View file

@ -4,8 +4,8 @@ master = true
uid = www-data uid = www-data
gid = www-data gid = www-data
processes = 1 processes = 1
# logto = /var/log/ticketfrei.log logto = /var/log/ticketfrei/uwsgi.log
socket = /var/run/ticketfrei/ticketfrei.sock socket = /var/run/ticketfrei/ticketfrei.sock
chmod-socket = 660 chmod-socket = 660
wsgi-file = /srv/ticketfrei/frontend.py wsgi-file = /srv/ticketfrei/frontend.py
virtualenv = /srv/ticketfrei/venv virtualenv = /srv/ticketfrei

6
wsgi.py Normal file
View file

@ -0,0 +1,6 @@
import sys
sys.path.insert(0, '/srv/pythonenv/lib/python3.5/site-packages/')
# import web application
from frontend import application