propellor spin
This commit is contained in:
parent
f3d3a1ffad
commit
7637ea0af9
|
@ -1,7 +1,7 @@
|
||||||
propellor (0.9.1) UNRELEASED; urgency=medium
|
propellor (0.9.1) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Docker: Add ability to control when containers restart.
|
* Docker: Add ability to control when containers restart.
|
||||||
* Docker: Default to always restarting containers, so they come back
|
* Docker: Defaut to always restarting containers, so they come back
|
||||||
up after reboots and docker daemon upgrades.
|
up after reboots and docker daemon upgrades.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 23 Oct 2014 03:05:22 -0400
|
-- Joey Hess <joeyh@debian.org> Thu, 23 Oct 2014 03:05:22 -0400
|
||||||
|
|
|
@ -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 is) & p = Host hn (ps ++ [toProp p]) (is <> getInfo p)
|
(Host hn ps as) & p = Host hn (ps ++ [toProp p]) (as <> getInfo p)
|
||||||
|
|
||||||
infixl 1 &
|
infixl 1 &
|
||||||
|
|
||||||
|
@ -145,14 +145,6 @@ 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,6 +19,7 @@ module Propellor.Property.Docker (
|
||||||
-- * Container configuration
|
-- * Container configuration
|
||||||
dns,
|
dns,
|
||||||
hostname,
|
hostname,
|
||||||
|
name,
|
||||||
publish,
|
publish,
|
||||||
expose,
|
expose,
|
||||||
user,
|
user,
|
||||||
|
@ -155,14 +156,10 @@ mkContainer cid@(ContainerId hn _cn) h = Container
|
||||||
where
|
where
|
||||||
info = _dockerinfo $ hostInfo h'
|
info = _dockerinfo $ hostInfo h'
|
||||||
h' = h
|
h' = h
|
||||||
-- Restart by default so container comes up on
|
-- expose propellor directory inside the container
|
||||||
-- boot or when docker is upgraded.
|
|
||||||
&^ restart 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. This property
|
-- and the user can easily find it later
|
||||||
-- 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
|
||||||
|
@ -222,7 +219,7 @@ dns = runProp "dns"
|
||||||
hostname :: String -> Property
|
hostname :: String -> Property
|
||||||
hostname = runProp "hostname"
|
hostname = runProp "hostname"
|
||||||
|
|
||||||
-- | Set name of container.
|
-- | Set name for container. (Normally done automatically.)
|
||||||
name :: String -> Property
|
name :: String -> Property
|
||||||
name = runProp "name"
|
name = runProp "name"
|
||||||
|
|
||||||
|
@ -385,7 +382,14 @@ runningContainer cid@(ContainerId hn cn) image runps = containerDesc cid $ prope
|
||||||
shim <- liftIO $ Shim.setup (localdir </> "propellor") (localdir </> shimdir cid)
|
shim <- liftIO $ Shim.setup (localdir </> "propellor") (localdir </> shimdir cid)
|
||||||
liftIO $ writeFile (identFile cid) (show ident)
|
liftIO $ writeFile (identFile cid) (show ident)
|
||||||
ensureProperty $ boolProperty "run" $ runContainer img
|
ensureProperty $ boolProperty "run" $ runContainer img
|
||||||
(runps ++ ["-i", "-d", "-t"])
|
-- Restart by default so container comes up on
|
||||||
|
-- boot or when docker is upgraded. This is put
|
||||||
|
-- here, rather than adding a default Property
|
||||||
|
-- in mkContainer, to avoid changing the ident
|
||||||
|
-- of existing containers. Any restart property
|
||||||
|
-- will override it.
|
||||||
|
-- This is a hack. TODO: Move to correct place.
|
||||||
|
("--restart=always" : runps ++ ["-i", "-d", "-t"])
|
||||||
[shim, "--docker", fromContainerId cid]
|
[shim, "--docker", fromContainerId cid]
|
||||||
|
|
||||||
-- | Called when propellor is running inside a docker container.
|
-- | Called when propellor is running inside a docker container.
|
||||||
|
|
Loading…
Reference in New Issue