From: Julien Moutinho Date: Mon, 18 Mar 2013 09:48:49 +0000 (+0100) Subject: Ajout : vm_hosted : rule_runit_configure . X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=commitdiff_plain;h=517dfa12da0aee0c546f21166f488dc19f88c2b5 Ajout : vm_hosted : rule_runit_configure . --- diff --git a/etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure new file mode 100755 index 0000000..dceee35 --- /dev/null +++ b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/configure @@ -0,0 +1,21 @@ +#!/bin/sh -efux +run_user=git-daemon +id "$run_user" >/dev/null || +sudo adduser \ + --disabled-login \ + --disabled-password \ + --group \ + --home /home/git/pub \ + --shell /bin/false \ + --system \ + "$run_user" +log_user=git-daemon-log +id "$log_user" >/dev/null || +sudo adduser \ + --disabled-login \ + --disabled-password \ + --group \ + --home /home/git/log/git-daemon \ + --shell /bin/false \ + --system \ + "$log_user" diff --git a/etc/sv/git-daemon.9418.git.heureux-cyclage.org/log/run b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/log/run new file mode 100644 index 0000000..f556886 --- /dev/null +++ b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/log/run @@ -0,0 +1,3 @@ +#!/bin/sh -efux +install -d -m 770 -o log.git-daemon -g log.git-daemon /home/git/log/git-daemon/ +exec chpst -u log.git-daemon svlogd -tt /home/git/log/git-daemon/ diff --git a/etc/sv/git-daemon.9418.git.heureux-cyclage.org/run b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/run new file mode 100644 index 0000000..c994c65 --- /dev/null +++ b/etc/sv/git-daemon.9418.git.heureux-cyclage.org/run @@ -0,0 +1,13 @@ +#!/bin/sh -efux +exec 2>&1 +exec /usr/bin/chpst \ + -u git-daemon:git-daemon \ + /usr/bin/git daemon \ + --base-path=/home/git/pub/git \ + --interpolated-path=/home/git/srv/git/%H%D \ + --reuseaddr \ + --syslog \ + --user-path=pub/git \ + --verbose \ + -- \ + /home/git/pub/git diff --git a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/log/run b/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/log/run deleted file mode 100644 index f556886..0000000 --- a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/log/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -efux -install -d -m 770 -o log.git-daemon -g log.git-daemon /home/git/log/git-daemon/ -exec chpst -u log.git-daemon svlogd -tt /home/git/log/git-daemon/ diff --git a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run b/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run deleted file mode 100644 index c994c65..0000000 --- a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -efux -exec 2>&1 -exec /usr/bin/chpst \ - -u git-daemon:git-daemon \ - /usr/bin/git daemon \ - --base-path=/home/git/pub/git \ - --interpolated-path=/home/git/srv/git/%H%D \ - --reuseaddr \ - --syslog \ - --user-path=pub/git \ - --verbose \ - -- \ - /home/git/pub/git diff --git a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run.sh b/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run.sh deleted file mode 100644 index c319358..0000000 --- a/etc/sv/git-daemon.hc.9418.git.heureux-cyclage.org/run.sh +++ /dev/null @@ -1,20 +0,0 @@ -local run_user="$user"-daemon -id "$run_user" >/dev/null || -sudo adduser \ - --disabled-login \ - --disabled-password \ - --group \ - --home /home/git/pub \ - --shell /bin/false \ - --system \ - "$run_user" -log_user=git-daemon-log -id "$log_user" >/dev/null || -sudo adduser \ - --disabled-login \ - --disabled-password \ - --group \ - --home /home/git/log/git-daemon \ - --shell /bin/false \ - --system \ - "$log_user" diff --git a/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/configure b/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/configure new file mode 100755 index 0000000..b563226 --- /dev/null +++ b/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/configure @@ -0,0 +1,11 @@ +#!/bin/sh -efux +run_user=spawn-fcgi.80.git.heureux-cyclage.org +id "$run_user" >/dev/null || +sudo adduser \ + --disabled-login \ + --disabled-password \ + --group \ + --home /no-home \ + --shell /bin/false \ + --system \ + "$run_user" diff --git a/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/run b/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/run new file mode 100755 index 0000000..6b97f39 --- /dev/null +++ b/etc/sv/spawn-fcgi.80.git.heureux-cyclage.org/run @@ -0,0 +1,15 @@ +#!/bin/sh -efux +exec 2>&1 +run_user=spawn-fcgi.80.git.heureux-cyclage.org +sock_user=www-data +exec /usr/bin/spawn-fcgi + -g "$run_user" \ + -G "$sock_user" \ + -M 0660 \ + -n \ + -s /run/nginx/fastcgi/spawn-fcgi.80.git.heureux-cyclage.org \ + -u "$run_user" \ + -U "$sock_user" \ + -- /usr/bin/multiwatch \ + --forks 10 \ + -- /usr/sbin/fcgiwrap diff --git a/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run b/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run deleted file mode 100755 index 3e598b4..0000000 --- a/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -efux -exec 2>&1 -run_user=git-spawn-fcgi-80 -sock_user=www-data -exec /usr/bin/spawn-fcgi - -g "$run_user" \ - -G "$sock_user" \ - -M 0660 \ - -n \ - -s /run/nginx/fastcgi/spawn-fcgi.git.80.git.heureux-cyclage.org \ - -u "$run_user" \ - -U "$sock_user" \ - -- /usr/bin/multiwatch \ - --forks 10 \ - -- /usr/sbin/fcgiwrap diff --git a/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run.sh b/etc/sv/spawn-fcgi.hc.80.git.heureux-cyclage.org/run.sh deleted file mode 100644 index e69de29..0000000 diff --git a/vm_hosted b/vm_hosted index 8ffc922..b4a73b5 100755 --- a/vm_hosted +++ b/vm_hosted @@ -660,6 +660,10 @@ rule_login_configure () { # Xen hypervisor console hvc:2345:respawn:/sbin/getty 38400 hvc0 #xvc:2345:respawn:/sbin/getty 38400 xvc0 + + #-- runit begin + SV:123456:respawn:/usr/sbin/runsvdir-start + #-- runit end EOF sudo install -m 644 -o root -g root /dev/stdin /etc/login.defs <<-EOF MAIL_DIR /var/mail @@ -1111,6 +1115,34 @@ rule_procmail_configure () { "$tool"/etc/skel/etc/mail/delivery.procmailrc \ /etc/skel/etc/mail/delivery.procmailrc } +rule_runit_configure () { + rule apt_get_install runit + local -; set +f + rm -f /etc/service/* + # NOTE: runsvdir éteindra les services qui n'apparaîtront plus ici. + for sv in "$tool"/etc/sv/* + do sv=${sv#"$tool"/etc/sv/} + sudo install -d -m 770 -o root -g root \ + /etc/sv/"$sv" + sudo install -m 770 -o root -g root \ + "$tool"/etc/sv/"$sv"/run \ + /etc/sv/"$sv"/run + if test -e "$tool"/etc/sv/"$sv"/log/run + then + sudo install -d -m 770 -o root -g root \ + /etc/sv/"$sv"/log + sudo install -m 770 -o root -g root \ + "$tool"/etc/sv/"$sv"/log/run \ + /etc/sv/"$sv"/log/run + fi + if test ! -x "$tool"/etc/sv/"$sv"/configure || + "$tool"/etc/sv/"$sv"/configure + then + ln -fns ../sv/"$sv" /etc/service/"$sv" + sv restart "$sv" + else + done + } rule_ssh_configure () { ssh-keygen -F "$vm_fqdn" -f "$tool"/etc/openssh/known_hosts | ( while IFS= read -r line @@ -1309,6 +1341,7 @@ rule_configure () { rule nginx_configure rule php5_fpm_configure rule gitolite_configure + rule runit_configure } rule_luks_key_change () {