mirror of
https://github.com/pretix/pretix.git
synced 2026-08-29 13:44:40 +00:00
Add plugin installation docs and rebuild command
This commit is contained in:
@@ -33,7 +33,7 @@ fi
|
|||||||
|
|
||||||
if [ "$1" == "taskworker" ]; then
|
if [ "$1" == "taskworker" ]; then
|
||||||
export C_FORCE_ROOT=True
|
export C_FORCE_ROOT=True
|
||||||
exec celery -A pretix worker -l info
|
exec celery -A pretix.celery_app worker -l info
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "shell" ]; then
|
if [ "$1" == "shell" ]; then
|
||||||
|
|||||||
@@ -235,6 +235,26 @@ Updates are fairly simple, but require at least a short downtime::
|
|||||||
|
|
||||||
Restarting the service can take a few seconds, especially if the update requires changes to the database.
|
Restarting the service can take a few seconds, especially if the update requires changes to the database.
|
||||||
|
|
||||||
|
Install a plugin
|
||||||
|
----------------
|
||||||
|
|
||||||
|
To install a plugin, you need to build your own docker image. To do so, create a new directory and place a file
|
||||||
|
named ``Dockerfile`` in it. The Dockerfile could look like this (replace ``pretix-passbook`` with the plugins of your
|
||||||
|
choice)::
|
||||||
|
|
||||||
|
FROM pretix/standalone
|
||||||
|
USER root
|
||||||
|
RUN pip3 install pretix-passbook
|
||||||
|
USER pretixuser
|
||||||
|
RUN make production
|
||||||
|
|
||||||
|
Then, go to that directory and build the image::
|
||||||
|
|
||||||
|
$ docker build -t mypretix
|
||||||
|
|
||||||
|
You can now use that image ``mypretix`` instead of ``pretix/standalone`` in your service file (see above). Be sure
|
||||||
|
to re-build your custom image after you pulled ``pretix/standalone`` if you want to perform an update.
|
||||||
|
|
||||||
.. _Docker: https://docs.docker.com/engine/installation/linux/debian/
|
.. _Docker: https://docs.docker.com/engine/installation/linux/debian/
|
||||||
.. _Postfix: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04
|
.. _Postfix: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04
|
||||||
.. _nginx: https://botleg.com/stories/https-with-lets-encrypt-and-nginx/
|
.. _nginx: https://botleg.com/stories/https-with-lets-encrypt-and-nginx/
|
||||||
|
|||||||
@@ -105,8 +105,8 @@ Fill the configuration file ``/etc/pretix/pretix.cfg`` with the following conten
|
|||||||
|
|
||||||
See :ref:`email configuration <mail-settings>` to learn more about configuring mail features.
|
See :ref:`email configuration <mail-settings>` to learn more about configuring mail features.
|
||||||
|
|
||||||
Install pretix from source
|
Install pretix from PyPI
|
||||||
--------------------------
|
------------------------
|
||||||
|
|
||||||
Now we will install pretix itself. The following steps are to be executed as the ``pretix`` user. Before we
|
Now we will install pretix itself. The following steps are to be executed as the ``pretix`` user. Before we
|
||||||
actually install pretix, we will create a virtual environment to isolate the python packages from your global
|
actually install pretix, we will create a virtual environment to isolate the python packages from your global
|
||||||
@@ -116,14 +116,10 @@ python installation::
|
|||||||
$ source /var/pretix/venv/bin/activate
|
$ source /var/pretix/venv/bin/activate
|
||||||
(venv)$ pip3 install -U pip setuptools wheel
|
(venv)$ pip3 install -U pip setuptools wheel
|
||||||
|
|
||||||
We now clone pretix and install its Python dependencies (replace ``mysql`` with ``postgres`` if you're running
|
We now install pretix, its direct dependencies and gunicorn. Replace ``mysql`` with ``postgres`` in the following
|
||||||
PostgreSQL)::
|
command if you're running PostgreSQL::
|
||||||
|
|
||||||
(venv)$ git clone https://github.com/pretix/pretix.git /var/pretix/source
|
(venv)$ pip install "pretix[mysql]" gunicorn
|
||||||
(venv)$ cd /var/pretix/source/src
|
|
||||||
(venv)$ pip3 install -r requirements.txt -r requirements/mysql.txt \
|
|
||||||
-r requirements/redis.txt \
|
|
||||||
-r requirements/py34.txt gunicorn
|
|
||||||
|
|
||||||
We also need to create a data directory::
|
We also need to create a data directory::
|
||||||
|
|
||||||
@@ -131,8 +127,8 @@ We also need to create a data directory::
|
|||||||
|
|
||||||
Finally, we compile static files and translation data and create the database structure::
|
Finally, we compile static files and translation data and create the database structure::
|
||||||
|
|
||||||
(venv)$ make production
|
(venv)$ python -m pretix rebuild
|
||||||
(venv)$ python manage.py migrate
|
(venv)$ python -m pretix migrate
|
||||||
|
|
||||||
|
|
||||||
Start pretix as a service
|
Start pretix as a service
|
||||||
@@ -171,7 +167,7 @@ For background tasks we need a second service ``/etc/systemd/system/pretix-worke
|
|||||||
Group=pretix
|
Group=pretix
|
||||||
Environment="VIRTUAL_ENV=/var/pretix/venv"
|
Environment="VIRTUAL_ENV=/var/pretix/venv"
|
||||||
Environment="PATH=/var/pretix/venv/bin:/usr/local/bin:/usr/bin:/bin"
|
Environment="PATH=/var/pretix/venv/bin:/usr/local/bin:/usr/bin:/bin"
|
||||||
ExecStart=/var/pretix/venv/bin/celery -A pretix worker -l info
|
ExecStart=/var/pretix/venv/bin/celery -A pretix.celery_app worker -l info
|
||||||
WorkingDirectory=/var/pretix/source/src
|
WorkingDirectory=/var/pretix/source/src
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
@@ -191,7 +187,7 @@ Cronjob
|
|||||||
You need to set up a cronjob that runs the management command ``runperiodic``. The exact interval is not important
|
You need to set up a cronjob that runs the management command ``runperiodic``. The exact interval is not important
|
||||||
but should be something between every minute and every hour. You could for example configure cron like this::
|
but should be something between every minute and every hour. You could for example configure cron like this::
|
||||||
|
|
||||||
15,45 * * * * export PATH=/var/pretix/venv/bin:$PATH && cd /var/pretix/source/src && ./manage.py runperiodic
|
15,45 * * * * export PATH=/var/pretix/venv/bin:$PATH && cd /var/pretix/source/src && python -m pretix runperiodic
|
||||||
|
|
||||||
The cronjob should run as the ``pretix`` user (``crontab -e -u pretix``).
|
The cronjob should run as the ``pretix`` user (``crontab -e -u pretix``).
|
||||||
|
|
||||||
@@ -254,16 +250,27 @@ To upgrade to a new pretix release, pull the latest code changes and run the fol
|
|||||||
``mysql`` with ``postgres`` if necessary)::
|
``mysql`` with ``postgres`` if necessary)::
|
||||||
|
|
||||||
$ source /var/pretix/venv/bin/activate
|
$ source /var/pretix/venv/bin/activate
|
||||||
(venv)$ cd /var/pretix/source/src
|
(venv)$ pip3 install -U pretix[mysql] gunicorn
|
||||||
(venv)$ git pull origin master
|
(venv)$ python -m pretix migrate
|
||||||
(venv)$ pip3 install -r requirements.txt -r requirements/mysql.txt \
|
(venv)$ python -m pretix rebuild
|
||||||
-r requirements/redis.txt \
|
(venv)$ python -m pretix updatestyles
|
||||||
-r requirements/py34.txt gunicorn
|
|
||||||
(venv)$ python manage.py migrate
|
|
||||||
(venv)$ make production
|
|
||||||
(venv)$ python manage.py updatestyles
|
|
||||||
# systemctl restart pretix-web pretix-worker
|
# systemctl restart pretix-web pretix-worker
|
||||||
|
|
||||||
|
|
||||||
|
Install a plugin
|
||||||
|
----------------
|
||||||
|
|
||||||
|
To install a plugin, just use ``pip``! Depending on the plugin, you should probably apply database migrations and
|
||||||
|
rebuild the static files afterwards. Replace ``pretix-passbook`` with the plugin of your choice in the following
|
||||||
|
example::
|
||||||
|
|
||||||
|
$ source /var/pretix/venv/bin/activate
|
||||||
|
(venv)$ pip3 install pretix-passbook
|
||||||
|
(venv)$ python -m pretix migrate
|
||||||
|
(venv)$ python -m pretix rebuild
|
||||||
|
# systemctl restart pretix-web pretix-worker
|
||||||
|
|
||||||
|
|
||||||
.. _Postfix: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04
|
.. _Postfix: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04
|
||||||
.. _nginx: https://botleg.com/stories/https-with-lets-encrypt-and-nginx/
|
.. _nginx: https://botleg.com/stories/https-with-lets-encrypt-and-nginx/
|
||||||
.. _Let's Encrypt: https://letsencrypt.org/
|
.. _Let's Encrypt: https://letsencrypt.org/
|
||||||
|
|||||||
@@ -18,3 +18,7 @@ class PretixBaseConfig(AppConfig):
|
|||||||
|
|
||||||
|
|
||||||
default_app_config = 'pretix.base.PretixBaseConfig'
|
default_app_config = 'pretix.base.PretixBaseConfig'
|
||||||
|
try:
|
||||||
|
import pretix.celery_app as celery # NOQA
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
from django.core.management import call_command
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
from ...signals import periodic_task
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = "Rebuild static files and language files"
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
periodic_task.send(self)
|
||||||
|
call_command('compilemessages', verbosity=1, interactive=False)
|
||||||
|
call_command('compilejsi18n', verbosity=1, interactive=False)
|
||||||
|
call_command('collectstatic', verbosity=1, interactive=False)
|
||||||
|
call_command('compress', verbosity=1, interactive=False)
|
||||||
Reference in New Issue
Block a user