mirror of
https://github.com/pretix/pretix.git
synced 2026-08-18 12:06:26 +00:00
Updated standalone docker file and install guide
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
user www-data www-data;
|
||||
worker_processes 1;
|
||||
pid /var/run/nginx.pid;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
}
|
||||
|
||||
http {
|
||||
sendfile on;
|
||||
charset utf-8;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
client_max_body_size 100M;
|
||||
|
||||
log_format private '[$time_local] $host "$request" $status $body_bytes_sent';
|
||||
|
||||
types_hash_max_size 2048;
|
||||
server_names_hash_bucket_size 64;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
access_log /var/log/nginx/access.log private;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml image/svg+xml;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 ipv6only=on default_server;
|
||||
server_name _;
|
||||
index index.php index.html;
|
||||
root /var/www;
|
||||
|
||||
location /media/ {
|
||||
alias /data/media/;
|
||||
expires 7d;
|
||||
access_log off;
|
||||
}
|
||||
location /static/ {
|
||||
alias /static/;
|
||||
access_log off;
|
||||
expires 365d;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://unix:/tmp/pretix.sock:/;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
cd /pretix/src
|
||||
export DJANGO_SETTINGS_MODULE=production_settings
|
||||
export DATA_DIR=/data/
|
||||
NUM_WORKERS=10
|
||||
|
||||
if [ ! -d /data/logs ]; then
|
||||
mkdir /data/logs;
|
||||
fi
|
||||
if [ ! -d /data/media ]; then
|
||||
mkdir /data/media;
|
||||
fi
|
||||
|
||||
if [ "$1" == "cron" ]; then
|
||||
exec python3 -m pretix runperiodic
|
||||
fi
|
||||
|
||||
python3 -m pretix migrate --noinput
|
||||
|
||||
if [ "$1" == "all" ]; then
|
||||
exec sudo /usr/bin/supervisord -n -c /etc/supervisord.conf
|
||||
fi
|
||||
|
||||
if [ "$1" == "webworker" ]; then
|
||||
exec gunicorn pretix.wsgi \
|
||||
--name pretix \
|
||||
--workers $NUM_WORKERS \
|
||||
--max-requests 1200 \
|
||||
--max-requests-jitter 50 \
|
||||
--log-level=info \
|
||||
--bind=unix:/tmp/pretix.sock
|
||||
fi
|
||||
|
||||
if [ "$1" == "taskworker" ]; then
|
||||
export C_FORCE_ROOT=True
|
||||
exec celery -A pretix worker -l info
|
||||
fi
|
||||
|
||||
if [ "$1" == "shell" ]; then
|
||||
exec python3 -m pretix shell
|
||||
fi
|
||||
|
||||
echo "Specify argument: all|cron|webworker|taskworker|shell"
|
||||
exit 1
|
||||
@@ -0,0 +1,6 @@
|
||||
from pretix.settings import *
|
||||
|
||||
|
||||
LOGGING['handlers']['mail_admins']['include_html'] = True
|
||||
STATIC_ROOT = '/static'
|
||||
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
|
||||
@@ -1,38 +0,0 @@
|
||||
FROM debian:jessie
|
||||
|
||||
RUN apt-get update && apt-get install -y python3 git python3-pip \
|
||||
libxml2-dev libxslt1-dev python-dev python-virtualenv locales libffi-dev \
|
||||
build-essential python3-dev zlib1g-dev libssl-dev gettext git \
|
||||
libpq-dev libmysqlclient-dev libmemcached-dev libjpeg-dev \
|
||||
aqbanking-tools \
|
||||
--no-install-recommends
|
||||
|
||||
WORKDIR /
|
||||
|
||||
RUN dpkg-reconfigure locales && \
|
||||
locale-gen C.UTF-8 && \
|
||||
/usr/sbin/update-locale LANG=C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN git clone --recursive --depth 1 https://github.com/pretix/pretix.git /pretix
|
||||
WORKDIR /pretix/src
|
||||
|
||||
RUN pip3 install -r requirements.txt -r requirements/mysql.txt -r requirements/postgres.txt \
|
||||
-r requirements/memcached.txt -r requirements/celery.txt -r requirements/redis.txt \
|
||||
-r requirements/py34.txt gunicorn
|
||||
|
||||
RUN make
|
||||
|
||||
RUN mkdir /etc/pretix
|
||||
RUN mkdir /data
|
||||
VOLUME /etc/pretix
|
||||
|
||||
ADD pretix.bash /usr/local/bin/pretix
|
||||
RUN chmod +x /usr/local/bin/pretix
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["pretix"]
|
||||
CMD ["web"]
|
||||
@@ -1,3 +0,0 @@
|
||||
main:
|
||||
#tar ch --exclude=_static --exclude=htmlcov --exclude=db.sqlite3 . |
|
||||
docker build -t pretix/standalone .
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
cd /pretix/src
|
||||
export DJANGO_SETTINGS_MODULE=pretix.settings
|
||||
export DATA_DIR=/data/
|
||||
NUM_WORKERS=25
|
||||
|
||||
if [ ! -d /data/logs ]; then
|
||||
mkdir /data/logs;
|
||||
fi
|
||||
if [ ! -d /data/media ]; then
|
||||
mkdir /data/media;
|
||||
fi
|
||||
|
||||
if [ "$1" == "web" ]; then
|
||||
python3 manage.py collectstatic --noinput
|
||||
python3 manage.py compress
|
||||
exec gunicorn pretix.wsgi \
|
||||
--name pretix \
|
||||
--workers $NUM_WORKERS \
|
||||
--max-requests 1200 \
|
||||
--max-requests-jitter 50 \
|
||||
--log-level=info \
|
||||
--bind=0.0.0.0:80
|
||||
fi
|
||||
|
||||
if [ "$1" == "worker" ]; then
|
||||
exec celery -A pretix worker -l info
|
||||
fi
|
||||
|
||||
if [ "$1" == "migrate" ]; then
|
||||
exec python manage.py migrate --noinput
|
||||
fi
|
||||
|
||||
if [ "$1" == "shell" ]; then
|
||||
exec python manage.py shell
|
||||
fi
|
||||
|
||||
echo "Specify argument: web|worker|migrate|shell"
|
||||
exit 1
|
||||
@@ -0,0 +1,43 @@
|
||||
[unix_http_server]
|
||||
file=/tmp/supervisor.sock
|
||||
|
||||
[supervisord]
|
||||
logfile=/tmp/supervisord.log
|
||||
logfile_maxbytes=50MB
|
||||
logfile_backups=10
|
||||
loglevel=info
|
||||
pidfile=/tmp/supervisord.pid
|
||||
nodaemon=false
|
||||
minfds=1024
|
||||
minprocs=200
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///tmp/supervisor.sock
|
||||
|
||||
[program:pretixweb]
|
||||
command=/usr/local/bin/pretix webworker
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=5
|
||||
user=pretixuser
|
||||
|
||||
[program:pretixtask]
|
||||
command=/usr/local/bin/pretix taskworker
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=5
|
||||
user=pretixuser
|
||||
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=10
|
||||
stdout_events_enabled=true
|
||||
stderr_events_enabled=true
|
||||
|
||||
[include]
|
||||
files = /etc/supervisord-*.conf
|
||||
Reference in New Issue
Block a user