[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Tiny Utility Toolkit for Tweaking Large Environments



Dan Ritter:

Eventually we'll have to do the work, but the operations staff here has a consensus that if we're going to do the work, we might as well go to a system that we feel capable of understanding and trusting, something more like daemontools. Nosh is being considered.

Having thought about this, I'd do things this way:

You need two new extensions Tuttle:noshService and Tuttle::noshSocket.  Both work by having INI files in your master configuration area, and they generate the actual service bundles on the slave systems from those.

Tuttle:noshService ...

    1. install_file_copy()s both ${wibble}.service and cyclog@.service to /var/local/sv/
    2. run_command()s system-control convert-systemd-units --local-bundle --no-systemd-quirks --bundle-root /var/local/sv/ -- /var/local/sv/${wibble}.service
    3. run_command()s system-control convert-systemd-units --local-bundle --no-systemd-quirks --bundle-root /var/local/sv/ -- /var/local/sv/cyclog@${wibble}.service 
    4. symbolically links /var/local/sv/${wibble}/log to ../cyclog@${wibble}
    5. run_command()s system-control enable -- cyclog@${wibble}.service  ${wibble}.service
    6. run_command()s system-control start --verbose -- cyclog@${wibble}.service  ${wibble}.service
    1. run_command()s system-control disable -- cyclog@${wibble}.service  ${wibble}.service
    2. run_command()s system-control stop --verbose -- cyclog@${wibble}.service  ${wibble}.service
    3. run_command()s system-control unload_when_stopped -- cyclog@${wibble}.service  ${wibble}.service
    4. remove_file()s both ${wibble}.service and cyclog@.service from /var/local/sv/
    5. removes the whole tree at /var/local/sv/${wibble}/ and at /var/local/sv/cyclog@${wibble}/

Tuttle:noshSocket ...

    1. install_file_copy()s all of ${wibble}.socket, ${wibble}@.service, and cyclog@.service to /var/local/sv/
    2. run_command()s system-control convert-systemd-units --local-bundle --no-systemd-quirks --bundle-root /var/local/sv/ -- /var/local/sv/${wibble}.socket
    3. run_command()s system-control convert-systemd-units --local-bundle --no-systemd-quirks --bundle-root /var/local/sv/ -- /var/local/sv/cyclog@${wibble}.service 
    4. symbolically links /var/local/sv/${wibble}/log to ../cyclog@${wibble}
    5. run_command()s system-control enable -- cyclog@${wibble}.service  ${wibble}.socket
    6. run_command()s system-control start --verbose -- cyclog@${wibble}.service  ${wibble}.socket
    1. run_command()s system-control disable -- cyclog@${wibble}.service  ${wibble}.socket
    2. run_command()s system-control stop --verbose -- cyclog@${wibble}.service  ${wibble}.socket
    3. run_command()s system-control unload-when-stopped -- cyclog@${wibble}.service  ${wibble}.socket
    4. remove_file()s all of ${wibble}.socket, ${wibble}@.service, and cyclog@.service from /var/local/sv/
    5. removes the whole tree at /var/local/sv/${wibble}/ and at /var/local/sv/cyclog@${wibble}/

I've not complicated the aforegiven by including all of the ${tuttle:id}s and where they would be inserted into the file and directory names (just before ${wibble}, usually), on the presumption that you know all about that.

Then the INI files that you write for (say, HTTP being already taken in your examples) nosh-socket gopherd would look like:

; gopherd@.service
[Unit]
Description=GOPHER service over IP4/IP6 using djbwares' gopherd
Description=http://jdebp.eu./Softwares/djbwares/
[Service]
EnvironmentDirectory=env
EnvironmentUser=%p-d
LimitNOFILE=20
LimitDATA=5000000
ExecStart=${localhost:+setenv ${PROTO:-TCP}LOCALHOST "${localhost}"} %p ${root:-/home/publicfile/public}
[Install]
WantedBy=server.target
; gopherd.socket
[Unit]
Description=GOPHER socket capable of single-stack IPV6 and IPV6-mapped IPV4

[Socket]
Backlog=2
ListenStream=gopher
Accept=true
MaxConnections=16
UCSPIRules=false
LogUCSPIRules=yes
NoDelay=false
BindIPv6Only=both

Setting up cyclog@.service, so that the generated /var/local/sv/cyclog@${wibble} runs cyclog as user ${wibble}-l logging to /var/log/${wibble}, is an exercise in more of the same that you only need to write once:

[Unit]
Description=Standard format %p logging service for %I
Before=%I
[Service]
WorkingDirectory=/var/log/
User=%i-l
ExecStart=%p %I/
[Install]
WantedBy=workstation.target

Reply to: