From 7c4b1537391d801855e28a61c896efcc70cfaa81 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 May 2014 21:18:36 -0400 Subject: simplify monoid instance with some helper types --- src/Propellor/Property/Docker.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index 8e081ae4..ce10d318 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -48,7 +48,7 @@ type ContainerName = String container :: ContainerName -> Image -> Host container cn image = Host hn [] attr where - attr = mempty { _dockerImage = Just image } + attr = mempty { _dockerImage = Val image } hn = cn2hn cn cn2hn :: ContainerName -> HostName @@ -116,7 +116,7 @@ findContainer mhost cid cn mk = case mhost of mkContainer :: ContainerId -> Host -> Maybe Container mkContainer cid@(ContainerId hn _cn) h = Container - <$> _dockerImage attr + <$> fromVal (_dockerImage attr) <*> pure (map (\a -> a hn) (_dockerRunParams attr)) where attr = hostAttr h' -- cgit v1.3-2-g0d8e From 31d9dd297db1a27c121df484c8f71ccfb612f375 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 May 2014 21:36:09 -0400 Subject: propellor spin --- src/Propellor/Property/Docker.hs | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index ce10d318..b0af14c1 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -5,7 +5,29 @@ -- The existance of a docker container is just another Property of a system, -- which propellor can set up. See config.hs for an example. -module Propellor.Property.Docker where +module Propellor.Property.Docker ( + Image, + ContainerName, + configured, + installed, + container, + docked, + garbageCollected, + -- * Container configuration + dns, + hostname, + name, + publish, + expose, + user, + volume, + volumes_from, + workdir, + memory, + link, + -- * Internal use + chain, +) where import Propellor import Propellor.SimpleSh @@ -16,7 +38,7 @@ import qualified Propellor.Property.Docker.Shim as Shim import Utility.SafeCommand import Utility.Path -import Control.Concurrent.Async +import Control.Concurrent.Async hiding (link) import System.Posix.Directory import System.Posix.Process import Data.List @@ -218,9 +240,6 @@ data ContainerId = ContainerId HostName ContainerName data ContainerIdent = ContainerIdent Image HostName ContainerName [RunParam] deriving (Read, Show, Eq) -ident2id :: ContainerIdent -> ContainerId -ident2id (ContainerIdent _ hn cn _) = ContainerId hn cn - toContainerId :: String -> Maybe ContainerId toContainerId s | myContainerSuffix `isSuffixOf` s = case separate (== '.') (desuffix s) of -- cgit v1.3-2-g0d8e From b0f2478bcbfcf5adc2d6f1692d667d42b108ca04 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 May 2014 21:44:50 -0400 Subject: docker haddock --- src/Propellor/Property/Docker.hs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index b0af14c1..f23738b3 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -6,13 +6,14 @@ -- which propellor can set up. See config.hs for an example. module Propellor.Property.Docker ( - Image, - ContainerName, - configured, + -- * Host properties installed, + configured, container, docked, garbageCollected, + Image, + ContainerName, -- * Container configuration dns, hostname, @@ -25,6 +26,7 @@ module Propellor.Property.Docker ( workdir, memory, link, + ContainerAlias, -- * Internal use chain, ) where @@ -45,17 +47,17 @@ import Data.List import Data.List.Utils import qualified Data.Set as S +installed :: Property +installed = Apt.installed ["docker.io"] + -- | Configures docker with an authentication file, so that images can be --- pushed to index.docker.io. +-- pushed to index.docker.io. Optional. configured :: Property configured = property "docker configured" go `requires` installed where go = withPrivData DockerAuthentication $ \cfg -> ensureProperty $ "/root/.dockercfg" `File.hasContent` (lines cfg) -installed :: Property -installed = Apt.installed ["docker.io"] - -- | A short descriptive name for a container. -- Should not contain whitespace or other unusual characters, -- only [a-zA-Z0-9_-] are allowed @@ -76,9 +78,11 @@ container cn image = Host hn [] attr cn2hn :: ContainerName -> HostName cn2hn cn = cn ++ ".docker" --- | Ensures that a docker container is set up and running. The container --- has its own Properties which are handled by running propellor --- inside the container. +-- | Ensures that a docker container is set up and running, finding +-- its configuration in the passed list of hosts. +-- +-- The container has its own Properties which are handled by running +-- propellor inside the container. -- -- Additionally, the container can have DNS attributes, such as a CNAME. -- These become attributes of the host(s) it's docked in. -- cgit v1.3-2-g0d8e From cae7e15f569dfe672b1a667e468447f6153ea5f0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 May 2014 22:00:11 -0400 Subject: split out DockerAttr --- src/Propellor/Property/Docker.hs | 11 +++++---- src/Propellor/Types/Attr.hs | 50 ++++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 24 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index f23738b3..fbf34965 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -72,7 +72,7 @@ type ContainerName = String container :: ContainerName -> Image -> Host container cn image = Host hn [] attr where - attr = mempty { _dockerImage = Val image } + attr = dockerAttr $ mempty { _dockerImage = Val image } hn = cn2hn cn cn2hn :: ContainerName -> HostName @@ -145,7 +145,7 @@ mkContainer cid@(ContainerId hn _cn) h = Container <$> fromVal (_dockerImage attr) <*> pure (map (\a -> a hn) (_dockerRunParams attr)) where - attr = hostAttr h' + attr = _dockerattr $ hostAttr h' h' = h -- expose propellor directory inside the container & volume (localdir++":"++localdir) @@ -443,15 +443,18 @@ listImages :: IO [Image] listImages = lines <$> readProcess dockercmd ["images", "--all", "--quiet"] runProp :: String -> RunParam -> Property -runProp field val = pureAttrProperty (param) $ +runProp field val = pureAttrProperty (param) $ dockerAttr $ mempty { _dockerRunParams = [\_ -> "--"++param] } where param = field++"="++val genProp :: String -> (HostName -> RunParam) -> Property -genProp field mkval = pureAttrProperty field $ +genProp field mkval = pureAttrProperty field $ dockerAttr $ mempty { _dockerRunParams = [\hn -> "--"++field++"=" ++ mkval hn] } +dockerAttr :: DockerAttr -> Attr +dockerAttr a = mempty { _dockerattr = a } + -- | The ContainerIdent of a container is written to -- /.propellor-ident inside it. This can be checked to see if -- the container has the same ident later. diff --git a/src/Propellor/Types/Attr.hs b/src/Propellor/Types/Attr.hs index b41a813b..e8c22a94 100644 --- a/src/Propellor/Types/Attr.hs +++ b/src/Propellor/Types/Attr.hs @@ -12,32 +12,18 @@ data Attr = Attr , _sshPubKey :: Val String , _dns :: S.Set Dns.Record , _namedconf :: Dns.NamedConfMap - - , _dockerImage :: Val String - , _dockerRunParams :: [HostName -> String] + , _dockerattr :: DockerAttr } - -instance Eq Attr where - x == y = and - [ _os x == _os y - , _dns x == _dns y - , _namedconf x == _namedconf y - , _sshPubKey x == _sshPubKey y - - , _dockerImage x == _dockerImage y - , let simpl v = map (\a -> a "") (_dockerRunParams v) - in simpl x == simpl y - ] + deriving (Eq) instance Monoid Attr where - mempty = Attr mempty mempty mempty mempty mempty mempty + mempty = Attr mempty mempty mempty mempty mempty mappend old new = Attr { _os = _os old <> _os new , _sshPubKey = _sshPubKey old <> _sshPubKey new , _dns = _dns old <> _dns new , _namedconf = _namedconf old <> _namedconf new - , _dockerImage = _dockerImage old <> _dockerImage new - , _dockerRunParams = _dockerRunParams old <> _dockerRunParams new + , _dockerattr = _dockerattr old <> _dockerattr new } instance Show Attr where @@ -46,8 +32,7 @@ instance Show Attr where , "sshPubKey " ++ show (_sshPubKey a) , "dns " ++ show (_dns a) , "namedconf " ++ show (_namedconf a) - , "docker image " ++ show (_dockerImage a) - , "docker run params " ++ show (map (\mk -> mk "") (_dockerRunParams a)) + , show (_dockerattr a) ] data Val a = Val a | NoVal @@ -62,3 +47,28 @@ instance Monoid (Val a) where fromVal :: Val a -> Maybe a fromVal (Val a) = Just a fromVal NoVal = Nothing + +data DockerAttr = DockerAttr + { _dockerImage :: Val String + , _dockerRunParams :: [HostName -> String] + } + +instance Eq DockerAttr where + x == y = and + [ _dockerImage x == _dockerImage y + , let simpl v = map (\a -> a "") (_dockerRunParams v) + in simpl x == simpl y + ] + +instance Monoid DockerAttr where + mempty = DockerAttr mempty mempty + mappend old new = DockerAttr + { _dockerImage = _dockerImage old <> _dockerImage new + , _dockerRunParams = _dockerRunParams old <> _dockerRunParams new + } + +instance Show DockerAttr where + show a = unlines + [ "docker image " ++ show (_dockerImage a) + , "docker run params " ++ show (map (\mk -> mk "") (_dockerRunParams a)) + ] -- cgit v1.3-2-g0d8e From 442dbe23119e585e2d38456a87e46b265ba3acb6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jun 2014 02:53:42 -0400 Subject: propellor spin --- config-joey.hs | 2 ++ src/Propellor/Property/Apt.hs | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'src/Propellor/Property') diff --git a/config-joey.hs b/config-joey.hs index eca421db..026f2095 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -221,6 +221,7 @@ standardSystem hn suite arch = host hn & os (System (Debian suite) arch) & Apt.stdSourcesList suite `onChange` Apt.upgrade + & Apt.cacheCleaned & Apt.installed ["etckeeper"] & Apt.installed ["ssh"] & GitHome.installedFor "root" @@ -245,6 +246,7 @@ standardContainer name suite arch = Docker.container name (dockerImage system) & os (System (Debian suite) arch) & Apt.stdSourcesList suite & Apt.unattendedUpgrades + & Apt.cacheCleaned where system = System (Debian suite) arch diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index d3f47a80..69144d72 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -254,3 +254,9 @@ trustsKey k = RevertableProperty trust untrust hPutStr h (pubkey k) hClose h nukeFile $ f ++ "~" -- gpg dropping + +-- | Cleans apt's cache of downloaded packages to avoid using up disk +-- space. +cacheCleaned :: Property +cacheCleaned = cmdProperty "apt-get" ["clean"] + `describe` "apt cache cleaned" -- cgit v1.3-2-g0d8e From 5799b89d9f5b7c9b8e00467392b72b751d2239d9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jun 2014 07:32:16 -0400 Subject: filter out dup CNAMES This happens when a docker host has an alias defined, because all docker hosts are added to the dns, same as other hosts. --- src/Propellor/Property/Dns.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Dns.hs b/src/Propellor/Property/Dns.hs index 3e5c7828..50ce649e 100644 --- a/src/Propellor/Property/Dns.hs +++ b/src/Propellor/Property/Dns.hs @@ -339,7 +339,7 @@ genZone hosts zdomain soa = , map hostrecords inzdomain , map addcnames (M.elems m) ] - in (Zone zdomain soa (nub zhosts), warnings) + in (Zone zdomain soa (simplify zhosts), warnings) where m = hostMap hosts -- Known hosts with hostname located in the zone's domain. @@ -390,6 +390,17 @@ genZone hosts zdomain soa = l = zip (repeat $ AbsDomain $ hostName h) (S.toList $ S.filter (\r -> isNothing (getIPAddr r) && isNothing (getCNAME r)) (_dns attr)) + -- Simplifies the list of hosts. Remove duplicate entries. + -- Also, filter out any CHAMES where the same domain has an + -- IP address, since that's not legal. + simplify :: [(BindDomain, Record)] -> [(BindDomain, Record)] + simplify l = nub $ filter (not . dupcname ) l + where + dupcname (d, CNAME _) | any (matchingaddr d) l = True + dupcname _ = False + matchingaddr d (d', (Address _)) | d == d' = True + matchingaddr _ _ = False + inDomain :: Domain -> BindDomain -> Bool inDomain domain (AbsDomain d) = domain == d || ('.':domain) `isSuffixOf` d inDomain _ _ = False -- can't tell, so assume not -- cgit v1.3-2-g0d8e From e32408f4e874708d560524b6fb7af74a4096b821 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jun 2014 13:07:31 -0400 Subject: propellor spin --- config-joey.hs | 19 +++++++++++++------ src/Propellor/Property/SiteSpecific/JoeySites.hs | 8 ++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Property') diff --git a/config-joey.hs b/config-joey.hs index 55ce4765..587cbeef 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -171,12 +171,10 @@ hosts = -- (o) ` -- Joey gets pocasts here. & Apt.installed ["git-annex"] & alias "podcatcher.kitenet.net" - - -- Joey runs github-backup here. - & Apt.installed ["github-backup", "moreutils"] - & let f = "/home/joey/.github-keys" - in File.hasPrivContent f - `onChange` File.ownerGroup f "joey" "joey" + + & JoeySites.githubBackup + + & Docker.docked hosts "volatagex" --' __|II| ,. ---- __|II|II|__ ( \_,/\ @@ -225,6 +223,15 @@ hosts = -- (o) ` , let gitannexdir = GitAnnexBuilder.homedir "git-annex" in GitAnnexBuilder.androidContainer dockerImage "android-git-annex" doNothing gitannexdir & Docker.volume ("/home/joey/src/git-annex:" ++ gitannexdir) + + -- temp for an aqquantance + , standardContainer "voltagex" Stable "amd64" + & Docker.publish "22022:22" + & Apt.serviceInstalledRunning "ssh" + & Ssh.permitRootLogin True + & Ssh.passwordAuthentication True + & User.hasSomePassword "root" + ] ++ monsters -- This is my standard system setup. diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index f6e1e37f..b44401ea 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -330,3 +330,11 @@ kiteShellBox = propertyList "kitenet.net shellinabox" `onChange` Service.restarted "shellinabox" , Service.running "shellinabox" ] + +githubBackup :: Property +githubBackup = propertyList "github-backup box" + [ Apt.installed ["github-backup", "moreutils"] + , let f = "/home/joey/.github-keys" + in File.hasPrivContent f + `onChange` File.ownerGroup f "joey" "joey" + ] -- cgit v1.3-2-g0d8e From c224625734fb4b6ae11f6fdd897ed83fc7f7bab5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jun 2014 13:35:21 -0400 Subject: propellor spin --- config-joey.hs | 2 +- src/Propellor/Property/Docker.hs | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Property') diff --git a/config-joey.hs b/config-joey.hs index 9f5005b3..3f0d5154 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -224,7 +224,7 @@ hosts = -- (o) ` in GitAnnexBuilder.androidContainer dockerImage "android-git-annex" doNothing gitannexdir & Docker.volume ("/home/joey/src/git-annex:" ++ gitannexdir) - -- temp for an aqquantance + -- temp for an accuantance , standardContainer "voltagex" Stable "amd64" & Docker.publish "22022:22" & Apt.serviceInstalledRunning "ssh" diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index fbf34965..adaea548 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -11,6 +11,7 @@ module Propellor.Property.Docker ( configured, container, docked, + memoryLimited, garbageCollected, Image, ContainerName, @@ -25,6 +26,7 @@ module Propellor.Property.Docker ( volumes_from, workdir, memory, + cpuShares, link, ContainerAlias, -- * Internal use @@ -170,6 +172,20 @@ garbageCollected = propertyList "docker garbage collected" gcimages = property "docker images garbage collected" $ do liftIO $ report <$> (mapM removeImage =<< listImages) +-- | Configures the kernel to respect docker memory limits. +-- +-- This assumes the system boots using grub 2. And that you don't need any +-- other GRUB_CMDLINE_LINUX_DEFAULT settings. +-- +-- Only takes effect after reboot. (Not automated.) +memoryLimited :: Property +memoryLimited = "/etc/default/grub" `File.containsLine` cfg + `describe` "docker memory limited" + `onChange` cmdProperty "update-grub" [] + where + cmdline = "cgroup_enable=memory swapaccount=1" + cfg = "GRUB_CMDLINE_LINUX_DEFAULT=\""++cmdline++"\"" + data Container = Container Image [RunParam] -- | Parameters to pass to `docker run` when creating a container. @@ -220,10 +236,17 @@ workdir :: String -> Property workdir = runProp "workdir" -- | Memory limit for container. ---Format: , where unit = b, k, m or g +-- Format: , where unit = b, k, m or g +-- +-- Note: Only takes effect when the host has the memoryLimited property +-- enabled. memory :: String -> Property memory = runProp "memory" +-- | CPU shares (relative weight). +cpuShares :: Int -> Property +cpuShares = runProp "cpu-shares" . show + -- | Link with another container on the same host. link :: ContainerName -> ContainerAlias -> Property link linkwith calias = genProp "link" $ \hn -> -- cgit v1.3-2-g0d8e From 3df3fd1746c2721d6b1dc08bb1422422abf07f6f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jun 2014 13:40:06 -0400 Subject: propellor spin --- config-joey.hs | 4 +++- src/Propellor/Property/Docker.hs | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Propellor/Property') diff --git a/config-joey.hs b/config-joey.hs index 3f0d5154..6d3505ed 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -224,9 +224,11 @@ hosts = -- (o) ` in GitAnnexBuilder.androidContainer dockerImage "android-git-annex" doNothing gitannexdir & Docker.volume ("/home/joey/src/git-annex:" ++ gitannexdir) - -- temp for an accuantance + -- temp for an acquantance , standardContainer "voltagex" Stable "amd64" & Docker.publish "22022:22" + & Docker.memory "500m" + & Docker.cpuShares 1 & Apt.serviceInstalledRunning "ssh" & Ssh.permitRootLogin True & Ssh.passwordAuthentication True diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs index adaea548..fa3e2344 100644 --- a/src/Propellor/Property/Docker.hs +++ b/src/Propellor/Property/Docker.hs @@ -244,6 +244,9 @@ memory :: String -> Property memory = runProp "memory" -- | CPU shares (relative weight). +-- +-- By default, all containers run at the same priority, but you can tell +-- the kernel to give more CPU time to a container using this property. cpuShares :: Int -> Property cpuShares = runProp "cpu-shares" . show -- cgit v1.3-2-g0d8e From d65a07c701bc693b546b3abdde7a4a912712c969 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Jun 2014 14:37:44 -0400 Subject: propellor spin --- config-joey.hs | 6 ++++-- src/Propellor/Property/Obnam.hs | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Propellor/Property') diff --git a/config-joey.hs b/config-joey.hs index 6d3505ed..1229d182 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -168,11 +168,13 @@ hosts = -- (o) ` & Hostname.sane & Postfix.satellite - -- Joey gets pocasts here. - & Apt.installed ["git-annex"] & alias "podcatcher.kitenet.net" + & Apt.installed ["git-annex"] & JoeySites.githubBackup + + & alias "eubackup.kitenet.net" + & Apt.installed ["obnam", "sshfs", "rsync"] & Docker.docked hosts "voltagex" diff --git a/src/Propellor/Property/Obnam.hs b/src/Propellor/Property/Obnam.hs index 32374b57..e5ef7365 100644 --- a/src/Propellor/Property/Obnam.hs +++ b/src/Propellor/Property/Obnam.hs @@ -38,8 +38,12 @@ data NumClients = OnlyClient | MultipleClients -- -- How awesome is that? backup :: FilePath -> Cron.CronTimes -> [ObnamParam] -> NumClients -> Property -backup dir crontimes params numclients = cronjob `describe` desc +backup dir crontimes params numclients = backup' dir crontimes params numclients `requires` restored dir params + +-- | Does a backup, but does not automatically restore. +backup' :: FilePath -> Cron.CronTimes -> [ObnamParam] -> NumClients -> Property +backup' dir crontimes params numclients = cronjob `describe` desc where desc = dir ++ " backed up by obnam" cronjob = Cron.niceJob ("obnam_backup" ++ dir) crontimes "root" "/" $ -- cgit v1.3-2-g0d8e From d75cd6c7a373165944e73505412b674fb32786df Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 Jun 2014 16:19:34 -0400 Subject: remove sysvinit and systemd from my docker images sysvinit hangs on upgrade if not running --- config-joey.hs | 1 + src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'src/Propellor/Property') diff --git a/config-joey.hs b/config-joey.hs index 2f2ffa03..9363ff5f 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -272,6 +272,7 @@ standardContainer :: Docker.ContainerName -> DebianSuite -> Architecture -> Host standardContainer name suite arch = Docker.container name (dockerImage system) & os (System (Debian suite) arch) & Apt.stdSourcesList suite + & Apt.removed ["sysvinit", "systemd"] & Apt.unattendedUpgrades & Apt.cacheCleaned where diff --git a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs index 3dcafa35..ec1dee89 100644 --- a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs +++ b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs @@ -100,6 +100,7 @@ standardAutoBuilderContainer :: (System -> Docker.Image) -> Architecture -> Int standardAutoBuilderContainer dockerImage arch buildminute timeout = Docker.container (arch ++ "-git-annex-builder") (dockerImage $ System (Debian Unstable) arch) & Apt.stdSourcesList Unstable + & Apt.removed ["sysvinit", "systemd"] & Apt.unattendedUpgrades & buildDepsApt & autobuilder (show buildminute ++ " * * * *") timeout True @@ -116,6 +117,7 @@ androidContainer :: (System -> Docker.Image) -> Docker.ContainerName -> Property androidContainer dockerImage name setupgitannexdir gitannexdir = Docker.container name (dockerImage $ System (Debian Stable) "i386") & Apt.stdSourcesList Stable + & Apt.removed ["sysvinit", "systemd"] & User.accountFor builduser & File.dirExists gitbuilderdir & File.ownerGroup homedir builduser builduser @@ -141,6 +143,7 @@ armelCompanionContainer :: (System -> Docker.Image) -> Host armelCompanionContainer dockerImage = Docker.container "armel-git-annex-builder-companion" (dockerImage $ System (Debian Unstable) "amd64") & Apt.stdSourcesList Unstable + & Apt.removed ["sysvinit", "systemd"] & Apt.unattendedUpgrades -- This volume is shared with the armel builder. & Docker.volume gitbuilderdir @@ -158,6 +161,7 @@ armelAutoBuilderContainer dockerImage crontimes timeout = Docker.container "arme (dockerImage $ System (Debian Unstable) "armel") & Apt.stdSourcesList Unstable & Apt.unattendedUpgrades + & Apt.removed ["sysvinit", "systemd"] & Apt.installed ["openssh-client"] & Docker.link "armel-git-annex-builder-companion" "companion" & Docker.volumes_from "armel-git-annex-builder-companion" -- cgit v1.3-2-g0d8e From 1cf1e21532e72a6f53cad576d7e97058994d39db Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 Jun 2014 16:24:47 -0400 Subject: remove sysvinit by installing systemd --- config-joey.hs | 2 +- src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Property') diff --git a/config-joey.hs b/config-joey.hs index 03e1f272..3b4e57d6 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -272,7 +272,7 @@ standardContainer :: Docker.ContainerName -> DebianSuite -> Architecture -> Host standardContainer name suite arch = Docker.container name (dockerImage system) & os (System (Debian suite) arch) & Apt.stdSourcesList suite - & Apt.removed ["sysvinit", "systemd"] + & Apt.installed ["systemd"] & Apt.unattendedUpgrades & Apt.cacheCleaned where diff --git a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs index ec1dee89..2f467669 100644 --- a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs +++ b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs @@ -100,7 +100,7 @@ standardAutoBuilderContainer :: (System -> Docker.Image) -> Architecture -> Int standardAutoBuilderContainer dockerImage arch buildminute timeout = Docker.container (arch ++ "-git-annex-builder") (dockerImage $ System (Debian Unstable) arch) & Apt.stdSourcesList Unstable - & Apt.removed ["sysvinit", "systemd"] + & Apt.installed ["systemd"] & Apt.unattendedUpgrades & buildDepsApt & autobuilder (show buildminute ++ " * * * *") timeout True @@ -117,7 +117,7 @@ androidContainer :: (System -> Docker.Image) -> Docker.ContainerName -> Property androidContainer dockerImage name setupgitannexdir gitannexdir = Docker.container name (dockerImage $ System (Debian Stable) "i386") & Apt.stdSourcesList Stable - & Apt.removed ["sysvinit", "systemd"] + & Apt.installed ["systemd"] & User.accountFor builduser & File.dirExists gitbuilderdir & File.ownerGroup homedir builduser builduser @@ -143,7 +143,7 @@ armelCompanionContainer :: (System -> Docker.Image) -> Host armelCompanionContainer dockerImage = Docker.container "armel-git-annex-builder-companion" (dockerImage $ System (Debian Unstable) "amd64") & Apt.stdSourcesList Unstable - & Apt.removed ["sysvinit", "systemd"] + & Apt.installed ["systemd"] & Apt.unattendedUpgrades -- This volume is shared with the armel builder. & Docker.volume gitbuilderdir @@ -161,7 +161,7 @@ armelAutoBuilderContainer dockerImage crontimes timeout = Docker.container "arme (dockerImage $ System (Debian Unstable) "armel") & Apt.stdSourcesList Unstable & Apt.unattendedUpgrades - & Apt.removed ["sysvinit", "systemd"] + & Apt.installed ["systemd"] & Apt.installed ["openssh-client"] & Docker.link "armel-git-annex-builder-companion" "companion" & Docker.volumes_from "armel-git-annex-builder-companion" -- cgit v1.3-2-g0d8e From 6dd22d3f26c348ca15bc37113686ba3e22292454 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 Jun 2014 16:39:35 -0400 Subject: propellor spin --- src/Propellor/Property/Apt.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index 69144d72..f5dd74b5 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -214,7 +214,12 @@ unattendedUpgrades = RevertableProperty enable disable "/etc/apt/apt.conf.d/50unattended-upgrades" `File.containsLine` ("Unattended-Upgrade::Origins-Pattern { \"o=Debian,a="++showSuite suite++"\"; };") - _ -> noChange + | otherwise -> do + liftIO $ print ("xxx ", suite) + noChange + _ -> do + liftIO $ print "xxx" + noChange -- | Preseeds debconf values and reconfigures the package so it takes -- effect. -- cgit v1.3-2-g0d8e From dbffd982bac47cebd3fc67e51b46182f7e43392d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 Jun 2014 16:52:41 -0400 Subject: fix os attribute --- src/Propellor/Property/Apt.hs | 7 +------ src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index f5dd74b5..69144d72 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -214,12 +214,7 @@ unattendedUpgrades = RevertableProperty enable disable "/etc/apt/apt.conf.d/50unattended-upgrades" `File.containsLine` ("Unattended-Upgrade::Origins-Pattern { \"o=Debian,a="++showSuite suite++"\"; };") - | otherwise -> do - liftIO $ print ("xxx ", suite) - noChange - _ -> do - liftIO $ print "xxx" - noChange + _ -> noChange -- | Preseeds debconf values and reconfigures the package so it takes -- effect. diff --git a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs index 2f467669..6e4ca81a 100644 --- a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs +++ b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs @@ -99,6 +99,7 @@ cabalDeps = flagFile go cabalupdated standardAutoBuilderContainer :: (System -> Docker.Image) -> Architecture -> Int -> TimeOut -> Host standardAutoBuilderContainer dockerImage arch buildminute timeout = Docker.container (arch ++ "-git-annex-builder") (dockerImage $ System (Debian Unstable) arch) + & os (System (Debian Unstable) arch) & Apt.stdSourcesList Unstable & Apt.installed ["systemd"] & Apt.unattendedUpgrades @@ -116,6 +117,7 @@ androidAutoBuilderContainer dockerImage crontimes timeout = androidContainer :: (System -> Docker.Image) -> Docker.ContainerName -> Property -> FilePath -> Host androidContainer dockerImage name setupgitannexdir gitannexdir = Docker.container name (dockerImage $ System (Debian Stable) "i386") + & os (System (Debian Stable) "i386") & Apt.stdSourcesList Stable & Apt.installed ["systemd"] & User.accountFor builduser @@ -142,6 +144,7 @@ androidContainer dockerImage name setupgitannexdir gitannexdir = Docker.containe armelCompanionContainer :: (System -> Docker.Image) -> Host armelCompanionContainer dockerImage = Docker.container "armel-git-annex-builder-companion" (dockerImage $ System (Debian Unstable) "amd64") + & os (System (Debian Unstable) "amd64") & Apt.stdSourcesList Unstable & Apt.installed ["systemd"] & Apt.unattendedUpgrades @@ -159,6 +162,7 @@ armelCompanionContainer dockerImage = Docker.container "armel-git-annex-builder- armelAutoBuilderContainer :: (System -> Docker.Image) -> Cron.CronTimes -> TimeOut -> Host armelAutoBuilderContainer dockerImage crontimes timeout = Docker.container "armel-git-annex-builder" (dockerImage $ System (Debian Unstable) "armel") + & os (System (Debian Unstable) "armel") & Apt.stdSourcesList Unstable & Apt.unattendedUpgrades & Apt.installed ["systemd"] -- cgit v1.3-2-g0d8e