From 7e4c77eb0df7af3c54bad177db7385d6f8005a9c Mon Sep 17 00:00:00 2001 From: decentral1se Date: Sun, 17 Nov 2024 16:25:23 +0100 Subject: [PATCH] docs: moar deploy --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/README.md b/README.md index 74a48c7..81c06d5 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,56 @@ Requires Python >= 3.11.x 👍 pip install gunicorn gunicorn --bind 127.0.0.1:5000 upload:APP ``` + +## nginx + +Something like this. You need to replace `` / `` / +``. It's advised to protect `image_upload` beside some form of +authentication to avoid nasty surprises. + +``` +upstream gunicorn { + server 127.0.0.1:5000 fail_timeout=0; +} + +server { + listen 80; + listen 443 ssl; + + server_name ; + + location / { + proxy_pass http://gunicorn; + auth_basic ""; + auth_basic_user_file /etc/nginx/.htpasswd; + } + + location /static/images/ { + autoindex on; + alias /var/www//static/images/; + } +} +``` + +## systemd + +``` +[Unit] +Description=image_upload +After=syslog.target network.target + +[Service] +User= +WorkingDirectory= +ExecStart=/.venv/bin/gunicorn --bind 127.0.0.1:5000 upload:APP +RemainAfterExit=no +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target +``` + +Where you replace `` with your preferred system user. `` should +be the system path when the repository is cloned. Note, a virtual environment +was created at `/.venv/...` with the dependencies installed.