Startup🔗
This reference document is a companion to our explanation about the PlanktoScope software as an operating system, particularly its discussion of the operating system's boot sequence and its explanation of the various system services provided with the operating system. Specifically, this document lists information about what happens when the PlanktoScope is powered on.
Services🔗
The PlanktoScope OS's daemons and system services (beyond what is already provided by the default installation of the Raspberry Pi OS) are defined with the following boot sequencing relationships:
Software deployment & execution🔗
In general:
-  dockerd(managed bydocker.service) can start before network connectivity has been established; this is not the default behavior fordockerd.
-  All daemons & background processes not described in the rest of this page are sequenced by systemd according to the systemd unit dependency relationships specified by the default systemd service files installed with the APT packages which provide those programs. 
The PlanktoScope OS's setup scripts provide some system services which are not managed by Forklift, because they are used to integrate Forklift into the OS in order to bootstrap the system services and config files provided by Forklift:
-  overlay-sysroot.serviceruns after-.mountandsystemd-remount-fs.service.
-  bindro-run-forklift-stages-current.serviceruns after-mountandsystemd-remount-fs.serviceand beforeoverlay-fs.target.
-  overlay-usr.serviceruns afteroverlay-sysroot.serviceand beforeoverlay-fs.target.
-  overlay-etc.serviceruns afteroverlay-sysroot.serviceandsystemd-machine-id-commit.service, and beforesystemd-sysctl.serviceandoverlay-fs.target.
-  start-overlaid-units.serviceruns afteroverlay-fs.targetandbasic.target.
-  bind-.local-share-forklift-stages@home-pi.serviceruns after-.mount,home.mount, andbasic.target.
-  forklift-apply.service, which uses theforklifttool to start all Docker Compose applications, runs afterdocker.servicehas started. Docker Compose applications managed withforkliftare sequenced byforklift-apply.serviceaccording to the resource dependency relationships declared by the Forklift packages which provide those applications.
Networking🔗
For descriptions of the various targets (e.g. sysinit.target, network-pre.target) referred to below, see systemd's bootup process and systemd's special targets:
-  generate-machine-name.serviceandgenerate-hostname-templated.serviceruns afterlocal-fs.targetbut beforesysinit.targetandsystemd-hostnamed.service.
-  update-hostname.serviceruns aftergenerate-hostname-templated.serviceandsystemd-hostnamed.servicebut beforenetwork-pre.targetandavahi-daemon.service.
-  assemble-firewalld-zone@nm-shared.serviceandassemble-firewalld-zone@public.servicerun beforefirewalld.serviceandNetworkManager.service.
-  assemble-hosts-templated.serviceandassemble-hosts.servicerun aftergenerate-machine-name.serviceandgenerate-hostname-templated.servicebut beforeNetworkManager.serviceandnetwork-pre.target.
-  assemble-dnsmasq-config-templated.serviceruns aftergenerate-machine-name.serviceandgenerate-hostname-templated.servicebut beforeNetworkManager.service.
-  assemble-networkmanager-connection-templated@wlan0-hotspot.service,assemble-networkmanager-connection-templated@wlan1-hotspot.service,assemble-networkmanager-connection@wlan0-hotspot.serviceandassemble-networkmanager-connection@wlan1-hotspot.servicerun aftergenerate-machine-name.serviceandgenerate-hostname-templated.servicebut beforeNetworkManager.service.
-  assemble-networkmanager-connection@eth0-default.service,assemble-networkmanager-connection@eth0-static.service,assemble-networkmanager-connection@eth1-default.service,assemble-networkmanager-connection@eth1-static.service, andassemble-networkmanager-connection@usb0-default.servicerun beforeNetworkManager.service.
-  avahi-publish-cname@pkscope.local.serviceandavahi-publish-cname@planktoscope.local.servicerun afterupdate-hostname.serviceandavahi-daemon.service.
-  report-mac-addresses.serviceruns afternetwork-online.target. It is re-run every two minutes byreport-mac-addresses.timer.
User interface🔗
-  assemble-cockpit-config.service,assemble-cockpit-origins.service, andassemble-cockpit-origins-templated.serviceupdate Cockpit's configuration file from drop-in config file fragments in/etc/cockpit/cockpit.conf.d,/etc/cockpit/origins.d, and/etc/cockpit/origins-templates.d, respectively. They run aftergenerate-machine-name.serviceandgenerate-hostname-templated.serviceand beforecockpit.service.
-  ensure-ssh-host-keys.serviceregenerates the SSH server's host keys if the keys are missing, and runs beforessh.service.
-  The PlanktoScope Node-RED dashboard (managed by nodered.service) starts aftergenerate-machine-name.servicehas started, to ensure that the Node-RED dashboard has the correct machine name. (In the future the PlanktoScope Node-RED dashboard will instead be run as a Docker container and will be managed byforklift.)
PlanktoScope-specific hardware abstraction🔗
- The PlanktoScope hardware controller (managed by planktoscope-org.device-backend.controller.service) starts afterforklift-apply.service(which manages Mosquitto) andnodered.servicehave started, to ensure that the PlanktoScope hardware controller broadcasts the detected camera model name only after the PlanktoScope Node-RED dashboard is ready to receive that broadcast. (In the future the PlanktoScope hardware controller will instead be run as a Docker container and will be managed byforklift.)