summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2014-04-01 23:49:15 -0400
committerJoey Hess2014-04-01 23:49:15 -0400
commit3fae22e95b939bc8f05bbd624b8a03ea542fc345 (patch)
tree9273d74d8f8e6eab8b5fe5d4f5454e5f8815bd52
parenta200bcd85a0d2b89ed0dea67dfe693f03ddac7e7 (diff)
changed Arch to String type
-rw-r--r--Propellor/Property/SiteSpecific/GitAnnexBuilder.hs4
-rw-r--r--Propellor/Types.hs3
-rw-r--r--config.hs38
-rw-r--r--config.hs.simple2
4 files changed, 25 insertions, 22 deletions
diff --git a/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
index cf30ba36..8fcfbd6a 100644
--- a/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
+++ b/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
@@ -6,8 +6,6 @@ import qualified Propellor.Property.User as User
import qualified Propellor.Property.Cron as Cron
import Propellor.Property.Cron (CronTimes)
-import Data.Char
-
builduser :: UserName
builduser = "builder"
@@ -26,7 +24,7 @@ builder arch crontimes = combineProperties "gitannexbuilder"
, check (lacksdir builddir) $ userScriptProperty builduser
[ "git clone git://git.kitenet.net/gitannexbuilder " ++ builddir
, "cd " ++ builddir
- , "git checkout " ++ map toLower (show arch)
+ , "git checkout " ++ arch
]
`describe` "gitbuilder setup"
, check (lacksdir $ builddir </> "build") $ userScriptProperty builduser
diff --git a/Propellor/Types.hs b/Propellor/Types.hs
index c18cc7b7..bcb5efd1 100644
--- a/Propellor/Types.hs
+++ b/Propellor/Types.hs
@@ -40,8 +40,7 @@ data DebianSuite = Experimental | Unstable | Testing | Stable | DebianRelease Re
type Release = String
-data Architecture = Amd64 | I386 | Armel
- deriving (Show)
+type Architecture = String
-- | Results of actions, with color.
class ActionResult a where
diff --git a/config.hs b/config.hs
index 244fa48b..03edffa1 100644
--- a/config.hs
+++ b/config.hs
@@ -20,6 +20,7 @@ import qualified Propellor.Property.Docker as Docker
import qualified Propellor.Property.SiteSpecific.GitHome as GitHome
import qualified Propellor.Property.SiteSpecific.GitAnnexBuilder as GitAnnexBuilder
import qualified Propellor.Property.SiteSpecific.JoeySites as JoeySites
+import Data.List
main :: IO ()
main = defaultMain [host, Docker.containerProperties container]
@@ -48,10 +49,12 @@ host hostname@"clam.kitenet.net" = Just
, Apt.installed ["systemd-sysv"] `onChange` Reboot.now
]
host hostname@"orca.kitenet.net" = Just
- [ standardSystem Unstable
+ [ Hostname.set hostname
+ , standardSystem Unstable
, Apt.unattendedUpgrades True
, 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
]
-- add more hosts here...
@@ -61,26 +64,29 @@ host _ = Nothing
-- | This is where Docker containers are set up. A container
-- can vary by hostname where it's used, or be the same everywhere.
container :: HostName -> Docker.ContainerName -> Maybe (Docker.Container)
-container _ "webserver" = Just $ Docker.containerFrom
- (image $ System (Debian Unstable) Amd64)
- [ Docker.publish "8080:80"
- , Docker.volume "/var/www:/var/www"
- , Docker.inside
- [ serviceRunning "apache2"
- `requires` Apt.installed ["apache2"]
+container _host name
+ | name == "webserver" = Just $ Docker.containerFrom
+ (image $ System (Debian Unstable) "amd64")
+ [ Docker.publish "8080:80"
+ , Docker.volume "/var/www:/var/www"
+ , Docker.inside
+ [ serviceRunning "apache2"
+ `requires` Apt.installed ["apache2"]
+ ]
]
- ]
-container _ "git-annex-amd64-builder" = Just $ Docker.containerFrom
- (image $ System (Debian Unstable) Amd64)
- [ Docker.inside [ GitAnnexBuilder.builder Amd64 "15 * * * *" ] ]
-container _ _ = Nothing
+ | "-git-annex-builder" `isSuffixOf` name =
+ let arch = takeWhile (/= '-') name
+ in Just $ Docker.containerFrom
+ (image $ System (Debian Unstable) arch)
+ [ Docker.inside [ GitAnnexBuilder.builder arch "15 * * * *" ] ]
+ | otherwise = Nothing
-- | Docker images I prefer to use.
-- Edit as suites you, or delete this function and just put the image names
-- above.
image :: System -> Docker.Image
-image (System (Debian Unstable) Amd64) = "joeyh/debian-unstable"
-image (System (Debian Unstable) I386) = "joeyh/debian-i386"
+image (System (Debian Unstable) "amd64") = "joeyh/debian-unstable"
+image (System (Debian Unstable) "i386") = "joeyh/debian-unstable-i386"
image _ = "debian"
-- This is my standard system setup
diff --git a/config.hs.simple b/config.hs.simple
index 7acb7b88..5e9f8c3c 100644
--- a/config.hs.simple
+++ b/config.hs.simple
@@ -44,7 +44,7 @@ host _ = Nothing
-- can vary by hostname where it's used, or be the same everywhere.
container :: HostName -> Docker.ContainerName -> Maybe (Docker.Container)
container _ "webserver" = Just $ Docker.containerFrom "joeyh/debian-unstable"
- (image $ System (Debian Unstable) Amd64)
+ (image $ System (Debian Unstable) "amd64")
[ Docker.publish "80:80"
, Docker.volume "/var/www:/var/www"
, Docker.inside