From df476813877fd1f7b249f7949c1056bef80c6579 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 12 Mar 2026 10:22:49 -0400 Subject: [PATCH] [systemd] Move to more generic python runners --- systemd/.config/systemd/user/celery@.service | 17 ++++++++++++++ systemd/.config/systemd/user/django@.service | 2 +- ...gryroot-flower.service => flower@.service} | 0 .../systemd/user/hungryroot-celery.service | 23 ------------------- .../systemd/user/hungryroot-django.service | 23 ------------------- systemd/.config/systemd/user/mkdocs@.service | 17 ++++++++++++++ 6 files changed, 35 insertions(+), 47 deletions(-) create mode 100644 systemd/.config/systemd/user/celery@.service rename systemd/.config/systemd/user/{hungryroot-flower.service => flower@.service} (100%) delete mode 100644 systemd/.config/systemd/user/hungryroot-celery.service delete mode 100644 systemd/.config/systemd/user/hungryroot-django.service create mode 100644 systemd/.config/systemd/user/mkdocs@.service diff --git a/systemd/.config/systemd/user/celery@.service b/systemd/.config/systemd/user/celery@.service new file mode 100644 index 0000000..ec3efc2 --- /dev/null +++ b/systemd/.config/systemd/user/celery@.service @@ -0,0 +1,17 @@ +[Unit] +Description=Celery dev runner for %I +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +Environment=PATH=%h/.local/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin +EnvironmentFile=%h/.local/etc/django/%i.env +ExecStart=/bin/bash -c 'cd "$DJANGO_PATH" && exec direnv exec "$DJANGO_PATH" celery -A "$CELERY_APP" worker' +Restart=on-failure +RestartSec=2 +StandardOutput=append:/tmp/celery.log +StandardError=inherit + +[Install] +WantedBy=default.target diff --git a/systemd/.config/systemd/user/django@.service b/systemd/.config/systemd/user/django@.service index 84c1d83..626b2d3 100644 --- a/systemd/.config/systemd/user/django@.service +++ b/systemd/.config/systemd/user/django@.service @@ -7,7 +7,7 @@ Wants=network-online.target Type=simple Environment=PATH=%h/.local/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin EnvironmentFile=%h/.local/etc/django/%i.env -ExecStart=/bin/bash -c 'cd "$DJANGO_PATH" && exec direnv exec "$DJANGO_PATH" poetry run python -u manage.py runserver 0.0.0.0:${DJANGO_PORT:-8000}' +ExecStart=/bin/bash -c 'cd "$DJANGO_PATH" && exec direnv exec "$DJANGO_PATH" python manage.py runserver 0.0.0.0:${DJANGO_PORT:-8000}' Restart=on-failure RestartSec=2 StandardOutput=append:/tmp/django.log diff --git a/systemd/.config/systemd/user/hungryroot-flower.service b/systemd/.config/systemd/user/flower@.service similarity index 100% rename from systemd/.config/systemd/user/hungryroot-flower.service rename to systemd/.config/systemd/user/flower@.service diff --git a/systemd/.config/systemd/user/hungryroot-celery.service b/systemd/.config/systemd/user/hungryroot-celery.service deleted file mode 100644 index 0dedb6c..0000000 --- a/systemd/.config/systemd/user/hungryroot-celery.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Hungryroot Celery (just celery) -After=network-online.target -Wants=network-online.target - -[Service] -Type=simple -WorkingDirectory=%h/src/github.com/hungryroot/hungryroot - -# Ensure Homebrew/user bins are visible (adjust if needed) -Environment=PATH=%h/.local/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin - -# Load direnv env for the directory, then run -ExecStart=/bin/bash -lc 'eval "$(direnv export bash)" && just celery' - -Restart=on-failure -RestartSec=2 - -StandardOutput=append:/tmp/hungryroot-celery.log -StandardError=inherit - -[Install] -WantedBy=default.target diff --git a/systemd/.config/systemd/user/hungryroot-django.service b/systemd/.config/systemd/user/hungryroot-django.service deleted file mode 100644 index 5e65088..0000000 --- a/systemd/.config/systemd/user/hungryroot-django.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Hungryroot Django (just django) -After=network-online.target -Wants=network-online.target - -[Service] -Type=simple -WorkingDirectory=%h/src/github.com/hungryroot/hungryroot - -# Ensure Homebrew/user bins are visible (adjust if needed) -Environment=PATH=%h/.local/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin - -# Load direnv env for the directory, then run -ExecStart=/bin/bash -lc 'eval "$(direnv export bash)" && just django' - -Restart=on-failure -RestartSec=2 - -StandardOutput=append:/tmp/hungryroot-django.log -StandardError=inherit - -[Install] -WantedBy=default.target diff --git a/systemd/.config/systemd/user/mkdocs@.service b/systemd/.config/systemd/user/mkdocs@.service new file mode 100644 index 0000000..eec2a4a --- /dev/null +++ b/systemd/.config/systemd/user/mkdocs@.service @@ -0,0 +1,17 @@ +[Unit] +Description=mkdocs dev server for %I +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +Environment=PATH=%h/.local/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin +EnvironmentFile=%h/.local/etc/django/%i.env +ExecStart=/bin/bash -c 'cd "$DJANGO_PATH" && exec direnv exec "$DJANGO_PATH" mkdocs serve --dev-addr 0.0.0.0:${DOCS_PORT:-8001}' +Restart=on-failure +RestartSec=2 +StandardOutput=append:/tmp/mkdocs.log +StandardError=inherit + +[Install] +WantedBy=default.target