diff --git a/README.md b/README.md index 6de7812..57a0f19 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,10 @@ This repository contains a docker-compose setup as well as an [ansible](https:// * Edit ``conf/pretalx.cfg`` and fill in your own values (→ [configuration documentation](https://docs.pretalx.org/en/latest/administrator/configure.html)) -* Edit ``docker-compose.yml`` and remove the complete section with ``ports: - "80:80"`` from the file (if you go with - traefic as reverse proxy) or change the line to ``ports: - "127.0.0.1:8355:80"`` (if you use nginx). **Change the - database password.** +* Edit ``docker-compose.yml`` + * If you plan to run a nginx within docker-compose remove the complete section with ``ports: - "80:80"`` and unremark out the ``web`` container section. + Make sure to edit the deployment\docker\nginx.conf to suit your needs + * **Change the database password.** * If you don't want to use docker volumes, create directories for the persistent data and make them read-writeable for the userid 999 and the groupid 999. Change ``pretalx-redis``, ``pretalx-db``, ``pretalx-data`` and ``pretalx-public`` to the corresponding directories you've chosen. @@ -28,7 +29,7 @@ This repository contains a docker-compose setup as well as an [ansible](https:// is located at ``reverse-proxy-examples/docker-compose``. You can also find a few words on an nginx configuration at ``reverse-proxy-examples/nginx`` * Make sure you serve all requests for the `/static/` and `/media/` paths (when `debug=false`). See [installation](https://docs.pretalx.org/administrator/installation/#step-7-ssl) for more information -* Optional: Some of the Gunicorn parameters can be adjusted via environment viariables: +* Optional: Some of the Gunicorn parameters can be adjusted via environment variables: * To adjust the number of [Gunicorn workers](https://docs.gunicorn.org/en/stable/settings.html#workers), provide the container with `GUNICORN_WORKERS` environment variable. * `GUNICORN_MAX_REQUESTS` and `GUNICORN_MAX_REQUESTS_JITTER` to configure the requests a worker instance will process before restarting. diff --git a/deployment/docker/nginx.conf b/deployment/docker/nginx.conf new file mode 100644 index 0000000..b29e5a6 --- /dev/null +++ b/deployment/docker/nginx.conf @@ -0,0 +1,65 @@ +user www-data www-data; +worker_processes 1; +pid /var/run/nginx.pid; + +events { + worker_connections 768; +} + +http { + server_tokens off; + 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; + add_header X-Content-Type-Options nosniff; + + access_log /var/log/nginx/access.log private; + error_log /var/log/nginx/error.log; + add_header Referrer-Policy same-origin; + + 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 /public/media/; + expires 7d; + access_log off; + } + + location /static/ { + alias /public/static/; + access_log off; + expires 365d; + add_header Cache-Control "public"; + } + location / { + proxy_pass http://pretalx:80; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + } + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e3cfabc..377be08 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,24 @@ services: traefik.docker.network: "pretalxdocker" traefik.enable: "true" + # Hint: Unremark this section, if you want to run the webserver within docker network. + # Make sure to also remark out the "80:80" in the pretalx container section + # See README for more details + + # web: + # image: nginx:latest + # container_name: pretalx-web + # restart: unless-stopped + # ports: + # - "80:80" + # - "443:443" + # depends_on: + # - pretalx + # volumes: + # - ./deployment/docker/nginx.conf:/etc/nginx/nginx.conf + # - pretalx-data:/data + # - pretalx-public:/public + db: image: mysql:latest container_name: pretalx-db @@ -34,6 +52,8 @@ services: MYSQL_RANDOM_ROOT_PASSWORD: "1" command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci'] + + redis: image: redis:latest container_name: pretalx-redis