Skip to content

contrib/ccas.service systemd user-unit template (deferred from #48) #93

Description

@Sootopolis

Context

#48 (ccas serve lifecycle) listed a systemd user-unit template as an explicit optional follow-up:

Optional in this issue (can be follow-up): ship a contrib/ccas.service systemd user-unit template.

It was not shipped with #48 (which delivered serve / serve --detach / stop). Capturing it here so it isn't silently dropped.

What

Ship contrib/ccas.service — a systemd user unit for running the server always-on locally, plus a short README install snippet.

Because #48 made foreground the default and the build already emits a dedicated foreground entry (ccas-server), the unit is a plain Type=simple wrapper — no Type=forking/PIDFile dance, no --detach:

# ~/.config/systemd/user/ccas.service
[Unit]
Description=CCAS backend server
After=network-online.target

[Service]
Type=simple
ExecStart=%h/.local/bin/ccas-server
Restart=on-failure
# Runtime config from the environment (the binary does not read .env):
Environment=SERVER_PORT=8080
EnvironmentFile=%h/.config/ccas/ccas.env

[Install]
WantedBy=default.target

Install: systemctl --user enable --now ccas.service (+ loginctl enable-linger $USER for boot-without-login).

Notes

  • Uses ccas-server (foreground) — NOT ccas serve --detach. systemd owns the lifecycle; serve --detach/stop remain the manual path.
  • The unit needs the mandatory env (CCAS_CONTACT_EMAIL, DATABASE_URL or DB_*) via EnvironmentFile, since the binary reads the process env only.
  • Loopback bind is the default after ccas serve lifecycle (serve, serve --detach, stop) #48 (SERVER_HOST=127.0.0.1); fine for a local unit.

Scope

  • contrib/ccas.service template.
  • README install snippet under "Running the server detached".

Priority

Low — convenience for a local always-on server; manual serve --detach / stop already cover the common case, and hosted deployment is tracked separately at #60.

Reference

Deferred from #48; tracked under epic #40 (CLI v0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCLI binary (subcommands, completions, config, packaging)enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions