cd /home/rc; xdg-open "index.html"

How-to rcastellotti.dev

19/08/20 :: st_mtime:17/02/2021

This post is NOT a tutorial!

#!/bin/bash
# code from https://gist.githubcomnoelboss3fe13927025b89757f8fb12e9066f2fa#file-post-receive
TARGET="/var/www/rcastellotti.dev"
GIT_DIR="/root/rcastellotti.dev"
BRANCH="master"

while read oldrev newrev ref
do
    if [ "$ref" = "refs/heads/$BRANCH" ];
    then
        echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
        git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
    else
        echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
    fi
done

echo "restarting services"
systemctl restart rcastellotti
systemctl restart nginx
[Unit]
Description=Gunicorn instance to serve rcastellotti.dev
After=network.target

[Service]
User=root
Group=www-data
WorkingDirectory=/var/www/rcastellotti.dev
Environment="PATH=/var/www/rcastellotti.dev/venv/bin"
ExecStart=/var/www/rcastellotti.dev/venv/bin/gunicorn --workers 3 --bind unix:/tmp/rcastellotti.sock -m 007 wsgi:app

[Install]
WantedBy=multi-user.target
server {
    root /var/www/;
    listen 80;
    server_name rcastellotti.dev http2;
    gzip on;
    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;

    location / {
        include proxy_params;
        proxy_pass  http://unix:/tmp/rcastellotti.sock;
    }
    location /assets {
        autoindex on;
    }
}

Extra stuff: