propellor spin
This commit is contained in:
parent
527fff74c3
commit
c224625734
|
@ -224,7 +224,7 @@ hosts = -- (o) `
|
||||||
in GitAnnexBuilder.androidContainer dockerImage "android-git-annex" doNothing gitannexdir
|
in GitAnnexBuilder.androidContainer dockerImage "android-git-annex" doNothing gitannexdir
|
||||||
& Docker.volume ("/home/joey/src/git-annex:" ++ gitannexdir)
|
& Docker.volume ("/home/joey/src/git-annex:" ++ gitannexdir)
|
||||||
|
|
||||||
-- temp for an aqquantance
|
-- temp for an accuantance
|
||||||
, standardContainer "voltagex" Stable "amd64"
|
, standardContainer "voltagex" Stable "amd64"
|
||||||
& Docker.publish "22022:22"
|
& Docker.publish "22022:22"
|
||||||
& Apt.serviceInstalledRunning "ssh"
|
& Apt.serviceInstalledRunning "ssh"
|
||||||
|
|
|
@ -11,6 +11,7 @@ module Propellor.Property.Docker (
|
||||||
configured,
|
configured,
|
||||||
container,
|
container,
|
||||||
docked,
|
docked,
|
||||||
|
memoryLimited,
|
||||||
garbageCollected,
|
garbageCollected,
|
||||||
Image,
|
Image,
|
||||||
ContainerName,
|
ContainerName,
|
||||||
|
@ -25,6 +26,7 @@ module Propellor.Property.Docker (
|
||||||
volumes_from,
|
volumes_from,
|
||||||
workdir,
|
workdir,
|
||||||
memory,
|
memory,
|
||||||
|
cpuShares,
|
||||||
link,
|
link,
|
||||||
ContainerAlias,
|
ContainerAlias,
|
||||||
-- * Internal use
|
-- * Internal use
|
||||||
|
@ -170,6 +172,20 @@ garbageCollected = propertyList "docker garbage collected"
|
||||||
gcimages = property "docker images garbage collected" $ do
|
gcimages = property "docker images garbage collected" $ do
|
||||||
liftIO $ report <$> (mapM removeImage =<< listImages)
|
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]
|
data Container = Container Image [RunParam]
|
||||||
|
|
||||||
-- | Parameters to pass to `docker run` when creating a container.
|
-- | Parameters to pass to `docker run` when creating a container.
|
||||||
|
@ -220,10 +236,17 @@ workdir :: String -> Property
|
||||||
workdir = runProp "workdir"
|
workdir = runProp "workdir"
|
||||||
|
|
||||||
-- | Memory limit for container.
|
-- | Memory limit for container.
|
||||||
--Format: <number><optional unit>, where unit = b, k, m or g
|
-- Format: <number><optional unit>, where unit = b, k, m or g
|
||||||
|
--
|
||||||
|
-- Note: Only takes effect when the host has the memoryLimited property
|
||||||
|
-- enabled.
|
||||||
memory :: String -> Property
|
memory :: String -> Property
|
||||||
memory = runProp "memory"
|
memory = runProp "memory"
|
||||||
|
|
||||||
|
-- | CPU shares (relative weight).
|
||||||
|
cpuShares :: Int -> Property
|
||||||
|
cpuShares = runProp "cpu-shares" . show
|
||||||
|
|
||||||
-- | Link with another container on the same host.
|
-- | Link with another container on the same host.
|
||||||
link :: ContainerName -> ContainerAlias -> Property
|
link :: ContainerName -> ContainerAlias -> Property
|
||||||
link linkwith calias = genProp "link" $ \hn ->
|
link linkwith calias = genProp "link" $ \hn ->
|
||||||
|
|
Loading…
Reference in New Issue