From 640a40809968f897b7de7694705eb5621bbe87ea Mon Sep 17 00:00:00 2001 From: Xe Date: Fri, 22 Apr 2022 00:44:06 +0000 Subject: [PATCH] add portable service docs Signed-off-by: Xe --- doc/portable-svc.md | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 doc/portable-svc.md diff --git a/doc/portable-svc.md b/doc/portable-svc.md new file mode 100644 index 0000000..09e405a --- /dev/null +++ b/doc/portable-svc.md @@ -0,0 +1,59 @@ +# Portable Service + +To run this service as a [portable +service](https://systemd.io/PORTABLE_SERVICES/), you either need to build it +from source or fetch a premade image from my server. Then you need to activate +the portable service and manage it like any other systemd service. + +## Getting Image + +### Building From Source + +To build from source, install Nix and enable flakes. Then run this command: + +``` +nix build "git+https://tulpa.dev/cadey/printerfacts.git?ref=main#portable-service" +``` + +Copy this to somewhere on your target server: + +``` +scp $(readlink ./result) target:printerfacts_0.3.1.raw +``` + +### Downloading From My Server + +Visit [my portable services +repository](https://xena.greedo.xeserv.us/pkg/portable/) server and download the +most recent `printerfacts` `.raw` file. Put it somewhere on the target machine. + +## Installing and Activating + +If you are running Ubuntu 22.04, you will need to install `systemd-portabled`: + +``` +sudo apt -y install systemd-container +``` + +This may work on other distros, but I have only tested this on Ubuntu 22.04. + +Then attach the service image: + +``` +sudo portablectl attach ./printerfacts_0.3.1.raw +``` + +And activate it like any other systemd service: + +``` +sudo systemctl enable --now printerfacts.service +``` + +And then fetch a printer fact: + +``` +$ curl http://[::1]:32042/fact +On average, a printer will sleep for 16 hours a day. +``` + +Or open it in your browser: http://target:32042