Fly, bitch!

On deploying wagtail

I just deployed wagtail for the first time. It was easier than I thought, but I still had to spend half a day before I finally figured it out. All the steps I did:

  • rsync'ed everything to my server
  • setup caddy as a reverse proxy
  • run gunicorn on my own
  • use supervisord to work with gunicorn

I had to pip install gunicorn as dependency in my virtual environment. This is also the point where I was struggling. For some reason, I had to come up with a bash script, which activates the venv before. Long story short, it works now!

/srv/http/fifteen_eleven/supervisord.ini

[program:fifteen_eleven]
environment=DJANGO_SETTINGS_MODULE='config.settings.production'
command=/srv/http/fifteen_eleven/venv/bin/gunicorn -b localhost:8000 config.wsgi
directory=/srv/http/fifteen_eleven
user=manu
autostart=true
autorestart=true
redirect_stderr=true

/etc/caddy/conf.d/fifteen_eleven.conf

151190.xyz {
        root * /srv/http/fifteen_eleven/

        handle_path /static/* {
                root * /srv/http/fifteen_eleven/static/
                file_server
        }

        handle_path /media/* {
                root * /srv/http/fifteen_eleven/media/
                file_server
        }

        reverse_proxy localhost:8000
        encode zstd gzip
}