From f116d6be5f29c53bb0941fb45a8180c547d777cf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:00:37 -0400 Subject: [PATCH 01/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 17 +++++++++++++++++ config-joey.hs | 8 +------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 73a8f71..2a6dffe 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -169,3 +169,20 @@ mainhttpscert True = , " SSLCertificateKeyFile /etc/ssl/private/web.pem" , " SSLCertificateChainFile /etc/ssl/certs/startssl.pem" ] + + +annexRsyncServer :: Property +annexRsyncServer = combineProperties "rsync server for git-annex autobuilders" + [ Apt.installed ["rsync"] + , File.hasPrivContent "/etc/rsyncd.conf" + , File.hasPrivContent "/etc/rsyncd.secrets" + , "/etc/default/rsync" `File.containsLine` "RSYNC_ENABLE=true" + `onChange` Service.running "rsync" + , endpoint "/srv/web/downloads.kitenet.net/git-annex/autobuild" + , endpoint "/srv/web/downloads.kitenet.net/git-annex/autobuild/x86_64-apple-mavericks" + ] + where + endpoint d = combineProperties ("endpoint " ++ d) + [ File.dirExists d + , File.ownerGroup d "joey" "joey" + ] diff --git a/config-joey.hs b/config-joey.hs index 76860cb..166e84e 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -98,13 +98,7 @@ hosts = -- (o) ` "downloads.kitenet.net" "840760dc-08f0-11e2-8c61-576b7e66acfd" [("turtle", "ssh://turtle.kitenet.net/~/lib/downloads/")] - -- rsync server for git-annex autobuilders - & Apt.installed ["rsync"] - & File.hasPrivContent "/etc/rsyncd.conf" - & File.hasPrivContent "/etc/rsyncd.secrets" - & "/etc/default/rsync" `File.containsLine` "RSYNC_ENABLE=true" - `describe` "rsync server enabled" - `onChange` Service.running "rsync" + & JoeySites.annexRsyncServer & cname "tmp.kitenet.net" & JoeySites.annexWebSite hosts "/srv/git/joey/tmp.git" From 2097be5ff4a01a6acc9063ce9b62928a5f892b73 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:04:18 -0400 Subject: [PATCH 02/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 2 ++ config-joey.hs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 2a6dffe..4f76064 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -127,6 +127,8 @@ annexWebSite hosts origin hn uuid remotes = propertyList (hn ++" website using g , " " , " Options Indexes FollowSymLinks ExecCGI" , " AllowOverride None" + , " AddHandler cgi-script .cgi" + , " DirectoryIndex index.cgi" , " Order allow,deny" , " allow from all" , " " diff --git a/config-joey.hs b/config-joey.hs index 166e84e..e5ccac3 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -18,7 +18,6 @@ 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.Apache as Apache -import qualified Propellor.Property.Service as Service import qualified Propellor.Property.SiteSpecific.GitHome as GitHome import qualified Propellor.Property.SiteSpecific.GitAnnexBuilder as GitAnnexBuilder import qualified Propellor.Property.SiteSpecific.JoeySites as JoeySites From 0f08c035c7bafe13b59e3e91b426e93ee8e5092a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:05:42 -0400 Subject: [PATCH 03/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 4f76064..7ef6e94 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -128,7 +128,7 @@ annexWebSite hosts origin hn uuid remotes = propertyList (hn ++" website using g , " Options Indexes FollowSymLinks ExecCGI" , " AllowOverride None" , " AddHandler cgi-script .cgi" - , " DirectoryIndex index.cgi" + , " DirectoryIndex index.html index.cgi" , " Order allow,deny" , " allow from all" , " " From d71f8caad4576ff55a147d7d7934c8bc436519de Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:09:41 -0400 Subject: [PATCH 04/24] propellor spin --- Propellor/Property.hs | 13 +++++++++++++ Propellor/Property/Apache.hs | 8 ++++---- Propellor/Property/Apt.hs | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Propellor/Property.hs b/Propellor/Property.hs index 95d17c0..5b1800e 100644 --- a/Propellor/Property.hs +++ b/Propellor/Property.hs @@ -92,6 +92,19 @@ check c property = Property (propertyDesc property) $ ifM (liftIO c) , return NoChange ) +-- | Marks a Property as trivial. It can only return FailedChange or +-- NoChange. +-- +-- Useful when it's just as expensive to check if a change needs +-- to be made as it is to just idempotently assure the property is +-- satisfied. For example, chmodding a file. +trivial :: Property -> Property +trivial p = Property (propertyDesc p) $ do + r <- ensureProperty p + if r == MadeChange + then return NoChange + else return r + -- | Makes a property that is satisfied differently depending on the host's -- operating system. -- diff --git a/Propellor/Property/Apache.hs b/Propellor/Property/Apache.hs index f45ef9d..cf3e62c 100644 --- a/Propellor/Property/Apache.hs +++ b/Propellor/Property/Apache.hs @@ -10,12 +10,12 @@ type ConfigFile = [String] siteEnabled :: HostName -> ConfigFile -> RevertableProperty siteEnabled hn cf = RevertableProperty enable disable where - enable = cmdProperty "a2ensite" ["--quiet", hn] + enable = trivial $ cmdProperty "a2ensite" ["--quiet", hn] `describe` ("apache site enabled " ++ hn) `requires` siteAvailable hn cf `requires` installed `onChange` reloaded - disable = File.notPresent (siteCfg hn) + disable = trivial $ File.notPresent (siteCfg hn) `describe` ("apache site disabled " ++ hn) `onChange` cmdProperty "a2dissite" ["--quiet", hn] `requires` installed @@ -30,11 +30,11 @@ siteAvailable hn cf = siteCfg hn `File.hasContent` (comment:cf) modEnabled :: String -> RevertableProperty modEnabled modname = RevertableProperty enable disable where - enable = cmdProperty "a2enmod" ["--quiet", modname] + enable = trivial $ cmdProperty "a2enmod" ["--quiet", modname] `describe` ("apache module enabled " ++ modname) `requires` installed `onChange` reloaded - disable = cmdProperty "a2dismod" ["--quiet", modname] + disable = trivial $ cmdProperty "a2dismod" ["--quiet", modname] `describe` ("apache module disabled " ++ modname) `requires` installed `onChange` reloaded diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index f45bc2e..a01ab3c 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -103,7 +103,7 @@ installed' params ps = robustly $ check (isInstallable ps) go go = runApt $ params ++ ["install"] ++ ps installedBackport :: [Package] -> Property -installedBackport ps = withOS desc $ \o -> case o of +installedBackport ps = trivial $ withOS desc $ \o -> case o of Nothing -> error "cannot install backports; os not declared" (Just (System (Debian suite) _)) | isStable suite -> From a69b2555c3d479d85d71580c16af1ff18cd0d584 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:10:26 -0400 Subject: [PATCH 05/24] propellor spin From fc8d3fe541ab019ac545695fc829af9558c8b1ed Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:40:57 -0400 Subject: [PATCH 06/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 11 +++++++++++ config-joey.hs | 1 + 2 files changed, 12 insertions(+) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 7ef6e94..f409b09 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -188,3 +188,14 @@ annexRsyncServer = combineProperties "rsync server for git-annex autobuilders" [ File.dirExists d , File.ownerGroup d "joey" "joey" ] + +twitRss :: Property +twitRss = combineProperties "twitter rss" + [ Git.cloned "joey" "git://git.kitenet.net/twitrss.git" dir Nothing + , check (doesFileExist $ dir "twitRss") $ userScriptProperty "joey" + [ "cd " ++ dir + , "ghc --make twitRss" + ] + ] + where + dir = "/srv/web/tmp.kitenet.net/twitrss" diff --git a/config-joey.hs b/config-joey.hs index e5ccac3..5951455 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -104,6 +104,7 @@ hosts = -- (o) ` "tmp.kitenet.net" "26fd6e38-1226-11e2-a75f-ff007033bdba" [] + & JoeySites.twitRss & Apt.installed ["ntop"] From 6808fe60e1ad7593455d477ff456d8dbfbe75331 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:43:04 -0400 Subject: [PATCH 07/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index f409b09..5a2e164 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -192,10 +192,11 @@ annexRsyncServer = combineProperties "rsync server for git-annex autobuilders" twitRss :: Property twitRss = combineProperties "twitter rss" [ Git.cloned "joey" "git://git.kitenet.net/twitrss.git" dir Nothing - , check (doesFileExist $ dir "twitRss") $ userScriptProperty "joey" - [ "cd " ++ dir - , "ghc --make twitRss" - ] + , check (not <$> doesFileExist (dir "twitRss")) $ + userScriptProperty "joey" + [ "cd " ++ dir + , "ghc --make twitRss" + ] ] where dir = "/srv/web/tmp.kitenet.net/twitrss" From 5775643fc0b6da8e58adac49524f82044368c7d6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:43:55 -0400 Subject: [PATCH 08/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 5a2e164..847bd8b 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -197,6 +197,7 @@ twitRss = combineProperties "twitter rss" [ "cd " ++ dir , "ghc --make twitRss" ] + `requires` Apt.installed ["libghc-xml-dev"] ] where dir = "/srv/web/tmp.kitenet.net/twitrss" From de106741ece5cb2fcf206bd7537b88266d2d38c5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:44:45 -0400 Subject: [PATCH 09/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 847bd8b..c3ddc11 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -197,7 +197,10 @@ twitRss = combineProperties "twitter rss" [ "cd " ++ dir , "ghc --make twitRss" ] - `requires` Apt.installed ["libghc-xml-dev"] + `requires` Apt.installed + [ "libghc-xml-dev" + , "libghc-feed-dev" + ] ] where dir = "/srv/web/tmp.kitenet.net/twitrss" From 23b370398ceb933271cbd19919f2d8b1c6b00188 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:45:36 -0400 Subject: [PATCH 10/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index c3ddc11..0c1a1f4 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -200,6 +200,7 @@ twitRss = combineProperties "twitter rss" `requires` Apt.installed [ "libghc-xml-dev" , "libghc-feed-dev" + , "libghc-http-conduit-dev" ] ] where From 8009591be33e4c589557b1abd5259964b6bd81c4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:46:53 -0400 Subject: [PATCH 11/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index 0c1a1f4..c6050e7 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -201,6 +201,7 @@ twitRss = combineProperties "twitter rss" [ "libghc-xml-dev" , "libghc-feed-dev" , "libghc-http-conduit-dev" + , "libghc-tagsoup-dev" ] ] where From ebe1bd3f1b9daed7df6b8aa9f3f3172a2a336b55 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:53:19 -0400 Subject: [PATCH 12/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index c6050e7..d52ddbb 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -9,6 +9,7 @@ import qualified Propellor.Property.File as File import qualified Propellor.Property.Gpg as Gpg import qualified Propellor.Property.Ssh as Ssh import qualified Propellor.Property.Git as Git +import qualified Propellor.Property.Cron as Cron import qualified Propellor.Property.Service as Service import qualified Propellor.Property.User as User import qualified Propellor.Property.Obnam as Obnam @@ -189,6 +190,7 @@ annexRsyncServer = combineProperties "rsync server for git-annex autobuilders" , File.ownerGroup d "joey" "joey" ] +-- Twitter, you kill us. twitRss :: Property twitRss = combineProperties "twitter rss" [ Git.cloned "joey" "git://git.kitenet.net/twitrss.git" dir Nothing @@ -203,6 +205,11 @@ twitRss = combineProperties "twitter rss" , "libghc-http-conduit-dev" , "libghc-tagsoup-dev" ] + , feed "http://twitter.com/search/realtime?q=git-annex" "git-annex-twitter.rss" + , feed "http://twitter.com/search/realtime?q=olduse+OR+git-annex+OR+debhelper+OR+etckeeper+OR+ikiwiki+-ashley_ikiwiki" "twittergrep.rss" ] where dir = "/srv/web/tmp.kitenet.net/twitrss" + crontime = "15 * * * *" + feed url file = Cron.job "twitter rss cron job" crontime "joey" dir $ + "./twitRss " ++ shellEscape url ++ " > ../" ++ shellEscape file From 723af9c5f24bf91d01a79a1b5365c0db570784f8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 14:55:03 -0400 Subject: [PATCH 13/24] propellor spin --- Propellor/Property/SiteSpecific/JoeySites.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index d52ddbb..ae6c2dc 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -205,11 +205,11 @@ twitRss = combineProperties "twitter rss" , "libghc-http-conduit-dev" , "libghc-tagsoup-dev" ] - , feed "http://twitter.com/search/realtime?q=git-annex" "git-annex-twitter.rss" - , feed "http://twitter.com/search/realtime?q=olduse+OR+git-annex+OR+debhelper+OR+etckeeper+OR+ikiwiki+-ashley_ikiwiki" "twittergrep.rss" + , feed "http://twitter.com/search/realtime?q=git-annex" "git-annex-twitter" + , feed "http://twitter.com/search/realtime?q=olduse+OR+git-annex+OR+debhelper+OR+etckeeper+OR+ikiwiki+-ashley_ikiwiki" "twittergrep" ] where dir = "/srv/web/tmp.kitenet.net/twitrss" crontime = "15 * * * *" - feed url file = Cron.job "twitter rss cron job" crontime "joey" dir $ - "./twitRss " ++ shellEscape url ++ " > ../" ++ shellEscape file + feed url desc = Cron.job desc crontime "joey" dir $ + "./twitRss " ++ shellEscape url ++ " > " ++ shellEscape ("../" ++ desc ++ ".rss") From 3da26fbfa1811e503f5f4f492f51cfd17e7fa5f8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:13:33 -0400 Subject: [PATCH 14/24] propellor spin --- config-joey.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config-joey.hs b/config-joey.hs index 5951455..00c811d 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -79,6 +79,8 @@ hosts = -- (o) ` & Apt.unattendedUpgrades & Apt.serviceInstalledRunning "ntp" & Dns.zones myDnsSecondary + + & Apt.serviceInstalledRunning "postfix" & Apt.serviceInstalledRunning "apache2" & File.hasPrivContent "/etc/ssl/certs/web.pem" From 0b5c5f7c9a4e9b192237669903e954eae84dafd0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:17:31 -0400 Subject: [PATCH 15/24] propellor spin --- Propellor/Property/Hostname.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Propellor/Property/Hostname.hs b/Propellor/Property/Hostname.hs index 03613ac..59aade4 100644 --- a/Propellor/Property/Hostname.hs +++ b/Propellor/Property/Hostname.hs @@ -4,11 +4,12 @@ import Propellor import qualified Propellor.Property.File as File -- | Ensures that the hostname is set to the HostAttr value. --- Configures both /etc/hostname and the current hostname. +-- Configures /etc/hostname and the current hostname. -- --- When the hostname is a FQDN, also configures /etc/hosts, --- with an entry for 127.0.1.1, which is standard at least on Debian --- to set the FDQN (127.0.0.1 is localhost). +-- When the hostname is a FQDN, also configures /etc/mailname +-- with the domain part. +-- A FQDN also configures /etc/hosts, with an entry for 127.0.1.1, which is +-- standard at least on Debian to set the FDQN (127.0.0.1 is localhost). sane :: Property sane = Property ("sane hostname") (ensureProperty . setTo =<< getHostName) @@ -25,6 +26,9 @@ setTo hn = combineProperties desc go then Nothing else Just $ File.fileProperty desc addhostline "/etc/hosts" + , if null domain + then Nothing + else Just $ "/etc/mailname" `File.hasContent` [domain] ] hostip = "127.0.1.1" From 8bb029002e547f272e705d92dbc9c4fa53a63d78 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:35:29 -0400 Subject: [PATCH 16/24] propellor spin --- Propellor/Property/Postfix.hs | 26 ++++++++++++++++++++++++++ config-joey.hs | 7 +++++-- propellor.cabal | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Propellor/Property/Postfix.hs diff --git a/Propellor/Property/Postfix.hs b/Propellor/Property/Postfix.hs new file mode 100644 index 0000000..c253aac --- /dev/null +++ b/Propellor/Property/Postfix.hs @@ -0,0 +1,26 @@ +module Propellor.Property.Postfix where + +import Propellor +import qualified Propellor.Property.Apt as Apt +import Propellor.Property.User +import Utility.SafeCommand +import Utility.FileMode + +import System.PosixCompat + +installed :: Property +installed = Apt.serviceInstalledRunning "postfix" + +-- | Configures postfix as a satellite system, which +-- relats all mail through a relay host, which defaults to smtp.domain. +-- +-- The smarthost may refuse to relay mail on to other domains, without +-- futher coniguration/keys. But this should be enough to get cron job +-- mail flowing to a place where it will be seen. +satellite :: Property +satellite = Apt.reConfigure "postfix" + [ ("postfix/main_mailer_type", "select", "Satellite system") + , ("postfix/destinations", "string", "") + ] + `describe` "postfix satellite system" + `requires` installed diff --git a/config-joey.hs b/config-joey.hs index 00c811d..6039a52 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -18,6 +18,7 @@ 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.Apache as Apache +import qualified Propellor.Property.Postfix as Postfix import qualified Propellor.Property.SiteSpecific.GitHome as GitHome import qualified Propellor.Property.SiteSpecific.GitAnnexBuilder as GitAnnexBuilder import qualified Propellor.Property.SiteSpecific.JoeySites as JoeySites @@ -40,7 +41,9 @@ hosts = -- (o) ` & Apt.unattendedUpgrades & Network.ipv6to4 & Tor.isBridge + & Postfix.satellite & Docker.configured + & cname "shell.olduse.net" & JoeySites.oldUseNetShellBox @@ -62,6 +65,7 @@ hosts = -- (o) ` , standardSystem "orca.kitenet.net" Unstable "amd64" & Hostname.sane & Apt.unattendedUpgrades + & Postfix.satellite & Docker.configured & Docker.docked hosts "amd64-git-annex-builder" & Docker.docked hosts "i386-git-annex-builder" @@ -79,8 +83,7 @@ hosts = -- (o) ` & Apt.unattendedUpgrades & Apt.serviceInstalledRunning "ntp" & Dns.zones myDnsSecondary - - & Apt.serviceInstalledRunning "postfix" + & Postfix.satellite & Apt.serviceInstalledRunning "apache2" & File.hasPrivContent "/etc/ssl/certs/web.pem" diff --git a/propellor.cabal b/propellor.cabal index 1d62538..482f2de 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -81,6 +81,7 @@ Library Propellor.Property.Network Propellor.Property.Obnam Propellor.Property.OpenId + Propellor.Property.Postfix Propellor.Property.Reboot Propellor.Property.Scheduled Propellor.Property.Service From e8db2577a8e07deda5ad121f7a574e2f4d88c543 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:42:26 -0400 Subject: [PATCH 17/24] propellor spin --- Propellor/Property/Hostname.hs | 5 ----- Propellor/Property/Postfix.hs | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Propellor/Property/Hostname.hs b/Propellor/Property/Hostname.hs index 59aade4..30e0992 100644 --- a/Propellor/Property/Hostname.hs +++ b/Propellor/Property/Hostname.hs @@ -6,8 +6,6 @@ import qualified Propellor.Property.File as File -- | Ensures that the hostname is set to the HostAttr value. -- Configures /etc/hostname and the current hostname. -- --- When the hostname is a FQDN, also configures /etc/mailname --- with the domain part. -- A FQDN also configures /etc/hosts, with an entry for 127.0.1.1, which is -- standard at least on Debian to set the FDQN (127.0.0.1 is localhost). sane :: Property @@ -26,9 +24,6 @@ setTo hn = combineProperties desc go then Nothing else Just $ File.fileProperty desc addhostline "/etc/hosts" - , if null domain - then Nothing - else Just $ "/etc/mailname" `File.hasContent` [domain] ] hostip = "127.0.1.1" diff --git a/Propellor/Property/Postfix.hs b/Propellor/Property/Postfix.hs index c253aac..4967664 100644 --- a/Propellor/Property/Postfix.hs +++ b/Propellor/Property/Postfix.hs @@ -2,11 +2,6 @@ module Propellor.Property.Postfix where import Propellor import qualified Propellor.Property.Apt as Apt -import Propellor.Property.User -import Utility.SafeCommand -import Utility.FileMode - -import System.PosixCompat installed :: Property installed = Apt.serviceInstalledRunning "postfix" @@ -18,9 +13,13 @@ installed = Apt.serviceInstalledRunning "postfix" -- futher coniguration/keys. But this should be enough to get cron job -- mail flowing to a place where it will be seen. satellite :: Property -satellite = Apt.reConfigure "postfix" - [ ("postfix/main_mailer_type", "select", "Satellite system") - , ("postfix/destinations", "string", "") - ] - `describe` "postfix satellite system" - `requires` installed +satellite = setup `requires` installed + where + setup = Property "postfix satellite system" $ do + hn <- getHostName + ensureProperty $ Apt.reConfigure "postfix" + [ ("postfix/main_mailer_type", "select", "Satellite system") + , ("postfix/root_address", "string", "root") + , ("postfix/destinations", "string", " ") + , ("postfix/mailname", "string", hn) + ] From 6bbcacc01769425aeed97bf73b0bf465ef1ab009 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:44:01 -0400 Subject: [PATCH 18/24] propellor spin From baab388a9865b1cd50cd0dae2621a616243aab90 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:48:52 -0400 Subject: [PATCH 19/24] update --- debian/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/changelog b/debian/changelog index 18436b2..172ca7a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ propellor (0.3.1) UNRELEASED; urgency=medium * Support for provisioning hosts with ssh and gpg keys. * Obnam support. * Apache support. + * Postfix satellite system support. * Properties can now be satisfied differently on different operating systems. * Standard apt configuration for stable now includes backports. From 26d44f113f7e7ca7f10a7e4aefc9a878095fe2e9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:54:34 -0400 Subject: [PATCH 20/24] propellor spin --- config-joey.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/config-joey.hs b/config-joey.hs index 6039a52..30f46ea 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -109,6 +109,7 @@ hosts = -- (o) ` "tmp.kitenet.net" "26fd6e38-1226-11e2-a75f-ff007033bdba" [] + -- TODO:twitRss is broken on stable & JoeySites.twitRss & Apt.installed ["ntop"] From 0f3226a29812682854e9c9beb4b2b684ddbbe655 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 15:58:27 -0400 Subject: [PATCH 21/24] propellor spin From 1f2c68d595bbe5591517f44cdaa9ffd7ce1e00bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 16:01:17 -0400 Subject: [PATCH 22/24] propellor spin --- Propellor/Property/Apt.hs | 12 +++++++----- Propellor/Property/Postfix.hs | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index a01ab3c..2aeeab7 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -5,6 +5,7 @@ import Control.Applicative import Data.List import System.IO import Control.Monad +import System.Process (env) import Propellor import qualified Propellor.Property.File as File @@ -195,12 +196,13 @@ reConfigure package vals = reconfigure `requires` setselections `describe` ("reconfigure " ++ package) where setselections = Property "preseed" $ makeChange $ - withHandle StdinHandle createProcessSuccess - (proc "debconf-set-selections" []) $ \h -> do - forM_ vals $ \(tmpl, tmpltype, value) -> - hPutStrLn h $ unwords [package, tmpl, tmpltype, value] - hClose h + withHandle StdinHandle createProcessSuccess p $ \h -> do + forM_ vals $ \(tmpl, tmpltype, value) -> + hPutStrLn h $ unwords [package, tmpl, tmpltype, value] + hClose h reconfigure = cmdProperty "dpkg-reconfigure" ["-fnone", package] + p = (proc "debconf-set-selections" []) + { env = Just noninteractiveEnv } -- | Ensures that a service is installed and running. -- diff --git a/Propellor/Property/Postfix.hs b/Propellor/Property/Postfix.hs index 4967664..f4be27c 100644 --- a/Propellor/Property/Postfix.hs +++ b/Propellor/Property/Postfix.hs @@ -15,7 +15,7 @@ installed = Apt.serviceInstalledRunning "postfix" satellite :: Property satellite = setup `requires` installed where - setup = Property "postfix satellite system" $ do + setup = trivial $ Property "postfix satellite system" $ do hn <- getHostName ensureProperty $ Apt.reConfigure "postfix" [ ("postfix/main_mailer_type", "select", "Satellite system") From a83d48927044145bd7298984c36ffd16ffdbc6bd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Apr 2014 16:02:48 -0400 Subject: [PATCH 23/24] propellor spin --- Propellor/Property/Apt.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index 2aeeab7..3842cb0 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -5,7 +5,6 @@ import Control.Applicative import Data.List import System.IO import Control.Monad -import System.Process (env) import Propellor import qualified Propellor.Property.File as File @@ -196,13 +195,12 @@ reConfigure package vals = reconfigure `requires` setselections `describe` ("reconfigure " ++ package) where setselections = Property "preseed" $ makeChange $ - withHandle StdinHandle createProcessSuccess p $ \h -> do - forM_ vals $ \(tmpl, tmpltype, value) -> - hPutStrLn h $ unwords [package, tmpl, tmpltype, value] - hClose h - reconfigure = cmdProperty "dpkg-reconfigure" ["-fnone", package] - p = (proc "debconf-set-selections" []) - { env = Just noninteractiveEnv } + withHandle StdinHandle createProcessSuccess + (proc "debconf-set-selections" []) $ \h -> do + forM_ vals $ \(tmpl, tmpltype, value) -> + hPutStrLn h $ unwords [package, tmpl, tmpltype, value] + hClose h + reconfigure = cmdProperty' "dpkg-reconfigure" ["-fnone", package] noninteractiveEnv -- | Ensures that a service is installed and running. -- From 0592ab4bd7deaadaa971bc7d19b7beaca5a1253e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 15 Apr 2014 15:08:25 -0400 Subject: [PATCH 24/24] since http conduit is broken on stable, go ghetto and use curl --- Propellor/Property/SiteSpecific/JoeySites.hs | 1 - config-joey.hs | 1 - 2 files changed, 2 deletions(-) diff --git a/Propellor/Property/SiteSpecific/JoeySites.hs b/Propellor/Property/SiteSpecific/JoeySites.hs index ae6c2dc..dd24bb6 100644 --- a/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/Propellor/Property/SiteSpecific/JoeySites.hs @@ -202,7 +202,6 @@ twitRss = combineProperties "twitter rss" `requires` Apt.installed [ "libghc-xml-dev" , "libghc-feed-dev" - , "libghc-http-conduit-dev" , "libghc-tagsoup-dev" ] , feed "http://twitter.com/search/realtime?q=git-annex" "git-annex-twitter" diff --git a/config-joey.hs b/config-joey.hs index 30f46ea..6039a52 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -109,7 +109,6 @@ hosts = -- (o) ` "tmp.kitenet.net" "26fd6e38-1226-11e2-a75f-ff007033bdba" [] - -- TODO:twitRss is broken on stable & JoeySites.twitRss & Apt.installed ["ntop"]