blumeops/containers/transmission/start.sh
Erich Blume c8b655f177 Build local containers for k8s services (#61)
## Summary
- Move devpi Dockerfile from argocd/manifests to containers/devpi/
- Add containers for: transmission, teslamate, miniflux, kiwix-serve, kubectl
- Update all k8s deployments to use local images (registry.ops.eblu.me/blumeops/*)
- All containers use v1.0.0 tag for initial release

## Containers Added
| Container | Source | Notes |
|-----------|--------|-------|
| devpi | python:3.12-slim | Existing, moved to containers/ |
| kubectl | alpine + download | For zim-watcher CronJob |
| miniflux | Go build from source | v2.2.16 |
| kiwix-serve | Download pre-built binary | v3.8.1 |
| transmission | alpine + apk install | Simpler than linuxserver image |
| teslamate | Elixir build from source | v2.2.0 |

## Deployment and Testing
- [ ] Build and tag devpi-v1.0.0
- [ ] Build and tag kubectl-v1.0.0
- [ ] Build and tag miniflux-v1.0.0
- [ ] Build and tag kiwix-serve-v1.0.0
- [ ] Build and tag transmission-v1.0.0
- [ ] Build and tag teslamate-v1.0.0
- [ ] Sync ArgoCD apps and verify services

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/61
2026-01-25 21:35:57 -08:00

57 lines
1.7 KiB
Bash

#!/bin/bash
set -e
# Handle PUID/PGID like linuxserver images
PUID=${PUID:-1000}
PGID=${PGID:-1000}
# Create or update transmission group/user with requested UID/GID
# The transmission package may have created a user with different IDs
echo "Setting up transmission user with UID=$PUID GID=$PGID"
# Remove existing user/group if they exist (ignore errors)
deluser transmission 2>/dev/null || true
delgroup transmission 2>/dev/null || true
# Create fresh user/group with requested IDs
addgroup -g "$PGID" transmission
adduser -D -u "$PUID" -G transmission transmission
# Ensure directories exist with correct ownership
mkdir -p /config /downloads/complete /downloads/incomplete
# Only chown /config (emptyDir) - /downloads is NFS and may not allow chown
chown -R transmission:transmission /config 2>/dev/null || true
chown transmission:transmission /downloads /downloads/complete /downloads/incomplete 2>/dev/null || true
# Create default config if it doesn't exist
CONFIG_FILE="/config/settings.json"
if [ ! -f "$CONFIG_FILE" ]; then
echo "Creating default configuration..."
cat > "$CONFIG_FILE" << 'EOF'
{
"download-dir": "/downloads/complete",
"incomplete-dir": "/downloads/incomplete",
"incomplete-dir-enabled": true,
"rpc-enabled": true,
"rpc-bind-address": "0.0.0.0",
"rpc-port": 9091,
"rpc-whitelist-enabled": false,
"rpc-host-whitelist-enabled": false,
"peer-port": 51413,
"watch-dir-enabled": false,
"umask": 2
}
EOF
chown transmission:transmission "$CONFIG_FILE"
fi
# Set timezone
if [ -n "$TZ" ]; then
ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime
fi
echo "Starting transmission-daemon..."
exec su-exec transmission transmission-daemon \
--foreground \
--config-dir /config \
--log-level=info