propellor spin

This commit is contained in:
Joey Hess 2014-04-10 02:51:25 -04:00
parent d1fdace57e
commit eb71c76711
Failed to extract signature
3 changed files with 55 additions and 2 deletions

47
Propellor/Property/Git.hs Normal file
View File

@ -0,0 +1,47 @@
module Propellor.Property.Git where
import Propellor
import Propellor.Property.File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
import Data.List
-- | Exports all git repos in a directory (that user nobody can read)
-- using git-daemon, run from inetd.
--
-- Note that reverting this property does not remove or stop inetd.
daemonRunning :: FilePath -> RevertableProperty
daemonRunning exportdir = RevertableProperty setup unsetup
where
setup = containsLine conf (mkl "tcp4")
`requires`
containsLine conf (mkl "tcp6")
`requires`
dirExists exportdir
`requires`
Apt.serviceInstalledRunning "openbsd-inetd"
`onChange`
Service.reloaded "openbsd-inetd"
unsetup = lacksLine conf (mkl "tcp4")
`requires`
lacksLine conf (mkl "tcp6")
`onChange`
Service.reloaded "openbsd-inetd"
conf = "/etc/inetd.conf"
mkl tcpv = intercalate "\t"
[ "git"
, "stream"
, tcpv
, "nowait"
, "nobody"
, "/usr/bin/git"
, "git"
, "daemon"
, "--inetd"
, "--export-all"
, "--base-path=" ++ exportdir
, exportdir
]

View File

@ -16,6 +16,7 @@ import qualified Propellor.Property.Tor as Tor
import qualified Propellor.Property.Dns as Dns
import qualified Propellor.Property.OpenId as OpenId
import qualified Propellor.Property.Docker as Docker
import qualified Propellor.Property.Git as Git
import qualified Propellor.Property.SiteSpecific.GitHome as GitHome
import qualified Propellor.Property.SiteSpecific.GitAnnexBuilder as GitAnnexBuilder
import qualified Propellor.Property.SiteSpecific.JoeySites as JoeySites
@ -61,12 +62,16 @@ host hostname@"diatom.kitenet.net" = Just $ props
& Hostname.set hostname
& Apt.unattendedUpgrades
& Apt.serviceInstalledRunning "ntp"
& Apt.serviceInstalledRunning "bind9"
& Dns.zones myDnsSecondary
& Apt.serviceInstalledRunning "apache2"
& Apt.serviceInstalledRunning "git-daemon-sysvinit"
& Apt.installed ["git", "git-annex", "rsync"]
& Apt.buildDep ["git-annex"] `period` Daily
& Git.daemonRunning "/srv/git"
-- git repos restore (how?)
-- kgb installation and setup
-- ssh keys for branchable and github repo hooks
-- gitweb
-- downloads.kitenet.net setup (including ssh key to turtle)
-- My laptop
host _hostname@"darkstar.kitenet.net" = Just $ props
& Docker.configured

View File

@ -72,6 +72,7 @@ Library
Propellor.Property.Dns
Propellor.Property.Docker
Propellor.Property.File
Propellor.Property.Git
Propellor.Property.Network
Propellor.Property.OpenId
Propellor.Property.Reboot