Add container deployment: Dockerfile, compose, systemd unit, redeploy script
Multi-stage build (node -> go -> alpine) producing the static tefterd binary with the frontend embedded. Compose follows the house style for the podman/SELinux server (:Z volume label + label:disable). deploy/ holds the user systemd unit and redeploy-tefter.sh, mirroring the apelacija setup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
30
deploy/redeploy-tefter.sh
Executable file
30
deploy/redeploy-tefter.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
APP_DIR=$HOME/tefter
|
||||
SERVICE=tefter.service
|
||||
|
||||
cd "$APP_DIR"
|
||||
|
||||
# Port the app is published on (kept in .env.docker next to the compose file).
|
||||
WEB_PORT=$(grep -oP '^WEB_PORT=\K.*' .env.docker 2>/dev/null || echo 8420)
|
||||
|
||||
echo "==> Pulling latest code..."
|
||||
git pull
|
||||
|
||||
echo "==> Rebuilding container..."
|
||||
TEFTER_VERSION=$(git describe --tags --always --dirty) podman-compose build
|
||||
|
||||
echo "==> Restarting service..."
|
||||
systemctl --user restart $SERVICE
|
||||
|
||||
echo "==> Waiting for boot..."
|
||||
sleep 5
|
||||
|
||||
if curl -s -o /dev/null -w "" http://localhost:$WEB_PORT/; then
|
||||
echo "==> Deploy successful! App is running on port $WEB_PORT."
|
||||
podman-compose logs --tail 5 tefter 2>&1
|
||||
else
|
||||
echo "==> WARNING: App may not be ready yet. Check logs:"
|
||||
podman-compose logs --tail 20 tefter 2>&1
|
||||
fi
|
||||
20
deploy/tefter.service
Normal file
20
deploy/tefter.service
Normal file
@@ -0,0 +1,20 @@
|
||||
# User unit — install to ~/.config/systemd/user/tefter.service, then:
|
||||
# systemctl --user daemon-reload && systemctl --user enable --now tefter.service
|
||||
# Requires lingering (loginctl enable-linger) so it survives logout.
|
||||
|
||||
[Unit]
|
||||
Description=Tefter notes server (podman-compose)
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=%h/tefter
|
||||
EnvironmentFile=%h/tefter/.env.docker
|
||||
ExecStart=/home/hamo/.local/bin/podman-compose up
|
||||
ExecStop=/home/hamo/.local/bin/podman-compose down
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
Reference in New Issue
Block a user