Home / Blog Menu ↓

Blog: #shell

I used to use Fabric to deploy my personal apps, but I often ran into issues with it, so several months ago I switched over to simple shell scripts that use ssh. Much more resilient, and far easier to maintain (at least for me).

Here’s a sample of what one of these deploy scripts looks like for a Django app:

#!/bin/sh

git push

ssh myusername@myhost /bin/zsh << EOF
  cd /path/to/app/code/

  echo "- Pulling the code"
  git checkout main && git pull

  echo "- Restarting the app"
  supervisorctl restart myappname

  echo "- Running migrations"
  /path/to/venv/bin/python manage.py migrate

  echo "- Collecting static"
  /path/to/venv/bin/python manage.py collectstatic --noinput
EOF

I’ve thought about using a CD pipeline instead, but I’m not convinced that introducing an extra dependency — no matter how slick — is actually worth it for something small and personal like this. (CI/CD sure is nice at work, however.)


Reply via email or office hours

Links #22

  • ProgrammingFonts.org — I’ve been using Go Mono for years now but lately I’ve been thinking that maybe it’s time to change things up a bit
  • Starship — a cross-shell prompt written in Rust, though I haven’t yet dived deep enough into the configuration docs to see if I can bend it to my will
  • Mark Boulton on history and digital type specimens — ephemerality for some things doesn’t matter, but the lack of excellent solutions for others (family photos, etc.) bothers me
  • Joseph Gentle on CRDTs — going along with the local-first idea I posted about in the last batch
  • 100+ Blender modeling tips — I’ve been working through this, quite helpful

Reply via email or office hours