diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-10 02:51:25 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-10 02:51:25 -0400 |
| commit | eb71c76711a3952a1851fea4f80bbf17a0fc61b4 (patch) | |
| tree | 6600d1f231b038a3e9e9ff92d6ecb35da83c6804 | |
| parent | d1fdace57e9d8c34dba5cc21726e2fa4c6a70492 (diff) | |
propellor spin
| -rw-r--r-- | Propellor/Property/Git.hs | 47 | ||||
| -rw-r--r-- | config-joey.hs | 9 | ||||
| -rw-r--r-- | propellor.cabal | 1 |
3 files changed, 55 insertions, 2 deletions
diff --git a/Propellor/Property/Git.hs b/Propellor/Property/Git.hs new file mode 100644 index 00000000..356ff87a --- /dev/null +++ b/Propellor/Property/Git.hs @@ -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 + ] diff --git a/config-joey.hs b/config-joey.hs index 9c64acb5..b4aeebe6 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -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 diff --git a/propellor.cabal b/propellor.cabal index 8f53d592..03d14743 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -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 |
