This commit is contained in:
Joey Hess 2014-05-22 21:42:57 -04:00
parent 07d3d359d2
commit 424ba1229b
2 changed files with 53 additions and 45 deletions

View File

@ -189,48 +189,12 @@ hosts = -- (o) `
(Just "remotes/origin/old-kitenet.net") (Just "remotes/origin/old-kitenet.net")
-- git-annex autobuilder containers -- git-annex autobuilder containers
, standardGitAnnexBuilder "amd64" 15 "2h" , GitAnnexBuilder.standardContainer dockerImage "amd64" 15 "2h"
, standardGitAnnexBuilder "i386" 45 "2h" , GitAnnexBuilder.standardContainer dockerImage "i386" 45 "2h"
-- armel builder has a companion container using amd64 that , GitAnnexBuilder.armelCompanionContainer dockerImage
-- runs the build first to get TH splices. They need , GitAnnexBuilder.armelContainer dockerImage "1 3 * * *" "5h"
-- to have the same versions of all haskell libraries installed.
, Docker.container "armel-git-annex-builder-companion"
(image $ System (Debian Unstable) "amd64")
& Apt.stdSourcesList Unstable
& Apt.unattendedUpgrades
-- This volume is shared with the armel builder.
& Docker.volume GitAnnexBuilder.gitbuilderdir
-- Install current versions of build deps from cabal.
& GitAnnexBuilder.tree "armel"
& GitAnnexBuilder.buildDepsNoHaskellLibs
& GitAnnexBuilder.cabalDeps
-- The armel builder can ssh to this companion,
-- using $COMPANION_PORT_22_TCP_ADDR as the hostname,
& Docker.expose "22"
& Apt.serviceInstalledRunning "ssh"
& Ssh.authorizedKeys GitAnnexBuilder.builduser
, Docker.container "armel-git-annex-builder"
(image $ System (Debian Unstable) "armel")
& Apt.stdSourcesList Unstable
& Apt.unattendedUpgrades
& Apt.installed ["openssh-client"]
& Docker.link "armel-git-annex-builder-companion" "companion"
& Docker.volumes_from "armel-git-annex-builder-companion"
-- TODO: automate installing haskell libs
-- (Currently have to run
-- git-annex/standalone/linux/install-haskell-packages
-- which is not fully automated.)
& GitAnnexBuilder.builder' GitAnnexBuilder.buildDepsNoHaskellLibs "armel" "1 3 * * *" "5h" True
& Ssh.keyImported SshRsa GitAnnexBuilder.builduser
] ++ monsters ] ++ monsters
standardGitAnnexBuilder :: Architecture -> Int -> GitAnnexBuilder.TimeOut -> Host
standardGitAnnexBuilder arch buildminute timeout = Docker.container (arch ++ "-git-annex-builder")
(image $ System (Debian Unstable) arch)
& Apt.stdSourcesList Unstable
& Apt.unattendedUpgrades
& GitAnnexBuilder.builder arch (show buildminute ++ " * * * *") timeout True
-- This is my standard system setup. -- This is my standard system setup.
standardSystem :: HostName -> DebianSuite -> Architecture -> Host standardSystem :: HostName -> DebianSuite -> Architecture -> Host
standardSystem hn suite arch = host hn standardSystem hn suite arch = host hn
@ -257,7 +221,7 @@ standardSystem hn suite arch = host hn
-- This is my standard container setup, featuring automatic upgrades. -- This is my standard container setup, featuring automatic upgrades.
standardContainer :: Docker.ContainerName -> DebianSuite -> Architecture -> Host standardContainer :: Docker.ContainerName -> DebianSuite -> Architecture -> Host
standardContainer name suite arch = Docker.container name (image system) standardContainer name suite arch = Docker.container name (dockerImage system)
& os (System (Debian suite) arch) & os (System (Debian suite) arch)
& Apt.stdSourcesList suite & Apt.stdSourcesList suite
& Apt.unattendedUpgrades & Apt.unattendedUpgrades
@ -265,10 +229,10 @@ standardContainer name suite arch = Docker.container name (image system)
system = System (Debian suite) arch system = System (Debian suite) arch
-- Docker images I prefer to use. -- Docker images I prefer to use.
image :: System -> Docker.Image dockerImage :: System -> Docker.Image
image (System (Debian Unstable) arch) = "joeyh/debian-unstable-" ++ arch dockerImage (System (Debian Unstable) arch) = "joeyh/debian-unstable-" ++ arch
image (System (Debian Stable) arch) = "joeyh/debian-stable-" ++ arch dockerImage (System (Debian Stable) arch) = "joeyh/debian-stable-" ++ arch
image _ = "debian-stable-official" -- does not currently exist! dockerImage _ = "debian-stable-official" -- does not currently exist!
-- Digital Ocean does not provide any way to boot -- Digital Ocean does not provide any way to boot
-- the kernel provided by the distribution, except using kexec. -- the kernel provided by the distribution, except using kexec.

View File

@ -4,7 +4,9 @@ import Propellor
import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.User as User import qualified Propellor.Property.User as User
import qualified Propellor.Property.Cron as Cron import qualified Propellor.Property.Cron as Cron
import qualified Propellor.Property.Ssh as Ssh
import qualified Propellor.Property.File as File import qualified Propellor.Property.File as File
import qualified Propellor.Property.Docker as Docker
import Propellor.Property.Cron (CronTimes) import Propellor.Property.Cron (CronTimes)
builduser :: UserName builduser :: UserName
@ -93,3 +95,45 @@ cabalDeps = flagFile go cabalupdated
where where
go = userScriptProperty builduser ["cabal update && cabal install git-annex --only-dependencies || true"] go = userScriptProperty builduser ["cabal update && cabal install git-annex --only-dependencies || true"]
cabalupdated = homedir </> ".cabal" </> "packages" </> "hackage.haskell.org" </> "00-index.cache" cabalupdated = homedir </> ".cabal" </> "packages" </> "hackage.haskell.org" </> "00-index.cache"
standardContainer :: (System -> Docker.Image) -> Architecture -> Int -> TimeOut -> Host
standardContainer dockerImage arch buildminute timeout = Docker.container (arch ++ "-git-annex-builder")
(dockerImage $ System (Debian Unstable) arch)
& Apt.stdSourcesList Unstable
& Apt.unattendedUpgrades
& builder arch (show buildminute ++ " * * * *") timeout True
-- armel builder has a companion container using amd64 that
-- runs the build first to get TH splices. They need
-- to have the same versions of all haskell libraries installed.
armelCompanionContainer :: (System -> Docker.Image) -> Host
armelCompanionContainer dockerImage = Docker.container "armel-git-annex-builder-companion"
(dockerImage $ System (Debian Unstable) "amd64")
& Apt.stdSourcesList Unstable
& Apt.unattendedUpgrades
-- This volume is shared with the armel builder.
& Docker.volume gitbuilderdir
-- Install current versions of build deps from cabal.
& tree "armel"
& buildDepsNoHaskellLibs
& cabalDeps
-- The armel builder can ssh to this companion,
-- using $COMPANION_PORT_22_TCP_ADDR as the hostname,
& Docker.expose "22"
& Apt.serviceInstalledRunning "ssh"
& Ssh.authorizedKeys builduser
armelContainer :: (System -> Docker.Image) -> Cron.CronTimes -> TimeOut -> Host
armelContainer dockerImage crontimes timeout = Docker.container "armel-git-annex-builder"
(dockerImage $ System (Debian Unstable) "armel")
& Apt.stdSourcesList Unstable
& Apt.unattendedUpgrades
& Apt.installed ["openssh-client"]
& Docker.link "armel-git-annex-builder-companion" "companion"
& Docker.volumes_from "armel-git-annex-builder-companion"
-- TODO: automate installing haskell libs
-- (Currently have to run
-- git-annex/standalone/linux/install-haskell-packages
-- which is not fully automated.)
& builder' buildDepsNoHaskellLibs "armel" crontimes timeout True
& Ssh.keyImported SshRsa builduser