Merge branch 'joeyconfig'
This commit is contained in:
commit
3959d5be90
|
@ -53,7 +53,6 @@ darkstar = host "darkstar.kitenet.net"
|
||||||
& Apt.buildDep ["git-annex"] `period` Daily
|
& Apt.buildDep ["git-annex"] `period` Daily
|
||||||
& Docker.configured
|
& Docker.configured
|
||||||
! Docker.docked hosts "android-git-annex"
|
! Docker.docked hosts "android-git-annex"
|
||||||
! Docker.docked hosts "webserver"
|
|
||||||
|
|
||||||
clam :: Host
|
clam :: Host
|
||||||
clam = standardSystem "clam.kitenet.net" Unstable "amd64"
|
clam = standardSystem "clam.kitenet.net" Unstable "amd64"
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
propellor (0.9.1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Docker: Add ability to control when containers restart.
|
||||||
|
* Docker: Default to always restarting containers, so they come back
|
||||||
|
up after reboots and docker daemon upgrades.
|
||||||
|
* Fix loop when a docker host that does not exist was docked.
|
||||||
|
|
||||||
|
-- Joey Hess <joeyh@debian.org> Fri, 24 Oct 2014 09:57:31 -0400
|
||||||
|
|
||||||
propellor (0.9.0) unstable; urgency=medium
|
propellor (0.9.0) unstable; urgency=medium
|
||||||
|
|
||||||
* Avoid encoding the current stable suite in propellor's code,
|
* Avoid encoding the current stable suite in propellor's code,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
* There is no way for a property of a docker container to require
|
* There is no way for a property of a docker container to require
|
||||||
some property be met outside the container. For example, some servers
|
some property be met outside the container. For example, some servers
|
||||||
need ntp installed for a good date source.
|
need ntp installed for a good date source.
|
||||||
|
* The SimpleSh was added before `docker exec` existed, and could probably
|
||||||
|
be eliminated by using that.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Name: propellor
|
Name: propellor
|
||||||
Version: 0.9.0
|
Version: 0.9.1
|
||||||
Cabal-Version: >= 1.6
|
Cabal-Version: >= 1.6
|
||||||
License: BSD3
|
License: BSD3
|
||||||
Maintainer: Joey Hess <joey@kitenet.net>
|
Maintainer: Joey Hess <joey@kitenet.net>
|
||||||
|
|
|
@ -80,7 +80,10 @@ aliasMap = M.fromList . concat .
|
||||||
map (\h -> map (\aka -> (aka, h)) $ S.toList $ _aliases $ hostInfo h)
|
map (\h -> map (\aka -> (aka, h)) $ S.toList $ _aliases $ hostInfo h)
|
||||||
|
|
||||||
findHost :: [Host] -> HostName -> Maybe Host
|
findHost :: [Host] -> HostName -> Maybe Host
|
||||||
findHost l hn = maybe (findAlias l hn) Just (M.lookup hn (hostMap l))
|
findHost l hn = maybe (findAlias l hn) Just (findHostNoAlias l hn)
|
||||||
|
|
||||||
|
findHostNoAlias :: [Host] -> HostName -> Maybe Host
|
||||||
|
findHostNoAlias l hn = M.lookup hn (hostMap l)
|
||||||
|
|
||||||
findAlias :: [Host] -> HostName -> Maybe Host
|
findAlias :: [Host] -> HostName -> Maybe Host
|
||||||
findAlias l hn = M.lookup hn (aliasMap l)
|
findAlias l hn = M.lookup hn (aliasMap l)
|
||||||
|
|
|
@ -135,7 +135,7 @@ host hn = Host hn [] mempty
|
||||||
--
|
--
|
||||||
-- Can add Properties and RevertableProperties
|
-- Can add Properties and RevertableProperties
|
||||||
(&) :: IsProp p => Host -> p -> Host
|
(&) :: IsProp p => Host -> p -> Host
|
||||||
(Host hn ps as) & p = Host hn (ps ++ [toProp p]) (as <> getInfo p)
|
(Host hn ps is) & p = Host hn (ps ++ [toProp p]) (is <> getInfo p)
|
||||||
|
|
||||||
infixl 1 &
|
infixl 1 &
|
||||||
|
|
||||||
|
@ -145,6 +145,14 @@ h ! p = h & revert p
|
||||||
|
|
||||||
infixl 1 !
|
infixl 1 !
|
||||||
|
|
||||||
|
-- | Like (&), but adds the property as the first property of the host.
|
||||||
|
-- Normally, property order should not matter, but this is useful
|
||||||
|
-- when it does.
|
||||||
|
(&^) :: IsProp p => Host -> p -> Host
|
||||||
|
(Host hn ps is) &^ p = Host hn ([toProp p] ++ ps) (getInfo p <> is)
|
||||||
|
|
||||||
|
infixl 1 &^
|
||||||
|
|
||||||
-- Changes the action that is performed to satisfy a property.
|
-- Changes the action that is performed to satisfy a property.
|
||||||
adjustProperty :: Property -> (Propellor Result -> Propellor Result) -> Property
|
adjustProperty :: Property -> (Propellor Result -> Propellor Result) -> Property
|
||||||
adjustProperty p f = p { propertySatisfy = f (propertySatisfy p) }
|
adjustProperty p f = p { propertySatisfy = f (propertySatisfy p) }
|
||||||
|
|
|
@ -19,7 +19,6 @@ module Propellor.Property.Docker (
|
||||||
-- * Container configuration
|
-- * Container configuration
|
||||||
dns,
|
dns,
|
||||||
hostname,
|
hostname,
|
||||||
name,
|
|
||||||
publish,
|
publish,
|
||||||
expose,
|
expose,
|
||||||
user,
|
user,
|
||||||
|
@ -30,6 +29,9 @@ module Propellor.Property.Docker (
|
||||||
cpuShares,
|
cpuShares,
|
||||||
link,
|
link,
|
||||||
ContainerAlias,
|
ContainerAlias,
|
||||||
|
restartAlways,
|
||||||
|
restartOnFailure,
|
||||||
|
restartNever,
|
||||||
-- * Internal use
|
-- * Internal use
|
||||||
chain,
|
chain,
|
||||||
) where
|
) where
|
||||||
|
@ -106,7 +108,7 @@ docked hosts cn = RevertableProperty
|
||||||
let cid = ContainerId hn cn
|
let cid = ContainerId hn cn
|
||||||
ensureProperties [findContainer mhost cid cn $ a cid]
|
ensureProperties [findContainer mhost cid cn $ a cid]
|
||||||
|
|
||||||
mhost = findHost hosts (cn2hn cn)
|
mhost = findHostNoAlias hosts (cn2hn cn)
|
||||||
|
|
||||||
setup cid (Container image runparams) =
|
setup cid (Container image runparams) =
|
||||||
provisionContainer cid
|
provisionContainer cid
|
||||||
|
@ -150,14 +152,18 @@ findContainer mhost cid cn mk = case mhost of
|
||||||
mkContainer :: ContainerId -> Host -> Maybe Container
|
mkContainer :: ContainerId -> Host -> Maybe Container
|
||||||
mkContainer cid@(ContainerId hn _cn) h = Container
|
mkContainer cid@(ContainerId hn _cn) h = Container
|
||||||
<$> fromVal (_dockerImage info)
|
<$> fromVal (_dockerImage info)
|
||||||
<*> pure (map (\a -> a hn) (_dockerRunParams info))
|
<*> pure (map (\mkparam -> mkparam hn) (_dockerRunParams info))
|
||||||
where
|
where
|
||||||
info = _dockerinfo $ hostInfo h'
|
info = _dockerinfo $ hostInfo h'
|
||||||
h' = h
|
h' = h
|
||||||
-- expose propellor directory inside the container
|
-- Restart by default so container comes up on
|
||||||
|
-- boot or when docker is upgraded.
|
||||||
|
&^ restartAlways
|
||||||
|
-- Expose propellor directory inside the container.
|
||||||
& volume (localdir++":"++localdir)
|
& volume (localdir++":"++localdir)
|
||||||
-- name the container in a predictable way so we
|
-- Name the container in a predictable way so we
|
||||||
-- and the user can easily find it later
|
-- and the user can easily find it later. This property
|
||||||
|
-- comes last, so it cannot be overridden.
|
||||||
& name (fromContainerId cid)
|
& name (fromContainerId cid)
|
||||||
|
|
||||||
-- | Causes *any* docker images that are not in use by running containers to
|
-- | Causes *any* docker images that are not in use by running containers to
|
||||||
|
@ -217,7 +223,7 @@ dns = runProp "dns"
|
||||||
hostname :: String -> Property
|
hostname :: String -> Property
|
||||||
hostname = runProp "hostname"
|
hostname = runProp "hostname"
|
||||||
|
|
||||||
-- | Set name for container. (Normally done automatically.)
|
-- | Set name of container.
|
||||||
name :: String -> Property
|
name :: String -> Property
|
||||||
name = runProp "name"
|
name = runProp "name"
|
||||||
|
|
||||||
|
@ -274,6 +280,25 @@ link linkwith calias = genProp "link" $ \hn ->
|
||||||
-- Each container has its own alias namespace.
|
-- Each container has its own alias namespace.
|
||||||
type ContainerAlias = String
|
type ContainerAlias = String
|
||||||
|
|
||||||
|
-- | This property is enabled by default for docker containers configured by
|
||||||
|
-- propellor; as well as keeping badly behaved containers running,
|
||||||
|
-- it ensures that containers get started back up after reboot or
|
||||||
|
-- after docker is upgraded.
|
||||||
|
restartAlways :: Property
|
||||||
|
restartAlways = runProp "restart" "always"
|
||||||
|
|
||||||
|
-- | Docker will restart the container if it exits nonzero.
|
||||||
|
-- If a number is provided, it will be restarted only up to that many
|
||||||
|
-- times.
|
||||||
|
restartOnFailure :: Maybe Int -> Property
|
||||||
|
restartOnFailure Nothing = runProp "restart" "on-failure"
|
||||||
|
restartOnFailure (Just n) = runProp "restart" ("on-failure:" ++ show n)
|
||||||
|
|
||||||
|
-- | Makes docker not restart a container when it exits
|
||||||
|
-- Note that this includes not restarting it on boot!
|
||||||
|
restartNever :: Property
|
||||||
|
restartNever = runProp "restart" "no"
|
||||||
|
|
||||||
-- | A container is identified by its name, and the host
|
-- | A container is identified by its name, and the host
|
||||||
-- on which it's deployed.
|
-- on which it's deployed.
|
||||||
data ContainerId = ContainerId HostName ContainerName
|
data ContainerId = ContainerId HostName ContainerName
|
||||||
|
|
|
@ -65,6 +65,7 @@ tree buildarch = combineProperties "gitannexbuilder tree"
|
||||||
buildDepsApt :: Property
|
buildDepsApt :: Property
|
||||||
buildDepsApt = combineProperties "gitannexbuilder build deps"
|
buildDepsApt = combineProperties "gitannexbuilder build deps"
|
||||||
[ Apt.buildDep ["git-annex"]
|
[ Apt.buildDep ["git-annex"]
|
||||||
|
, Apt.installed ["liblockfile-simple-perl"]
|
||||||
, buildDepsNoHaskellLibs
|
, buildDepsNoHaskellLibs
|
||||||
, "git-annex source build deps installed" ==> Apt.buildDepIn builddir
|
, "git-annex source build deps installed" ==> Apt.buildDepIn builddir
|
||||||
]
|
]
|
||||||
|
@ -113,17 +114,14 @@ androidContainer dockerImage name setupgitannexdir gitannexdir = Docker.containe
|
||||||
& os osver
|
& os osver
|
||||||
& Apt.stdSourcesList
|
& Apt.stdSourcesList
|
||||||
& Apt.installed ["systemd"]
|
& Apt.installed ["systemd"]
|
||||||
|
& Docker.tweaked
|
||||||
& User.accountFor builduser
|
& User.accountFor builduser
|
||||||
& File.dirExists gitbuilderdir
|
& File.dirExists gitbuilderdir
|
||||||
& File.ownerGroup homedir builduser builduser
|
& File.ownerGroup homedir builduser builduser
|
||||||
& buildDepsNoHaskellLibs
|
& buildDepsApt
|
||||||
& flagFile chrootsetup ("/chrootsetup")
|
& flagFile chrootsetup ("/chrootsetup")
|
||||||
`requires` setupgitannexdir
|
`requires` setupgitannexdir
|
||||||
& Docker.tweaked
|
& flagFile haskellpkgsinstalled ("/haskellpkgsinstalled")
|
||||||
-- TODO: automate installing haskell libs
|
|
||||||
-- (Currently have to run
|
|
||||||
-- git-annex/standalone/android/install-haskell-packages
|
|
||||||
-- which is not fully automated.)
|
|
||||||
where
|
where
|
||||||
-- Use git-annex's android chroot setup script, which will install
|
-- Use git-annex's android chroot setup script, which will install
|
||||||
-- ghc-android and the NDK, all build deps, etc, in the home
|
-- ghc-android and the NDK, all build deps, etc, in the home
|
||||||
|
@ -131,7 +129,10 @@ androidContainer dockerImage name setupgitannexdir gitannexdir = Docker.containe
|
||||||
chrootsetup = scriptProperty
|
chrootsetup = scriptProperty
|
||||||
[ "cd " ++ gitannexdir ++ " && ./standalone/android/buildchroot-inchroot"
|
[ "cd " ++ gitannexdir ++ " && ./standalone/android/buildchroot-inchroot"
|
||||||
]
|
]
|
||||||
osver = System (Debian (Stable "wheezy")) "i386"
|
haskellpkgsinstalled = userScriptProperty "builder"
|
||||||
|
[ "cd " ++ gitannexdir ++ " && ./standalone/android/install-haskell-packages"
|
||||||
|
]
|
||||||
|
osver = System (Debian Testing) "i386" -- once jessie is released, use: (Stable "jessie")
|
||||||
|
|
||||||
-- armel builder has a companion container using amd64 that
|
-- armel builder has a companion container using amd64 that
|
||||||
-- runs the build first to get TH splices. They need
|
-- runs the build first to get TH splices. They need
|
||||||
|
|
|
@ -72,7 +72,7 @@ oldUseNetServer hosts = propertyList ("olduse.net server")
|
||||||
oldUseNetShellBox :: Property
|
oldUseNetShellBox :: Property
|
||||||
oldUseNetShellBox = propertyList "olduse.net shellbox"
|
oldUseNetShellBox = propertyList "olduse.net shellbox"
|
||||||
[ oldUseNetInstalled "oldusenet"
|
[ oldUseNetInstalled "oldusenet"
|
||||||
, Service.running "oldusenet"
|
, Service.running "shellinabox"
|
||||||
]
|
]
|
||||||
|
|
||||||
oldUseNetInstalled :: Apt.Package -> Property
|
oldUseNetInstalled :: Apt.Package -> Property
|
||||||
|
|
Loading…
Reference in New Issue