Free and open source ticket system written in python
1# Deploying paw with Docker Compose 2 3## Prerequisites 4 5- [Docker installed](https://docs.docker.com/engine/install/) on your machine 6- Docker Compose plugin installed on your machine 7 8## Deployment with `sqlite` database 9 10Example `docker-compose.yml` file: 11 12```yaml 13version: "3.8" 14services: 15 paw: 16 image: ghcr.io/aottr/paw:latest 17 container_name: paw-ticket-system 18 restart: unless-stopped 19 ports: 20 - "127.0.0.1:8000:8000" 21 volumes: 22 - db:/usr/src/app/db.sqlite3 23 - media:/usr/src/app/media 24 environment: 25 - DATABASE_ENGINE=sqlite3 26 - DEBUG=true 27 - ALLOWED_HOSTS=example.org,example.com 28 - SECRET_KEY=your-secret-key 29``` 30 31The env variable `DATABASE_ENGINE` must be set to `sqlite3`, otherwise paw expects database credentials and another supported engine, e.g. `postgresql` 32 33### Production Deployment 34 35If, for whatever reason, a production deployment should be used with **sqlite3**, the `media` files need to be served with a webserver / reverse proxy, e.g. nginx. This should also happen with static files. 36 37For this we slightly modify the deployment volumes: 38 39```yaml 40volumes: 41 - db:/usr/src/app/db.sqlite3 42 - /opt/paw/media:/usr/src/app/media 43 - /opt/paw/static:/usr/src/app/static 44``` 45 46Now you write directives in your config to host these files, the following snipped shows an example nginx config: 47 48#### Example nginx config 49 50```nginx 51upstream paw { 52 server localhost:8000; 53} 54 55server { 56 57 server_name example.org example.com 58 listen 80; 59 listen [::]:80; 60 61 location /media/ { 62 # media files, uploaded by us 63 alias /opt/paw/media/; # ending slash is required 64 } 65 66 location /static/ { 67 # static files, uploaded by the system 68 alias /opt/paw/static/; # ending slash is required 69 } 70 71 location / { 72 proxy_pass http://paw; 73 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 74 proxy_set_header Host $host; 75 proxy_redirect off; 76 } 77} 78``` 79 80#### Example Caddyfile 81 82``` 83example.com { 84 85 handle /static/* { 86 file_server /opt/paw/static/* 87 } 88 89 handle /media/* { 90 file_server /opt/paw/media/* 91 } 92 93 handle { 94 reverse_proxy 127.0.0.1:8000 95 } 96} 97``` 98 99That's it! You have successfully deployed your project using Docker Compose.