diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-11 01:09:01 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-11 01:09:01 -0400 |
| commit | 856ce97995bc34e35fd8e0233341f26a37b19cf5 (patch) | |
| tree | 1d93492b36cd07d58437d2cb0f902ad53b3abe6e /config-simple.hs | |
| parent | 07a071ac7f5b2f71e376a9a1a78a84a6bf02129b (diff) | |
| parent | 47ff089f844c707eaa3ffd7255dc733721fb6adf (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'config-simple.hs')
| -rw-r--r-- | config-simple.hs | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/config-simple.hs b/config-simple.hs index d5015ef3..23a760c8 100644 --- a/config-simple.hs +++ b/config-simple.hs @@ -3,6 +3,7 @@ import Propellor import Propellor.CmdLine +import Propellor.Property.Scheduled import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Network as Network @@ -15,39 +16,32 @@ import qualified Propellor.Property.User as User --import qualified Propellor.Property.Tor as Tor import qualified Propellor.Property.Docker as Docker -main :: IO () -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. --- +-- The hosts propellor knows about. -- Edit this to configure propellor! -host :: HostName -> Maybe [Property] -host hostname@"mybox.example.com" = Just $ props - & Apt.stdSourcesList Unstable - `onChange` Apt.upgrade - & Apt.unattendedUpgrades - & Apt.installed ["etckeeper"] - & Apt.installed ["ssh"] - & User.hasSomePassword "root" - & Network.ipv6to4 - & File.dirExists "/var/www" - & Docker.docked container hostname "webserver" - & Docker.garbageCollected - & Cron.runPropellor "30 * * * *" --- add more hosts here... ---host "foo.example.com" = -host _ = Nothing +hosts :: [Host] +hosts = + [ host "mybox.example.com" + & Apt.stdSourcesList Unstable + `onChange` Apt.upgrade + & Apt.unattendedUpgrades + & Apt.installed ["etckeeper"] + & Apt.installed ["ssh"] + & User.hasSomePassword "root" + & Network.ipv6to4 + & File.dirExists "/var/www" + & Docker.docked hosts "webserver" + & Docker.garbageCollected `period` Daily + & Cron.runPropellor "30 * * * *" + + -- A generic webserver in a Docker container. + , Docker.container "webserver" "joeyh/debian-unstable" + & Docker.publish "80:80" + & Docker.volume "/var/www:/var/www" + & Apt.serviceInstalledRunning "apache2" --- | 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 "joeyh/debian-unstable" - [ Docker.publish "80:80" - , Docker.volume "/var/www:/var/www" - , Docker.inside $ props - & serviceRunning "apache2" - `requires` Apt.installed ["apache2"] + -- add more hosts here... + --, host "foo.example.com" = ... ] -container _ _ = Nothing + +main :: IO () +main = defaultMain hosts |
