pretix¶
pretix is an open source ticketing solution. It is written in Django and can be highly customized for the process of ticket sales.
Note
For this guide you should be familiar with the basic concepts of
Python and its package manager pip
Prerequisites¶
You’ll need your MySQL credentials. Get them with my_print_defaults
:
[isabell@stardust ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=isabell
--password=MySuperSecretPassword
[isabell@stardust ~]$
Your URL needs to be setup:
[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$
Installation¶
Step 1¶
Get the pretix source code from Github and clone it to ~/pretix
, be sure to replace the pseudo branch number release/6.6.x
here with the latest release branch from the Github repository at https://github.com/pretix/pretix/branches/active:
[isabell@stardust ~]$ git clone https://github.com/pretix/pretix.git --depth=1 --branch release/6.6.x
[...]
Receiving objects: 100% (1852/1852), 7.06 MiB | 910.00 KiB/s, done.
Resolving deltas: 100% (337/337), done.
Checking connectivity... done.
[isabell@stardust ~]$
Also, you need to create an extra data folder:
[isabell@stardust ~]$ mkdir ~/pretix_data
[isabell@stardust ~]$
Step 2¶
Install the requirements for pretix:
[isabell@stardust ~]$ pip3.6 install -r ~/pretix/src/requirements.txt --user
[...]
Running setup.py install for mt-940 ... done
Running setup.py install for vobject ... done
Running setup.py install for vat-moss ... done
[...]
[isabell@stardust ~]$
Step 3¶
Now you need to set up the configuration, create the file ~/.pretix.cfg
and insert the following content:
Warning
Be sure, to replace all values with correct data of your own Uberspace account!
[pretix]
instance_name=Isabells pretix
url=https://isabell.uber.space
currency=EUR
datadir=/home/isabell/pretix_data
trust_x_forwarded_proto=on
[database]
backend=mysql
name=isabell_pretix
user=isabell
password=MySuperSecretPassword
host=localhost
[mail]
from=isabell@uber.space
host=stardust.uberspace.de
user=isabell@uber.space
password=MySuperSecretPassword
port=587
tls=on
Step 4¶
Run this code to create the database <username>_pretix
in MySQL:
[isabell@stardust ~]$ mysql -e "CREATE DATABASE ${USER}_pretix DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
[isabell@stardust ~]$
You will also need to install a mysqlclient package:
[isabell@stardust ~]$ pip3.6 install mysqlclient --user
[...]
Successfully installed mysqlclient-1.3.13
[isabell@stardust ~]$
Step 5¶
Initialize the pretix database tables and generate the static files:
[isabell@stardust ~]$ python3.6 ~/pretix/src/manage.py migrate
[isabell@stardust ~]$ python3.6 ~/pretix/src/manage.py rebuild
[isabell@stardust ~]$
Step 6¶
Install Gunicorn as backend server:
[isabell@stardust ~]$ pip3.6 install gunicorn --user
[isabell@stardust ~]$
Step 7¶
Note
Pretix is running on port 9000.
To make the application accessible from the outside, configure a web backend:
[isabell@stardust ~]$ uberspace web backend set / --http --port <port>
Set backend for / to port <port>; please make sure something is listening!
You can always check the status of your backend using "uberspace web backend list".
[isabell@stardust ~]$
Step 8¶
Finally, you should set up a service that keeps pretix alive while you are gone. Therefor create the file ~/etc/services.d/pretix.ini
with the following content:
[program:pretix]
command=gunicorn --reload --chdir %(ENV_HOME)s/pretix/src --bind 0.0.0.0:9000 --workers 4 pretix.wsgi --name pretix --max-requests 1200 --max-requests-jitter 50
autostart=true
autorestart=true
stopsignal=INT
After creating the configuration, tell supervisord to refresh its configuration and start the service:
[isabell@stardust ~]$ supervisorctl reread
SERVICE: available
[isabell@stardust ~]$ supervisorctl update
SERVICE: added process group
[isabell@stardust ~]$ supervisorctl status
SERVICE RUNNING pid 26020, uptime 0:03:14
[isabell@stardust ~]$
If it’s not in state RUNNING, check your configuration.
Step 9
Now point your Browser to your installation URL https://isabell.uber.space
. You will find the administration panel at https://isabell.uber.space/control
.
——
Use admin@localhost
as username and admin
as password for your first login. You should change this password immediately after login!
Updates¶
Note
Check the update feed regularly to stay informed about the newest version.
If there is a new version available, update your branch according to the version number (v6.6.6
would be release/6.6.x
)
[isabell@stardust ~]$ cd ~/pretix
[isabell@stardust pretix]$ git pull origin release/6.6.x
[isabell@stardust pretix]$
Tested with pretix 2.1.0 and Uberspace 7.1.15.0
Written by: ezra <ezra@posteo.de>This guide was written with the help of a former text on “bullshit”, thanks to Nathan.