Cloud Connect as a Service
A managed service keeps a connected instance running after the terminal closes. spice cloud service drives systemd on Linux and launchd on macOS, with one set of commands for both.
Windows has no managed service: every action is refused there, and such a host runs the instance with spice run or under its own supervisor.
Enrollment comes first​
The directory must already hold a Cloud Connect identity; install never enrolls one. On an interactive host, spice cloud link enrolls it:
cd /srv/edge-analytics
spice cloud link acme/edge-analytics
An unattended host enrolls through Headless Cloud Connect instead.
Installing​
The privilege the install runs with selects the service domain, and with it the promise about when the instance comes back:
| Command | Starts |
|---|---|
spice cloud service install | when its owner logs in; on Linux, also at boot once the account lingers |
sudo spice cloud service install | at boot, with nobody logged in |
Both run from the instance directory, and both install and start the service. A system service still runs spiced as the operator who invoked sudo.
On Linux, a user service reaches boot persistence when its account lingers, and install asks logind for that itself: once the service passes its health check, install runs loginctl enable-linger for the installing account. The install output says which outcome the host gave. starts: at boot, without login means the account lingers. When the account does not linger, for example because the host's policy refused the request, or when logind cannot report it, the output reads starts: at login only and names the loginctl enable-linger command to run. On a host whose policy reserves lingering for administrators, run it with sudo:
sudo loginctl enable-linger "$USER"
launchd has no equivalent, so on macOS a user service starts with its owner's desktop login session and boot persistence means the sudo install.
Re-running install is the in-place upgrade: it stages the current spiced, rewrites the definition, and restarts the service, leaving the enrolled identity untouched.
Managing​
spice cloud service start
spice cloud service stop
spice cloud service restart
spice cloud service uninstall
Each action resolves the service for the directory it runs from. stop leaves the definition in place, so the service still comes back at the next boot or login.
spice cloud status reports the service's state, under Local enrolled-instance state:. It reads the project from Spice Cloud, so it needs an authenticated session. spice cloud logs reads the service's output, as described in Reading logs, and works without one.
Reading logs​
spice cloud logs # the last 100 lines
spice cloud logs --limit 500 # the last 500 lines
spice cloud logs -f # follow new lines
Ctrl-C ends the log output without touching the service.
spice cloud logs first asks Spice Cloud for the project's logs. When Spice Cloud returns no lines, or the request fails, for example because no session is signed in, the command reads the local service's logs instead, provided the directory's enrolled identity belongs to the same organization and project. When the request failed, it prints a warning that begins warning: Spice Cloud logs for project '<project>' were unavailable, so logs from this directory's local service are shown instead. When Spice Cloud answered with no lines, it shows the local logs without a warning, so the absence of the warning does not mean the lines came from Spice Cloud. -f follows only local service logs: when Spice Cloud returns the logs, -f fails with an error whose message begins Invalid argument: `--follow` is not supported when logs are served by Spice Cloud.
When the command reads the local service, on Linux the lines come from the systemd journal. launchd stores no logs, so on macOS the runtime writes its own files and the command reads those:
| Service | Log file |
|---|---|
| User | ~/Library/Logs/Spice/<service>/spiced.log |
| System | /Library/Logs/Spice/<service>/spiced.log |
The runtime keeps five files of about 10 MiB each and discards the oldest. spice cloud status reports the location, and an uninstall leaves the files in place.
Applying changes that require a restart​
A deployment that changes a section only a start reads leaves the instance serving its current configuration. The runtime names those sections in the service log, and the project in Spice Cloud reports them:
spice cloud logs --limit 20
INFO Spice Cloud Connect: applied the deployed spicepod (12 datasets, 1 models, 0 catalogs, 0 views); runtime, secrets takes effect when this instance next starts
spice cloud service restart is what applies them.
Secrets follow the same rule when one is removed. After a secret is deleted from the project with spice cloud secrets delete and the project is deployed again, the running instance keeps resolving the old value and names secrets among the sections that take effect at the next start. When the deployment carries no secrets at all, the instance also removes its delivered-secret cache, so after the restart a ${cloud:NAME} reference to a deleted secret no longer resolves. In v2.4.3 and earlier, a deployment with no secrets left the cache in place, and each start restored the deleted secrets.
Removing the service​
spice cloud service uninstall
This keeps the Cloud identity and the project, so a later install resumes the same enrollment. spice cloud unlink is what releases the instance from Spice Cloud.
One managed service per host. Additional instances on the same host run in the foreground or under an operator's own supervisor.
The spice cloud command reference documents every service option.
