changed Arch to String type

This commit is contained in:
Joey Hess 2014-04-01 23:49:15 -04:00
parent a200bcd85a
commit 3fae22e95b
4 changed files with 25 additions and 22 deletions

View File

@ -6,8 +6,6 @@ import qualified Propellor.Property.User as User
import qualified Propellor.Property.Cron as Cron import qualified Propellor.Property.Cron as Cron
import Propellor.Property.Cron (CronTimes) import Propellor.Property.Cron (CronTimes)
import Data.Char
builduser :: UserName builduser :: UserName
builduser = "builder" builduser = "builder"
@ -26,7 +24,7 @@ builder arch crontimes = combineProperties "gitannexbuilder"
, check (lacksdir builddir) $ userScriptProperty builduser , check (lacksdir builddir) $ userScriptProperty builduser
[ "git clone git://git.kitenet.net/gitannexbuilder " ++ builddir [ "git clone git://git.kitenet.net/gitannexbuilder " ++ builddir
, "cd " ++ builddir , "cd " ++ builddir
, "git checkout " ++ map toLower (show arch) , "git checkout " ++ arch
] ]
`describe` "gitbuilder setup" `describe` "gitbuilder setup"
, check (lacksdir $ builddir </> "build") $ userScriptProperty builduser , check (lacksdir $ builddir </> "build") $ userScriptProperty builduser

View File

@ -40,8 +40,7 @@ data DebianSuite = Experimental | Unstable | Testing | Stable | DebianRelease Re
type Release = String type Release = String
data Architecture = Amd64 | I386 | Armel type Architecture = String
deriving (Show)
-- | Results of actions, with color. -- | Results of actions, with color.
class ActionResult a where class ActionResult a where

View File

@ -20,6 +20,7 @@ import qualified Propellor.Property.Docker as Docker
import qualified Propellor.Property.SiteSpecific.GitHome as GitHome import qualified Propellor.Property.SiteSpecific.GitHome as GitHome
import qualified Propellor.Property.SiteSpecific.GitAnnexBuilder as GitAnnexBuilder import qualified Propellor.Property.SiteSpecific.GitAnnexBuilder as GitAnnexBuilder
import qualified Propellor.Property.SiteSpecific.JoeySites as JoeySites import qualified Propellor.Property.SiteSpecific.JoeySites as JoeySites
import Data.List
main :: IO () main :: IO ()
main = defaultMain [host, Docker.containerProperties container] main = defaultMain [host, Docker.containerProperties container]
@ -48,10 +49,12 @@ host hostname@"clam.kitenet.net" = Just
, Apt.installed ["systemd-sysv"] `onChange` Reboot.now , Apt.installed ["systemd-sysv"] `onChange` Reboot.now
] ]
host hostname@"orca.kitenet.net" = Just host hostname@"orca.kitenet.net" = Just
[ standardSystem Unstable [ Hostname.set hostname
, standardSystem Unstable
, Apt.unattendedUpgrades True , Apt.unattendedUpgrades True
, Docker.configured , Docker.configured
, Docker.docked container hostname "git-annex-amd64-builder" , Docker.docked container hostname "amd64-git-annex-builder"
, Docker.docked container hostname "i386-git-annex-builder"
, Docker.garbageCollected , Docker.garbageCollected
] ]
-- add more hosts here... -- add more hosts here...
@ -61,8 +64,9 @@ host _ = Nothing
-- | This is where Docker containers are set up. A container -- | This is where Docker containers are set up. A container
-- can vary by hostname where it's used, or be the same everywhere. -- can vary by hostname where it's used, or be the same everywhere.
container :: HostName -> Docker.ContainerName -> Maybe (Docker.Container) container :: HostName -> Docker.ContainerName -> Maybe (Docker.Container)
container _ "webserver" = Just $ Docker.containerFrom container _host name
(image $ System (Debian Unstable) Amd64) | name == "webserver" = Just $ Docker.containerFrom
(image $ System (Debian Unstable) "amd64")
[ Docker.publish "8080:80" [ Docker.publish "8080:80"
, Docker.volume "/var/www:/var/www" , Docker.volume "/var/www:/var/www"
, Docker.inside , Docker.inside
@ -70,17 +74,19 @@ container _ "webserver" = Just $ Docker.containerFrom
`requires` Apt.installed ["apache2"] `requires` Apt.installed ["apache2"]
] ]
] ]
container _ "git-annex-amd64-builder" = Just $ Docker.containerFrom | "-git-annex-builder" `isSuffixOf` name =
(image $ System (Debian Unstable) Amd64) let arch = takeWhile (/= '-') name
[ Docker.inside [ GitAnnexBuilder.builder Amd64 "15 * * * *" ] ] in Just $ Docker.containerFrom
container _ _ = Nothing (image $ System (Debian Unstable) arch)
[ Docker.inside [ GitAnnexBuilder.builder arch "15 * * * *" ] ]
| otherwise = Nothing
-- | Docker images I prefer to use. -- | Docker images I prefer to use.
-- Edit as suites you, or delete this function and just put the image names -- Edit as suites you, or delete this function and just put the image names
-- above. -- above.
image :: System -> Docker.Image image :: System -> Docker.Image
image (System (Debian Unstable) Amd64) = "joeyh/debian-unstable" image (System (Debian Unstable) "amd64") = "joeyh/debian-unstable"
image (System (Debian Unstable) I386) = "joeyh/debian-i386" image (System (Debian Unstable) "i386") = "joeyh/debian-unstable-i386"
image _ = "debian" image _ = "debian"
-- This is my standard system setup -- This is my standard system setup

View File

@ -44,7 +44,7 @@ host _ = Nothing
-- can vary by hostname where it's used, or be the same everywhere. -- can vary by hostname where it's used, or be the same everywhere.
container :: HostName -> Docker.ContainerName -> Maybe (Docker.Container) container :: HostName -> Docker.ContainerName -> Maybe (Docker.Container)
container _ "webserver" = Just $ Docker.containerFrom "joeyh/debian-unstable" container _ "webserver" = Just $ Docker.containerFrom "joeyh/debian-unstable"
(image $ System (Debian Unstable) Amd64) (image $ System (Debian Unstable) "amd64")
[ Docker.publish "80:80" [ Docker.publish "80:80"
, Docker.volume "/var/www:/var/www" , Docker.volume "/var/www:/var/www"
, Docker.inside , Docker.inside