summaryrefslogtreecommitdiff
path: root/config.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-01 01:12:05 -0400
committerJoey Hess2014-04-01 01:12:05 -0400
commit90f86b8b2bb7f0a3c834387827c9ec2e1876f342 (patch)
tree10e74b0a52f4987c6f7e9cf2abf756275e0cefae /config.hs
parentd53729495efe7174239deab3b5dd71204543b0d0 (diff)
not quite working docker container interface
Diffstat (limited to 'config.hs')
-rw-r--r--config.hs40
1 files changed, 26 insertions, 14 deletions
diff --git a/config.hs b/config.hs
index 75309f6c..88703db7 100644
--- a/config.hs
+++ b/config.hs
@@ -1,5 +1,5 @@
-{- This is the main configuration file for Propellor, and is used to build
- - the propellor program. -}
+-- | This is the main configuration file for Propellor, and is used to build
+-- the propellor program.
import Propellor
import Propellor.CmdLine
@@ -18,16 +18,15 @@ import qualified Propellor.Property.GitHome as GitHome
import qualified Propellor.Property.JoeySites as JoeySites
main :: IO ()
-main = defaultMain getProperties
+main = defaultMain [host, Docker.containerProperties container]
-{- | This is where the system's HostName, either as returned by uname
- - or one specified on the command line, is converted into a list of
- - Properties for that system.
- -
- - Edit this to configure propellor!
- -}
-getProperties :: HostName -> Maybe [Property]
-getProperties hostname@"clam.kitenet.net" = Just
+-- | This is where the system's HostName, either as returned by uname
+-- or one specified on the command line, is converted into a list of
+-- Properties for that system.
+--
+-- Edit this to configure propellor!
+host :: HostName -> Maybe [Property]
+host hostname@"clam.kitenet.net" = Just
[ cleanCloudAtCost hostname
, standardSystem Apt.Unstable
, Apt.unattendedUpgrades True
@@ -37,18 +36,31 @@ getProperties hostname@"clam.kitenet.net" = Just
, Tor.isBridge
, JoeySites.oldUseNetshellBox
, Docker.configured
+ , File.dirExists "/var/www"
+ , Docker.hasContainer hostname "webserver" container
, Apt.installed ["git-annex", "mtr"]
-- Should come last as it reboots.
, Apt.installed ["systemd-sysv"] `onChange` Reboot.now
]
-getProperties "orca.kitenet.net" = Just
+host "orca.kitenet.net" = Just
[ standardSystem Apt.Unstable
, Apt.unattendedUpgrades True
, Docker.configured
]
-- add more hosts here...
---getProperties "foo" =
-getProperties _ = Nothing
+--host "foo.example.com" =
+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.containerFromImage "debian"
+ [ Docker.publish "80:80"
+ , Docker.volume "/var/www:/var/www"
+ , Docker.inside $ serviceRunning "apache2"
+ `requires` Apt.installed ["apache2"]
+ ]
+container _ _ = Nothing
-- This is my standard system setup
standardSystem :: Apt.Suite -> Property