propellor spin
This commit is contained in:
parent
4ea2771b69
commit
e435d97927
|
@ -4,14 +4,21 @@ import Propellor
|
||||||
import qualified Propellor.Property.File as File
|
import qualified Propellor.Property.File as File
|
||||||
import qualified Propellor.Property.Apt as Apt
|
import qualified Propellor.Property.Apt as Apt
|
||||||
|
|
||||||
providerFor :: [UserName] -> Property
|
import Data.List
|
||||||
providerFor users = propertyList ("openid provider") $
|
|
||||||
|
providerFor :: [UserName] -> HostName -> Property
|
||||||
|
providerFor users hostname = propertyList ("openid provider") $
|
||||||
[ serviceRunning "apache2"
|
[ serviceRunning "apache2"
|
||||||
`requires` Apt.installed ["apache2"]
|
`requires` Apt.installed ["apache2"]
|
||||||
, Apt.installed ["simpleid"]
|
, Apt.installed ["simpleid"]
|
||||||
`onChange` serviceRestarted "apache2"
|
`onChange` serviceRestarted "apache2"
|
||||||
, serviceRestarted "apache2"
|
, File.fileProperty ("simpleid host " ++ hostname)
|
||||||
|
(map setbaseurl) "/etc/simpleid/config.inc"
|
||||||
] ++ map identfile users
|
] ++ map identfile users
|
||||||
where
|
where
|
||||||
identfile u = File.hasPrivContent $ concat
|
identfile u = File.hasPrivContent $ concat
|
||||||
[ "/var/lib/simpleid/identities/", u, ".identity" ]
|
[ "/var/lib/simpleid/identities/", u, ".identity" ]
|
||||||
|
setbaseurl l
|
||||||
|
| "SIMPLEID_BASE_URL" `isInfixOf` l =
|
||||||
|
"define('SIMPLEID_BASE_URL', 'http://"++hostname++"/simpleid');"
|
||||||
|
| otherwise = l
|
||||||
|
|
|
@ -61,7 +61,7 @@ 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 _parenthost name
|
container parenthost name
|
||||||
-- Simple web server, publishing the outside host's /var/www
|
-- Simple web server, publishing the outside host's /var/www
|
||||||
| name == "webserver" = Just $ Docker.containerFrom
|
| name == "webserver" = Just $ Docker.containerFrom
|
||||||
(image $ System (Debian Unstable) "amd64")
|
(image $ System (Debian Unstable) "amd64")
|
||||||
|
@ -70,6 +70,7 @@ container _parenthost name
|
||||||
, Docker.inside $ props
|
, Docker.inside $ props
|
||||||
& serviceRunning "apache2"
|
& serviceRunning "apache2"
|
||||||
`requires` Apt.installed ["apache2"]
|
`requires` Apt.installed ["apache2"]
|
||||||
|
& Apt.unattendedUpgrades
|
||||||
]
|
]
|
||||||
|
|
||||||
-- My own openid provider. Uses php, so containerized for security
|
-- My own openid provider. Uses php, so containerized for security
|
||||||
|
@ -78,8 +79,9 @@ container _parenthost name
|
||||||
(image $ System (Debian Stable) "amd64")
|
(image $ System (Debian Stable) "amd64")
|
||||||
[ Docker.publish "8081:80"
|
[ Docker.publish "8081:80"
|
||||||
, Docker.inside $ props
|
, Docker.inside $ props
|
||||||
& Apt.stdSourcesList Stable `onChange` Apt.upgrade
|
& Apt.stdSourcesList Stable
|
||||||
& OpenId.providerFor ["joey", "liw"]
|
& Apt.unattendedUpgrades
|
||||||
|
& OpenId.providerFor ["joey", "liw"] parenthost
|
||||||
]
|
]
|
||||||
|
|
||||||
-- armel builder has a companion container that run amd64 and
|
-- armel builder has a companion container that run amd64 and
|
||||||
|
@ -89,6 +91,8 @@ container _parenthost name
|
||||||
| name == "armel-git-annex-builder-companion" = Just $ Docker.containerFrom
|
| name == "armel-git-annex-builder-companion" = Just $ Docker.containerFrom
|
||||||
(image $ System (Debian Unstable) "amd64")
|
(image $ System (Debian Unstable) "amd64")
|
||||||
[ Docker.volume GitAnnexBuilder.homedir
|
[ Docker.volume GitAnnexBuilder.homedir
|
||||||
|
, Docker.inside $ props
|
||||||
|
& Apt.unattendedUpgrades
|
||||||
]
|
]
|
||||||
| name == "armel-git-annex-builder" = Just $ Docker.containerFrom
|
| name == "armel-git-annex-builder" = Just $ Docker.containerFrom
|
||||||
(image $ System (Debian Unstable) "armel")
|
(image $ System (Debian Unstable) "armel")
|
||||||
|
@ -96,13 +100,17 @@ container _parenthost name
|
||||||
, Docker.volumes_from (name ++ "-companion")
|
, Docker.volumes_from (name ++ "-companion")
|
||||||
, Docker.inside $ props
|
, Docker.inside $ props
|
||||||
-- & GitAnnexBuilder.builder "armel" "15 * * * *" True
|
-- & GitAnnexBuilder.builder "armel" "15 * * * *" True
|
||||||
|
& Apt.unattendedUpgrades
|
||||||
]
|
]
|
||||||
|
|
||||||
| "-git-annex-builder" `isSuffixOf` name =
|
| "-git-annex-builder" `isSuffixOf` name =
|
||||||
let arch = takeWhile (/= '-') name
|
let arch = takeWhile (/= '-') name
|
||||||
in Just $ Docker.containerFrom
|
in Just $ Docker.containerFrom
|
||||||
(image $ System (Debian Unstable) arch)
|
(image $ System (Debian Unstable) arch)
|
||||||
[ Docker.inside $ props & GitAnnexBuilder.builder arch "15 * * * *" True ]
|
[ Docker.inside $ props
|
||||||
|
& GitAnnexBuilder.builder arch "15 * * * *" True
|
||||||
|
& Apt.unattendedUpgrades
|
||||||
|
]
|
||||||
|
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue