- deploy.sh: git pull, pip install, migrate, collectstatic, restart gunicorn - webhook_receiver.py: HTTP server con verifica HMAC-SHA256 Gitea - olimpic-nastri-webhook.service: systemd unit per il receiver - Nginx: aggiunto proxy /webhook/deploy → porta 9000 - sudoers: restart gunicorn senza password per deploy automatico
47 lines
1.2 KiB
Nginx Configuration File
47 lines
1.2 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name diario.olimpic.click;
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/html;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
server_name diario.olimpic.click;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/diario.olimpic.click/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/diario.olimpic.click/privkey.pem;
|
|
|
|
location /static/ {
|
|
alias /home/marco/olimpic_nastri/staticfiles/;
|
|
}
|
|
|
|
location /media/ {
|
|
alias /home/marco/olimpic_nastri/media/;
|
|
}
|
|
|
|
location /webhook/deploy {
|
|
proxy_pass http://127.0.0.1:9000/deploy;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://unix:/run/olimpic_nastri/gunicorn.sock;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
error_log /var/log/nginx/diario_olimpic_error.log;
|
|
access_log /var/log/nginx/diario_olimpic_access.log;
|
|
}
|