The ITPal Service Control Standard (SCS) defines a single, scriptable, and observable way to manage services across Linux servers. It is the foundation of ITPalโs infrastructure operations, built around:
- ๐ณ Docker-first architecture
- ๐ Script-based service control (
adminctl) - ๐ Matrix-based monitoring and operator feedback
- ๐ Consistency, automation, and traceability
With SCS, infrastructure isnโt just about deploying containers โ itโs about running them in a predictable, monitored, and upgradeable way through clear protocols and tools.
- Define ๐๏ธ a standard layout, naming rules, and control scripts for all services.
- Allow fully ๐ remote and automated service operations through the CLI and Matrix bot.
- Reduce manual steps while increasing ๐ visibility and ๐ monitoring.
- Establish ๐ clear lifecycle states for every service (start, stop, restart, build, backup, restore, etc).
SCS applies to:
-
All backend services and applications managed by ITPal, especially those running in Docker.
-
Shell scripts that perform service operations (
start,deploy,logs, etc.). -
Communication between services and:
adminctl(the privileged host command dispatcher),- The ๐ค Matrix Operator Bot (for remote commands, status, and alerts).
The SCS CLI is installed using the provided script. It installs globally:
/etc/control/scs/install.shAfter installation, the CLI is available as scs.
Basic commands:
# Help and available commands
scs help
# List all services
scs list
# Start a service
scs start <service-name>
# Stop a service
scs stop <service-name>
# Check service status
scs status <service-name>
# View logs
scs logs <service-name>The cli.sh script is the central interface for all services under SCS. It hides Docker commands,
service dependencies, build arguments, lifecycle hooks, and Git operations behind a consistent Bash
interface.
This CLI is used both by humans (via SSH or shell) and by higher-level agents like adminctl and
the Matrix Operator Bot.
Services are declared in config.sh using associative arrays:
containersโ service โ container name.imagesโ service โ Docker image tag.servicesโ which services are enabled.services_pathโ where each service lives.run_argsโ Docker run arguments.repos_path,github_reposโ Git repos for version control.
This serves as the manifest of services, loaded dynamically by cli.sh.
Unlike YAML tools (like Docker Compose), this Bash format supports variables, conditions, and custom repo tracking.
cli.sh includes built-in actions:
๐จ build: Build Docker image.โถ๏ธ start: Start service (with dependencies).โน๏ธ stop: Stop container.๐ restart: Restart service.๐ status: Show Docker container status.๐ logs: Follow logs.๐ shell: Open a shell inside container/image.โ๏ธ exec: Run arbitrary commands in container.๐ท๏ธ version: Print Git metadata.๐ check-update: Compare repo with GitHub.โฌ๏ธ upgrade: Update repo, rebuild, restart.๐พ backup: Create a backup.๐ฅ restore: Restore from backup.โฐ setup-backup: Setup scheduled backups.๐ list-backups: Show backups.
Services can define lifecycle scripts in their directories:
start.sh,stop.sh,restart.shโ override defaults.pre-start.sh,post-start.sh,pre-restart.sh,post-restart.shโ hooks.upgrade.sh,check-update.sh,version.sh,after-upgrade.shโ custom logic.
This makes behavior customizable without touching the CLI core.
Typical structure under /etc/<service>/:
/etc/<service>/
โโโ .env
โโโ .env.defaults
โโโ adminctlConfig.js
โโโ repo/
โโโ start.sh
โโโ stop.sh
โโโ restart.sh
โโโ pre-start.sh
โโโ post-start.sh
โโโ post-stop.sh
โโโ build.sh
โโโ version.sh
โโโ check-update.sh
โโโ upgrade.sh
โโโ backup.sh
โโโ restore.sh
โโโ Dockerfile
All files are optional. Defaults assume a single container run with docker run and run_args.
- Config is declarative (
config.sh). - ๐ช Hooks take priority if defined.
- ๐ Dependencies respected with
start_with_deps. - Docker network auto-created.
- Consistent ๐ log output with emoji markers.
shellandexecreuserun_args.
scs start synapse # Start synapse + dependencies
scs restart kuma # Restart kuma
scs check-update all # Git status for all services
scs upgrade mas # Update MAS
scs status all # Show status for all services
scs status webhook # Show status for webhook service
scs logs webhook # Follow logs
scs exec hookshot "ps aux"
scs backup authentik # Backup authentik
scs restore synapse # Restore synapse
scs setup-backup kuma # Setup backups for kumaThese can be run directly, over SSH, via adminctl, or through automation.
โ๏ธ Why Not Kubernetes? SCS is designed for developers/operators who want:
- Running the latest dev commits
- Easy forking/patching upstream
- Full control over Docker args and repo tracking
Kubernetes focuses on scaling and abstraction. SCS prioritizes speed, flexibility, and full control.
SCS includes backup and restore for services, with scheduling, S3 integration, and retention.
- โฐ Scheduled backups (systemd timers).
- โ๏ธ S3 integration.
- ๐๏ธ Retention policies.
- ๐ง Service-specific scripts.
- ๐๏ธ Unified CLI interface.
In config.sh:
declare -A backup_services=(
["authentik"]="daily:30"
["synapse"]="weekly:90"
["kuma"]="monthly:365"
)
BACKUP_S3_BUCKET="your-bucket"
BACKUP_S3_REGION="us-east-1"
BACKUP_AWS_PROFILE="backup-profile"dailyโ every midnightweeklyโ Sunday midnightmonthlyโ first Sunday- Retention โ days before deletion
scs setup-backup <service> # Setup automated backups
scs backup <service> # Run manual backup
scs list-backups <service> # List backups
scs restore <service> <file> # Restore backupEach service provides backup.sh:
- Create archive.
- Place in
backups/. - Exit code 0 = success.
Each service provides restore.sh:
- Accept archive path.
- Extract/validate.
- Restore service.
- Exit code 0 = success.
If S3 configured:
- Upload backups after creation.
- Apply retention policies.
- Restore pulls from S3.
- Local files cleaned up.
Path structure:
s3://<bucket>/<service>/<backup>.tar.gz
- Systemd triggers backup.
- Service
backup.shruns. - Archive uploaded to S3.
- Old backups removed.
- Service restarted if needed.
Debugging:
systemctl status scs-backup-<service>
journalctl -u scs-backup-<service>
scs backup <service>
aws s3 ls s3://<bucket>/<service>/ --profile <profile>Defines how adminctl and the Matrix Operator Bot interact with a service.
type AdminctlServiceConfig = {
[serviceKey: string]: {
serviceName: string,
actions: string[],
repoPath: string,
owner: string,
repo: string,
branch: string,
showTagMessage?: boolean,
showReleaseNotes?: boolean,
patchBranches?: string[],
upstream?: { owner: string, repo: string },
filesToCheck?: string[],
getLocalVersion?: Function,
upgrade?: Function,
afterUpgrade?: Function,
},
};- ๐ท๏ธ serviceName: Name of service.
- โก actions: Supported commands.
- ๐ repoPath: Local repo path.
- ๐ค owner: GitHub owner.
- ๐ฆ repo: Repo name.
- ๐ฟ branch: Branch tracked.
- ๐ท๏ธ showTagMessage: Include tag message.
- ๐ showReleaseNotes: Include release notes.
- ๐ง patchBranches: Extra patch branches.
- โฌ๏ธ upstream: Override fork upstream.
- ๐ filesToCheck: Files to diff.
- ๐ท๏ธ getLocalVersion: Custom version logic.
- โฌ๏ธ upgrade: Custom upgrade function.
- ๐ afterUpgrade: Logic after upgrade.