Pure Baty

A (Pure) blog about everything, by Jack Baty

Managing Pure Blog updates using just

Since everything in Pure Blog is all in one folder, I needed some way to back things up and deploy updates to the code, independent of the content. I use just with a few basic recipies.

Available recipes:

Here's my justfile so far:

SERVER_HOST := "myserver.com"
SERVER_USER := "myuser"
SERVER_DIR := "/server/path/to/blog"
LOCAL_DIR := "~/local/path/to/blog"
BACKUP_DIR := "~/local/path/to/backups"
BACKUP_DATE := `date +%Y-%m-%d`
PUBLIC_DIR := "{{LOCAL_DIR}}"
TARGET := "Server03"

default:
    just --list

serve:
  php -S localhost:8000

upgrade:
    git pull

backup-to-local:
    echo "Backing up to {{BACKUP_DIR}}/{{BACKUP_DATE}}"
    rsync -avz {{SERVER_HOST}}:{{SERVER_DIR}}/ \
    {{BACKUP_DIR}}/{{BACKUP_DATE}} \
    --delete

deploy: 
    @echo "\033[0;32mDeploying updates to {{TARGET}}...\033[0m"
    rsync -v -rz \
    --checksum \
    --delete \
    --no-perms \
    --exclude /content/ \
    --exclude /config/ \
    --exclude /assets/images/ \
    --exclude /assets/css/custom.css \
    --exclude justfile \
    {{LOCAL_DIR}} {{SERVER_USER}}@{{SERVER_HOST}}:{{SERVER_DIR}}

I threw all this together rather quickly, so I'm sure there's more to do. Maybe there's a better way to handle this?

Blogging, Pure Blog