# Drakul Drakul is an online system for organising and managing the raids and members of a World of Warcraft guild. Thanks for checking it out. ## Setup The following steps installs the application in `/opt/drakul/` and configures nginx to reverse proxy it using uwsgi. While the instructions are focused on Debian 10 Buster, it might work on other distributions as well. Start by installing the required packages: ```bash apt install git python3 python3-venv nginx uwsgi uwsgi-plugin-python3 ``` Create a system user for running the application: ```bash adduser \ --system \ --shell /bin/bash \ --group \ --disabled-password \ --home /opt/drakul \ drakul ``` Clone the code: ```bash su - drakul git clone https://git.caspervk.net/caspervk/drakul /opt/drakul ``` Setup virtual environment and install dependencies: ```bash python3 -m venv venv source venv/bin/activate pip install -r requirements.txt deactivate ``` Add the uwsgi configuration file, `/etc/uwsgi/apps-available/drakul.ini`: ```ini [uwsgi] workers = 2 chdir = /opt/drakul/ venv = /opt/drakul/venv module = drakul.base.wsgi:application socket = /run/uwsgi/app/drakul/socket chown-socket = www-data chmod-socket = 660 vacuum = true daemonize = /var/log/uwsgi/app/drakul.log uid = drakul gid = drakul plugins = python3 exec-pre-app = venv/bin/python manage.py migrate --no-input exec-pre-app = venv/bin/python manage.py collectstatic --no-input ; Change these as needed env = DJANGO_SETTINGS_MODULE=drakul.base.settings.production env = SECRET_KEY=hunter2 ; the result of 'head -c 56 /dev/random | base64' is a good idea env = ALLOWED_HOSTS=drakul.example.com ``` Enable the application in uwsgi: ```bash ln -s /etc/uwsgi/apps-available/drakul.ini /etc/uwsgi/apps-enabled service uwsgi restart ``` Add the following to your `/etc/nginx/sites-available/drakul.example.com`: ```text location / { include uwsgi_params; uwsgi_pass unix:/run/uwsgi/app/drakul/socket; } location /static/ { alias /opt/drakul/drakul/static/; } ``` That's it! After restarting nginx everything should work. ### Environment variables Defaults are bolded. Django * `DJANGO_SETTINGS_MODULE`: **`drakul.base.settings.production`**. * `SECRET_KEY`: The result of running `head -c 56 /dev/random | base64` is a good idea. * `ALLOWED_HOSTS`: A comma-separated list of the domain names Django is allowed to serve. Security measure to prevent HTTP Host header attacks. Only used and required in production. Database ([docs](https://docs.djangoproject.com/en/dev/ref/settings/#databases)) * `DB_ENGINE`: **django.db.backends.sqlite3**. * `DB_DB_NAME`: **db.sqlite3**. * `DB_HOSTNAME`: **localhost**. * `DB_PORT`: **5432**. * `DB_USERNAME`: **root**. * `DB_PASSWORD`: **root**. ## Development ```bash # Configure environment source activate.sh # Create admin user m createsuperuser # Start the server m runserver 8000 ```