From c383ce196cd9859d97057c6bafa61084228832ed Mon Sep 17 00:00:00 2001
From: Laurent Bercot
Date: Wed, 27 Jul 2016 09:45:36 +0000
Subject: Add anchors to FAQ entries; add a FAQ for compiled db management.
---
doc/faq.html | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/doc/faq.html b/doc/faq.html
index b54b79a..8df36cb 100644
--- a/doc/faq.html
+++ b/doc/faq.html
@@ -18,7 +18,10 @@
s6-rc: Frequently Asked Questions
+
+
Quick recipes
+
How do I...
@@ -67,7 +70,10 @@ will bring the new services up. The services that will start are listed
after -- change.
+
+
The s6-rc-compile source format
+
The source format for
s6-rc-compile is not very convenient.
@@ -161,7 +167,82 @@ Bundles have multiple uses, and virtual services are definitely
one of them.
+
+
+ Managing compiled databases
+
+
+ How do I safely update my compiled database? It is a directory, so
+I cannot atomically replace my old database with the new one.
+
+
+ Use symbolic links. You can atomically replace a symbolic link, and the
+s6-rc programs have been designed with that mechanism in mind. Here is
+the simplest way of managing your compiled databases: (change the names
+according to your preferences, but keep the same idea)
+
+
+
+ - Make sure your s6-rc-init invocation,
+in your init scripts, always uses the /etc/s6-rc/compiled name
+to refer to the database to use at boot time.
+ - Make sure /etc/s6-rc/compiled is a symbolic link
+that points to your current compiled database. For instance, the first
+time you compile a service database, you could run:
+
+ s6-rc-compile /etc/s6-rc/compiled-initial /etc/s6-rc/source-initial
+ ln -sf compiled-initial /etc/s6-rc/compiled
+
+ - When you compile a new service database, always compile it to a
+unique name, preferrably in the same directory as your current compiled
+database. You can for instance use a TAI64N timestamp, obtained by
+s6-clock,
+to create such a name:
+
+ stamp=`s6-clock`
+ s6-rc-compile /etc/s6-rc/compiled-$stamp /etc/s6-rc/source-current
+
+ - To replace your current compiled database with the one you just
+created, run s6-rc-update on the new
+name:
+
+ s6-rc-update /etc/s6-rc/compiled-$stamp
+
+ - At this point, your current database is the new one, but if
+your machine reboots, it will still use the old one (because
+the /etc/s6-rc/compiled link is still pointing to the old one).
+To ensure that the
+new database will be used on the next boot, atomically update the link:
+
+ olddb=`s6-linkname -f /etc/s6-rc/compiled`
+ s6-ln -sf compiled-$stamp /etc/s6-rc/compiled
+
+ The use of the
+s6-ln
+utility is recommended, because not all implementations of the
+ln
+standard actually perform an atomic replacement. (For instance, ln -sf
+from GNU coreutils first removes the old link, then creates the new one:
+this is not atomic and may break your system if you're unlucky and get a
+power failure at the wrong time.) s6-ln is guaranteed to do the right thing.
+Alternatively, you could run something like ln -sf compiled-$stamp
+/etc/s6-rc/compiled.new ; mv -f /etc/s6-rc/compiled.new
+/etc/s6-rc/compiled, but that's more complex and may also fail with
+bad mv implementations.
+ - Your current compiled database, stored in
+/etc/s6-rc/compiled-$stamp, is now accessible via the
+/etc/s6-rc/compiled symlink and will be used at boot time. You do
+not need to modify your init scripts. If you wish, you can dispose of the
+old database you just replaced:
+
+ rm -rf $olddb
+
+
+
+
+
Switching from another service manager
+
I have a collection of init scripts in another format,
but don't want to wait until the whole collection is converted
@@ -315,7 +396,10 @@ state as "down" allows users to apply their chosen policies - see below.
Keep it simple, stupid.
+
+
Mechanism vs. policy
+
s6-rc feels bare: there are tools, but no wrappers, no pre-packaged
scripts to boot my machines, no default runlevels. By comparison, OpenRC
--
cgit v1.2.3