Browse Source

docs: moar deploy

main
decentral1se 4 days ago
parent
commit
7e4c77eb0d
No known key found for this signature in database GPG Key ID: 3789458B3D0C410
  1. 53
      README.md

53
README.md

@ -12,3 +12,56 @@ Requires Python >= 3.11.x 👍
pip install gunicorn pip install gunicorn
gunicorn --bind 127.0.0.1:5000 upload:APP gunicorn --bind 127.0.0.1:5000 upload:APP
``` ```
## nginx
Something like this. You need to replace `<DOMAIN>` / `<YOUR-MESSAGE>` /
`<ABS-PATH>`. 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 <DOMAIN>;
location / {
proxy_pass http://gunicorn;
auth_basic "<YOUR-MESSAGE>";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location /static/images/ {
autoindex on;
alias /var/www/<ABS-PATH>/static/images/;
}
}
```
## systemd
```
[Unit]
Description=image_upload
After=syslog.target network.target
[Service]
User=<USER>
WorkingDirectory=<ABS-PATH>
ExecStart=<ABS-PATH>/.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 `<USER>` with your preferred system user. `<ABS-PATH>` should
be the system path when the repository is cloned. Note, a virtual environment
was created at `<ABS-PATH>/.venv/...` with the dependencies installed.

Loading…
Cancel
Save