summaryrefslogtreecommitdiff
path: root/src/Propellor/Property
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Property')
-rw-r--r--src/Propellor/Property/Aiccu.hs2
-rw-r--r--src/Propellor/Property/Apache.hs55
-rw-r--r--src/Propellor/Property/Apt.hs2
-rw-r--r--src/Propellor/Property/Chroot.hs6
-rw-r--r--src/Propellor/Property/ConfFile.hs2
-rw-r--r--src/Propellor/Property/Cron.hs2
-rw-r--r--src/Propellor/Property/DebianMirror.hs2
-rw-r--r--src/Propellor/Property/Debootstrap.hs2
-rw-r--r--src/Propellor/Property/DiskImage.hs2
-rw-r--r--src/Propellor/Property/Dns.hs2
-rw-r--r--src/Propellor/Property/DnsSec.hs2
-rw-r--r--src/Propellor/Property/Docker.hs6
-rw-r--r--src/Propellor/Property/File.hs2
-rw-r--r--src/Propellor/Property/Firewall.hs2
-rw-r--r--src/Propellor/Property/Git.hs2
-rw-r--r--src/Propellor/Property/Gpg.hs2
-rw-r--r--src/Propellor/Property/Group.hs2
-rw-r--r--src/Propellor/Property/Grub.hs2
-rw-r--r--src/Propellor/Property/HostingProvider/CloudAtCost.hs2
-rw-r--r--src/Propellor/Property/HostingProvider/DigitalOcean.hs2
-rw-r--r--src/Propellor/Property/HostingProvider/Linode.hs2
-rw-r--r--src/Propellor/Property/Hostname.hs2
-rw-r--r--src/Propellor/Property/Journald.hs3
-rw-r--r--src/Propellor/Property/Kerberos.hs2
-rw-r--r--src/Propellor/Property/LightDM.hs2
-rw-r--r--src/Propellor/Property/List.hs24
-rw-r--r--src/Propellor/Property/Logcheck.hs2
-rw-r--r--src/Propellor/Property/Mount.hs2
-rw-r--r--src/Propellor/Property/Network.hs2
-rw-r--r--src/Propellor/Property/Nginx.hs2
-rw-r--r--src/Propellor/Property/OS.hs2
-rw-r--r--src/Propellor/Property/Obnam.hs2
-rw-r--r--src/Propellor/Property/OpenId.hs38
-rw-r--r--src/Propellor/Property/Parted.hs2
-rw-r--r--src/Propellor/Property/Partition.hs2
-rw-r--r--src/Propellor/Property/Postfix.hs2
-rw-r--r--src/Propellor/Property/Prosody.hs2
-rw-r--r--src/Propellor/Property/Reboot.hs2
-rw-r--r--src/Propellor/Property/Rsync.hs2
-rw-r--r--src/Propellor/Property/Scheduled.hs2
-rw-r--r--src/Propellor/Property/Service.hs2
-rw-r--r--src/Propellor/Property/SiteSpecific/Branchable.hs2
-rw-r--r--src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs2
-rw-r--r--src/Propellor/Property/SiteSpecific/GitHome.hs2
-rw-r--r--src/Propellor/Property/SiteSpecific/IABak.hs2
-rw-r--r--src/Propellor/Property/SiteSpecific/JoeySites.hs2
-rw-r--r--src/Propellor/Property/Ssh.hs2
-rw-r--r--src/Propellor/Property/Sudo.hs2
-rw-r--r--src/Propellor/Property/Systemd.hs8
-rw-r--r--src/Propellor/Property/Systemd/Core.hs2
-rw-r--r--src/Propellor/Property/Tor.hs2
-rw-r--r--src/Propellor/Property/Unbound.hs2
-rw-r--r--src/Propellor/Property/User.hs2
-rw-r--r--src/Propellor/Property/Uwsgi.hs2
54 files changed, 147 insertions, 87 deletions
diff --git a/src/Propellor/Property/Aiccu.hs b/src/Propellor/Property/Aiccu.hs
index a1b24472..47841a7b 100644
--- a/src/Propellor/Property/Aiccu.hs
+++ b/src/Propellor/Property/Aiccu.hs
@@ -9,7 +9,7 @@ module Propellor.Property.Aiccu (
hasConfig,
) where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
import qualified Propellor.Property.File as File
diff --git a/src/Propellor/Property/Apache.hs b/src/Propellor/Property/Apache.hs
index fe81dcd8..91b2e6a2 100644
--- a/src/Propellor/Property/Apache.hs
+++ b/src/Propellor/Property/Apache.hs
@@ -1,10 +1,33 @@
module Propellor.Property.Apache where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
+installed :: Property NoInfo
+installed = Apt.installed ["apache2"]
+
+restarted :: Property NoInfo
+restarted = Service.restarted "apache2"
+
+reloaded :: Property NoInfo
+reloaded = Service.reloaded "apache2"
+
+-- | A basic virtual host, publishing a directory, and logging to
+-- the combined apache log file.
+virtualHost :: HostName -> Port -> FilePath -> RevertableProperty
+virtualHost hn (Port p) docroot = siteEnabled hn
+ [ "<VirtualHost *:"++show p++">"
+ , "ServerName "++hn++":"++show p
+ , "DocumentRoot " ++ docroot
+ , "ErrorLog /var/log/apache2/error.log"
+ , "LogLevel warn"
+ , "CustomLog /var/log/apache2/access.log combined"
+ , "ServerSignature On"
+ , "</VirtualHost>"
+ ]
+
type ConfigFile = [String]
siteEnabled :: HostName -> ConfigFile -> RevertableProperty
@@ -19,13 +42,16 @@ siteEnabled hn cf = enable <!> disable
`requires` installed
`onChange` reloaded
]
- disable = combineProperties
- ("apache site disabled " ++ hn)
- (map File.notPresent (siteCfg hn))
+ disable = siteDisabled hn
+ isenabled = boolSystem "a2query" [Param "-q", Param "-s", Param hn]
+
+siteDisabled :: HostName -> Property NoInfo
+siteDisabled hn = combineProperties
+ ("apache site disabled " ++ hn)
+ (map File.notPresent (siteCfg hn))
`onChange` cmdProperty "a2dissite" ["--quiet", hn]
`requires` installed
`onChange` reloaded
- isenabled = boolSystem "a2query" [Param "-q", Param "-s", Param hn]
siteAvailable :: HostName -> ConfigFile -> Property NoInfo
siteAvailable hn cf = combineProperties ("apache site available " ++ hn) $
@@ -48,6 +74,16 @@ modEnabled modname = enable <!> disable
`onChange` reloaded
isenabled = boolSystem "a2query" [Param "-q", Param "-m", Param modname]
+-- | Make apache listen on the specified ports.
+--
+-- Note that ports are also specified inside a site's config file,
+-- so that also needs to be changed.
+listenPorts :: [Port] -> Property NoInfo
+listenPorts ps = "/etc/apache2/ports.conf" `File.hasContent` map portline ps
+ `onChange` restarted
+ where
+ portline (Port n) = "Listen " ++ show n
+
-- This is a list of config files because different versions of apache
-- use different filenames. Propellor simply writes them all.
siteCfg :: HostName -> [FilePath]
@@ -58,15 +94,6 @@ siteCfg hn =
, "/etc/apache2/sites-available/" ++ hn ++ ".conf"
]
-installed :: Property NoInfo
-installed = Apt.installed ["apache2"]
-
-restarted :: Property NoInfo
-restarted = Service.restarted "apache2"
-
-reloaded :: Property NoInfo
-reloaded = Service.reloaded "apache2"
-
-- | Configure apache to use SNI to differentiate between
-- https hosts.
--
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs
index 15c45629..14f170af 100644
--- a/src/Propellor/Property/Apt.hs
+++ b/src/Propellor/Property/Apt.hs
@@ -8,7 +8,7 @@ import Data.List
import System.IO
import Control.Monad
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Service as Service
import Propellor.Property.File (Line)
diff --git a/src/Propellor/Property/Chroot.hs b/src/Propellor/Property/Chroot.hs
index b059e3eb..ab914180 100644
--- a/src/Propellor/Property/Chroot.hs
+++ b/src/Propellor/Property/Chroot.hs
@@ -12,7 +12,7 @@ module Propellor.Property.Chroot (
chain,
) where
-import Propellor
+import Propellor.Base
import Propellor.Types.CmdLine
import Propellor.Types.Chroot
import Propellor.Types.Info
@@ -34,8 +34,8 @@ data BuilderConf
deriving (Show)
instance PropAccum Chroot where
- (Chroot l s c h) & p = Chroot l s c (h & p)
- (Chroot l s c h) &^ p = Chroot l s c (h &^ p)
+ (Chroot l s c h) `addProp` p = Chroot l s c (h & p)
+ (Chroot l s c h) `addPropFront` p = Chroot l s c (h `addPropFront` p)
getProperties (Chroot _ _ _ h) = hostProperties h
-- | Defines a Chroot at the given location, built with debootstrap.
diff --git a/src/Propellor/Property/ConfFile.hs b/src/Propellor/Property/ConfFile.hs
index 0bc1b76d..dac4e564 100644
--- a/src/Propellor/Property/ConfFile.hs
+++ b/src/Propellor/Property/ConfFile.hs
@@ -12,7 +12,7 @@ module Propellor.Property.ConfFile (
lacksIniSection,
) where
-import Propellor
+import Propellor.Base
import Propellor.Property.File
import Data.List (isPrefixOf, foldl')
diff --git a/src/Propellor/Property/Cron.hs b/src/Propellor/Property/Cron.hs
index e9bb93ac..74cab92a 100644
--- a/src/Propellor/Property/Cron.hs
+++ b/src/Propellor/Property/Cron.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Cron where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import Propellor.Bootstrap
diff --git a/src/Propellor/Property/DebianMirror.hs b/src/Propellor/Property/DebianMirror.hs
index d16c5281..6f1ff7b2 100644
--- a/src/Propellor/Property/DebianMirror.hs
+++ b/src/Propellor/Property/DebianMirror.hs
@@ -7,7 +7,7 @@ module Propellor.Property.DebianMirror
, mirrorCdn
) where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Cron as Cron
diff --git a/src/Propellor/Property/Debootstrap.hs b/src/Propellor/Property/Debootstrap.hs
index 2551d679..bb177007 100644
--- a/src/Propellor/Property/Debootstrap.hs
+++ b/src/Propellor/Property/Debootstrap.hs
@@ -10,7 +10,7 @@ module Propellor.Property.Debootstrap (
programPath,
) where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import Propellor.Property.Chroot.Util
import Utility.Path
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index 8d35991e..8d503e28 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -36,7 +36,7 @@ module Propellor.Property.DiskImage (
noFinalization,
) where
-import Propellor
+import Propellor.Base
import Propellor.Property.Chroot (Chroot)
import Propellor.Property.Chroot.Util (removeChroot)
import qualified Propellor.Property.Chroot as Chroot
diff --git a/src/Propellor/Property/Dns.hs b/src/Propellor/Property/Dns.hs
index 056733cd..963b82f6 100644
--- a/src/Propellor/Property/Dns.hs
+++ b/src/Propellor/Property/Dns.hs
@@ -13,7 +13,7 @@ module Propellor.Property.Dns (
genZone,
) where
-import Propellor
+import Propellor.Base
import Propellor.Types.Dns
import Propellor.Types.Info
import Propellor.Property.File
diff --git a/src/Propellor/Property/DnsSec.hs b/src/Propellor/Property/DnsSec.hs
index 3acaee8d..22481ad0 100644
--- a/src/Propellor/Property/DnsSec.hs
+++ b/src/Propellor/Property/DnsSec.hs
@@ -1,6 +1,6 @@
module Propellor.Property.DnsSec where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
-- | Puts the DNSSEC key files in place from PrivData.
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index e6365276..6aa17438 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -45,7 +45,7 @@ module Propellor.Property.Docker (
chain,
) where
-import Propellor hiding (init)
+import Propellor.Base hiding (init)
import Propellor.Types.Docker
import Propellor.Types.Container
import Propellor.Types.CmdLine
@@ -97,8 +97,8 @@ instance HasImage Container where
getImageName (Container i _) = i
instance PropAccum Container where
- (Container i h) & p = Container i (h & p)
- (Container i h) &^ p = Container i (h &^ p)
+ (Container i h) `addProp` p = Container i (h `addProp` p)
+ (Container i h) `addPropFront` p = Container i (h `addPropFront` p)
getProperties (Container _ h) = hostProperties h
-- | Defines a Container with a given name, image, and properties.
diff --git a/src/Propellor/Property/File.hs b/src/Propellor/Property/File.hs
index a1d3037f..b491ccbe 100644
--- a/src/Propellor/Property/File.hs
+++ b/src/Propellor/Property/File.hs
@@ -1,6 +1,6 @@
module Propellor.Property.File where
-import Propellor
+import Propellor.Base
import Utility.FileMode
import System.Posix.Files
diff --git a/src/Propellor/Property/Firewall.hs b/src/Propellor/Property/Firewall.hs
index a685a46f..20b44845 100644
--- a/src/Propellor/Property/Firewall.hs
+++ b/src/Propellor/Property/Firewall.hs
@@ -16,7 +16,7 @@ import Data.Monoid
import Data.Char
import Data.List
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Network as Network
diff --git a/src/Propellor/Property/Git.hs b/src/Propellor/Property/Git.hs
index 48871b40..d69fe250 100644
--- a/src/Propellor/Property/Git.hs
+++ b/src/Propellor/Property/Git.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Git where
-import Propellor
+import Propellor.Base
import Propellor.Property.File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
diff --git a/src/Propellor/Property/Gpg.hs b/src/Propellor/Property/Gpg.hs
index e57749ae..a16df11d 100644
--- a/src/Propellor/Property/Gpg.hs
+++ b/src/Propellor/Property/Gpg.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Gpg where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import Utility.FileSystemEncoding
diff --git a/src/Propellor/Property/Group.hs b/src/Propellor/Property/Group.hs
index d4dc0fb2..ce8a8398 100644
--- a/src/Propellor/Property/Group.hs
+++ b/src/Propellor/Property/Group.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Group where
-import Propellor
+import Propellor.Base
type GID = Int
diff --git a/src/Propellor/Property/Grub.hs b/src/Propellor/Property/Grub.hs
index 1084ef9e..6b763d08 100644
--- a/src/Propellor/Property/Grub.hs
+++ b/src/Propellor/Property/Grub.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Grub where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
diff --git a/src/Propellor/Property/HostingProvider/CloudAtCost.hs b/src/Propellor/Property/HostingProvider/CloudAtCost.hs
index bc53635c..6097c642 100644
--- a/src/Propellor/Property/HostingProvider/CloudAtCost.hs
+++ b/src/Propellor/Property/HostingProvider/CloudAtCost.hs
@@ -1,6 +1,6 @@
module Propellor.Property.HostingProvider.CloudAtCost where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Hostname as Hostname
import qualified Propellor.Property.File as File
import qualified Propellor.Property.User as User
diff --git a/src/Propellor/Property/HostingProvider/DigitalOcean.hs b/src/Propellor/Property/HostingProvider/DigitalOcean.hs
index a5de9818..f49b86b3 100644
--- a/src/Propellor/Property/HostingProvider/DigitalOcean.hs
+++ b/src/Propellor/Property/HostingProvider/DigitalOcean.hs
@@ -2,7 +2,7 @@ module Propellor.Property.HostingProvider.DigitalOcean (
distroKernel
) where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Reboot as Reboot
diff --git a/src/Propellor/Property/HostingProvider/Linode.hs b/src/Propellor/Property/HostingProvider/Linode.hs
index 40be4c2e..274412a0 100644
--- a/src/Propellor/Property/HostingProvider/Linode.hs
+++ b/src/Propellor/Property/HostingProvider/Linode.hs
@@ -1,6 +1,6 @@
module Propellor.Property.HostingProvider.Linode where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Grub as Grub
import qualified Propellor.Property.File as File
import Utility.FileMode
diff --git a/src/Propellor/Property/Hostname.hs b/src/Propellor/Property/Hostname.hs
index 20181213..7766d497 100644
--- a/src/Propellor/Property/Hostname.hs
+++ b/src/Propellor/Property/Hostname.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Hostname where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import Data.List
diff --git a/src/Propellor/Property/Journald.hs b/src/Propellor/Property/Journald.hs
index 3ab4e9d7..6c8bda80 100644
--- a/src/Propellor/Property/Journald.hs
+++ b/src/Propellor/Property/Journald.hs
@@ -1,5 +1,6 @@
module Propellor.Property.Journald where
-import Propellor
+
+import Propellor.Base
import qualified Propellor.Property.Systemd as Systemd
import Utility.DataUnits
diff --git a/src/Propellor/Property/Kerberos.hs b/src/Propellor/Property/Kerberos.hs
index 5d07f4dc..cb6e06cc 100644
--- a/src/Propellor/Property/Kerberos.hs
+++ b/src/Propellor/Property/Kerberos.hs
@@ -4,7 +4,7 @@ module Propellor.Property.Kerberos where
import Utility.Process
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.File as File
import Propellor.Property.User
diff --git a/src/Propellor/Property/LightDM.hs b/src/Propellor/Property/LightDM.hs
index b010eb2f..bc5ef22a 100644
--- a/src/Propellor/Property/LightDM.hs
+++ b/src/Propellor/Property/LightDM.hs
@@ -4,7 +4,7 @@
module Propellor.Property.LightDM where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.ConfFile as ConfFile
-- | Configures LightDM to skip the login screen and autologin as a user.
diff --git a/src/Propellor/Property/List.hs b/src/Propellor/Property/List.hs
index 283c5ec7..a88d44d7 100644
--- a/src/Propellor/Property/List.hs
+++ b/src/Propellor/Property/List.hs
@@ -2,6 +2,7 @@
{-# LANGUAGE FlexibleInstances #-}
module Propellor.Property.List (
+ props,
PropertyList(..),
PropertyListType,
) where
@@ -12,6 +13,22 @@ import Propellor.PropAccum
import Data.Monoid
+-- | Starts accumulating a list of properties.
+--
+-- > propertyList "foo" $ props
+-- > & someproperty
+-- > ! oldproperty
+-- > & otherproperty
+props :: PropList
+props = PropList []
+
+data PropList = PropList [Property HasInfo]
+
+instance PropAccum PropList where
+ PropList l `addProp` p = PropList (toProp p : l)
+ PropList l `addPropFront` p = PropList (l ++ [toProp p])
+ getProperties (PropList l) = reverse l
+
class PropertyList l where
-- | Combines a list of properties, resulting in a single property
-- that when run will run each property in the list in turn,
@@ -21,12 +38,7 @@ class PropertyList l where
-- Note that Property HasInfo and Property NoInfo are not the same
-- type, and so cannot be mixed in a list. To make a list of
-- mixed types, which can also include RevertableProperty,
- -- use `props`:
- --
- -- > propertyList "foo" $ props
- -- > & someproperty
- -- > ! oldproperty
- -- > & otherproperty
+ -- use `props`
propertyList :: Desc -> l -> Property (PropertyListType l)
-- | Combines a list of properties, resulting in one property that
diff --git a/src/Propellor/Property/Logcheck.hs b/src/Propellor/Property/Logcheck.hs
index 26f4e3a4..22621cc2 100644
--- a/src/Propellor/Property/Logcheck.hs
+++ b/src/Propellor/Property/Logcheck.hs
@@ -9,7 +9,7 @@ module Propellor.Property.Logcheck (
installed,
) where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.File as File
diff --git a/src/Propellor/Property/Mount.hs b/src/Propellor/Property/Mount.hs
index 4070ebcb..30d057f5 100644
--- a/src/Propellor/Property/Mount.hs
+++ b/src/Propellor/Property/Mount.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Mount where
-import Propellor
+import Propellor.Base
import Utility.Path
type FsType = String -- ^ type of filesystem to mount ("auto" to autodetect)
diff --git a/src/Propellor/Property/Network.hs b/src/Propellor/Property/Network.hs
index e01edb62..cb340042 100644
--- a/src/Propellor/Property/Network.hs
+++ b/src/Propellor/Property/Network.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Network where
-import Propellor
+import Propellor.Base
import Propellor.Property.File
type Interface = String
diff --git a/src/Propellor/Property/Nginx.hs b/src/Propellor/Property/Nginx.hs
index a8c7b187..d0d4d3a9 100644
--- a/src/Propellor/Property/Nginx.hs
+++ b/src/Propellor/Property/Nginx.hs
@@ -2,7 +2,7 @@
module Propellor.Property.Nginx where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
diff --git a/src/Propellor/Property/OS.hs b/src/Propellor/Property/OS.hs
index 5364456a..e176e33d 100644
--- a/src/Propellor/Property/OS.hs
+++ b/src/Propellor/Property/OS.hs
@@ -7,7 +7,7 @@ module Propellor.Property.OS (
oldOSRemoved,
) where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Debootstrap as Debootstrap
import qualified Propellor.Property.Ssh as Ssh
import qualified Propellor.Property.Network as Network
diff --git a/src/Propellor/Property/Obnam.hs b/src/Propellor/Property/Obnam.hs
index 94b023f3..091a6d90 100644
--- a/src/Propellor/Property/Obnam.hs
+++ b/src/Propellor/Property/Obnam.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Obnam where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Cron as Cron
import qualified Propellor.Property.Gpg as Gpg
diff --git a/src/Propellor/Property/OpenId.hs b/src/Propellor/Property/OpenId.hs
index 1f6f2559..ae437518 100644
--- a/src/Propellor/Property/OpenId.hs
+++ b/src/Propellor/Property/OpenId.hs
@@ -1,21 +1,34 @@
module Propellor.Property.OpenId where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
-import qualified Propellor.Property.Service as Service
+import qualified Propellor.Property.Apache as Apache
import Data.List
-providerFor :: [User] -> String -> Property HasInfo
-providerFor users baseurl = propertyList desc $ map toProp
- [ Apt.serviceInstalledRunning "apache2"
- , Apt.installed ["simpleid"]
- `onChange` Service.restarted "apache2"
- , File.fileProperty (desc ++ " configured")
+-- | Openid provider, using the simpleid PHP CGI, with apache.
+--
+-- Runs on usual port by default. When a nonstandard port is specified,
+-- apache is limited to listening only on that port. Warning: Specifying
+-- a port won't compose well with other apache properties on the same
+-- host.
+--
+-- It's probably a good idea to put this property inside a docker or
+-- systemd-nspawn container.
+providerFor :: [User] -> HostName -> Maybe Port -> Property HasInfo
+providerFor users hn mp = propertyList desc $ props
+ & Apt.serviceInstalledRunning "apache2"
+ & apacheconfigured
+ & Apt.installed ["simpleid"]
+ `onChange` Apache.restarted
+ & File.fileProperty (desc ++ " configured")
(map setbaseurl) "/etc/simpleid/config.inc"
- ] ++ map identfile users
+ & propertyList desc (map identfile users)
where
+ baseurl = hn ++ case mp of
+ Nothing -> ""
+ Just (Port p) -> show p
url = "http://"++baseurl++"/simpleid"
desc = "openid provider " ++ url
setbaseurl l
@@ -23,6 +36,13 @@ providerFor users baseurl = propertyList desc $ map toProp
"define('SIMPLEID_BASE_URL', '"++url++"');"
| otherwise = l
+ apacheconfigured = case mp of
+ Nothing -> toProp $
+ Apache.virtualHost hn (Port 80) "/var/www/html"
+ Just p -> propertyList desc $ props
+ & Apache.listenPorts [p]
+ & Apache.virtualHost hn p "/var/www/html"
+
-- the identities directory controls access, so open up
-- file mode
identfile (User u) = File.hasPrivContentExposed
diff --git a/src/Propellor/Property/Parted.hs b/src/Propellor/Property/Parted.hs
index a4f0f98e..7bd38a65 100644
--- a/src/Propellor/Property/Parted.hs
+++ b/src/Propellor/Property/Parted.hs
@@ -21,7 +21,7 @@ module Propellor.Property.Parted (
installed,
) where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Partition as Partition
import Utility.DataUnits
diff --git a/src/Propellor/Property/Partition.hs b/src/Propellor/Property/Partition.hs
index c85ef8b9..56bc1575 100644
--- a/src/Propellor/Property/Partition.hs
+++ b/src/Propellor/Property/Partition.hs
@@ -2,7 +2,7 @@
module Propellor.Property.Partition where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
-- | Filesystems etc that can be used for a partition.
diff --git a/src/Propellor/Property/Postfix.hs b/src/Propellor/Property/Postfix.hs
index b062cbac..562444da 100644
--- a/src/Propellor/Property/Postfix.hs
+++ b/src/Propellor/Property/Postfix.hs
@@ -2,7 +2,7 @@
module Propellor.Property.Postfix where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Service as Service
diff --git a/src/Propellor/Property/Prosody.hs b/src/Propellor/Property/Prosody.hs
index e47b9ac5..78a2c529 100644
--- a/src/Propellor/Property/Prosody.hs
+++ b/src/Propellor/Property/Prosody.hs
@@ -2,7 +2,7 @@
module Propellor.Property.Prosody where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
diff --git a/src/Propellor/Property/Reboot.hs b/src/Propellor/Property/Reboot.hs
index 5ca7a6bc..ef0182d3 100644
--- a/src/Propellor/Property/Reboot.hs
+++ b/src/Propellor/Property/Reboot.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Reboot where
-import Propellor
+import Propellor.Base
now :: Property NoInfo
now = cmdProperty "reboot" []
diff --git a/src/Propellor/Property/Rsync.hs b/src/Propellor/Property/Rsync.hs
index 8423eff6..894b8cc7 100644
--- a/src/Propellor/Property/Rsync.hs
+++ b/src/Propellor/Property/Rsync.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Rsync where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
type Src = FilePath
diff --git a/src/Propellor/Property/Scheduled.hs b/src/Propellor/Property/Scheduled.hs
index 06efacdf..64a530bc 100644
--- a/src/Propellor/Property/Scheduled.hs
+++ b/src/Propellor/Property/Scheduled.hs
@@ -9,7 +9,7 @@ module Propellor.Property.Scheduled
, YearDay
) where
-import Propellor
+import Propellor.Base
import Utility.Scheduled
import Data.Time.Clock
diff --git a/src/Propellor/Property/Service.hs b/src/Propellor/Property/Service.hs
index 9cc010e8..76c9aff7 100644
--- a/src/Propellor/Property/Service.hs
+++ b/src/Propellor/Property/Service.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Service where
-import Propellor
+import Propellor.Base
type ServiceName = String
diff --git a/src/Propellor/Property/SiteSpecific/Branchable.hs b/src/Propellor/Property/SiteSpecific/Branchable.hs
index f5950e52..c62c1335 100644
--- a/src/Propellor/Property/SiteSpecific/Branchable.hs
+++ b/src/Propellor/Property/SiteSpecific/Branchable.hs
@@ -1,6 +1,6 @@
module Propellor.Property.SiteSpecific.Branchable where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.File as File
import qualified Propellor.Property.User as User
diff --git a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
index f2a2f012..a10e5877 100644
--- a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
+++ b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs
@@ -2,7 +2,7 @@
module Propellor.Property.SiteSpecific.GitAnnexBuilder where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.User as User
import qualified Propellor.Property.Cron as Cron
diff --git a/src/Propellor/Property/SiteSpecific/GitHome.hs b/src/Propellor/Property/SiteSpecific/GitHome.hs
index 40f2ecd8..9b01b5e2 100644
--- a/src/Propellor/Property/SiteSpecific/GitHome.hs
+++ b/src/Propellor/Property/SiteSpecific/GitHome.hs
@@ -1,6 +1,6 @@
module Propellor.Property.SiteSpecific.GitHome where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import Propellor.Property.User
diff --git a/src/Propellor/Property/SiteSpecific/IABak.hs b/src/Propellor/Property/SiteSpecific/IABak.hs
index eaef2817..93cf0b71 100644
--- a/src/Propellor/Property/SiteSpecific/IABak.hs
+++ b/src/Propellor/Property/SiteSpecific/IABak.hs
@@ -1,6 +1,6 @@
module Propellor.Property.SiteSpecific.IABak where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Git as Git
import qualified Propellor.Property.Cron as Cron
diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs
index 0a59452c..3f3205e6 100644
--- a/src/Propellor/Property/SiteSpecific/JoeySites.hs
+++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs
@@ -3,7 +3,7 @@
module Propellor.Property.SiteSpecific.JoeySites where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Gpg as Gpg
diff --git a/src/Propellor/Property/Ssh.hs b/src/Propellor/Property/Ssh.hs
index fbd57057..4450dd07 100644
--- a/src/Propellor/Property/Ssh.hs
+++ b/src/Propellor/Property/Ssh.hs
@@ -25,7 +25,7 @@ module Propellor.Property.Ssh (
listenPort
) where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Service as Service
import Propellor.Property.User
diff --git a/src/Propellor/Property/Sudo.hs b/src/Propellor/Property/Sudo.hs
index 0257f3f1..ed6ba2d5 100644
--- a/src/Propellor/Property/Sudo.hs
+++ b/src/Propellor/Property/Sudo.hs
@@ -2,7 +2,7 @@ module Propellor.Property.Sudo where
import Data.List
-import Propellor
+import Propellor.Base
import Propellor.Property.File
import qualified Propellor.Property.Apt as Apt
import Propellor.Property.User
diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs
index e44ef717..8194fc85 100644
--- a/src/Propellor/Property/Systemd.hs
+++ b/src/Propellor/Property/Systemd.hs
@@ -40,7 +40,7 @@ module Propellor.Property.Systemd (
bindRo,
) where
-import Propellor
+import Propellor.Base
import Propellor.Types.Chroot
import Propellor.Types.Container
import Propellor.Types.Info
@@ -62,8 +62,8 @@ data Container = Container MachineName Chroot.Chroot Host
deriving (Show)
instance PropAccum Container where
- (Container n c h) & p = Container n c (h & p)
- (Container n c h) &^ p = Container n c (h &^ p)
+ (Container n c h) `addProp` p = Container n c (h `addProp` p)
+ (Container n c h) `addPropFront` p = Container n c (h `addPropFront` p)
getProperties (Container _ _ h) = hostProperties h
-- | Starts a systemd service.
@@ -376,8 +376,8 @@ instance Publishable (Proto, Bound Port) where
--
-- > foo :: Host
-- > foo = host "foo.example.com"
--- > & Systemd.running Systemd.networkd
-- > & Systemd.nspawned webserver
+-- > `requires` Systemd.running Systemd.networkd
-- >
-- > webserver :: Systemd.container
-- > webserver = Systemd.container "webserver" (Chroot.debootstrapped (System (Debian Testing) "amd64") mempty)
diff --git a/src/Propellor/Property/Systemd/Core.hs b/src/Propellor/Property/Systemd/Core.hs
index b27a8e38..7842f177 100644
--- a/src/Propellor/Property/Systemd/Core.hs
+++ b/src/Propellor/Property/Systemd/Core.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Systemd.Core where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.Apt as Apt
-- dbus is only a Recommends of systemd, but is needed for communication
diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs
index e2ee3dad..e5fcdaa4 100644
--- a/src/Propellor/Property/Tor.hs
+++ b/src/Propellor/Property/Tor.hs
@@ -1,6 +1,6 @@
module Propellor.Property.Tor where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
diff --git a/src/Propellor/Property/Unbound.hs b/src/Propellor/Property/Unbound.hs
index 0fa42052..f1280b0e 100644
--- a/src/Propellor/Property/Unbound.hs
+++ b/src/Propellor/Property/Unbound.hs
@@ -17,7 +17,7 @@ module Propellor.Property.Unbound
, cachingDnsServer
) where
-import Propellor
+import Propellor.Base
import Propellor.Property.File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs
index c029999f..c3314738 100644
--- a/src/Propellor/Property/User.hs
+++ b/src/Propellor/Property/User.hs
@@ -2,7 +2,7 @@ module Propellor.Property.User where
import System.Posix
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
data Eep = YesReallyDeleteHome
diff --git a/src/Propellor/Property/Uwsgi.hs b/src/Propellor/Property/Uwsgi.hs
index d1cdb550..8beea17a 100644
--- a/src/Propellor/Property/Uwsgi.hs
+++ b/src/Propellor/Property/Uwsgi.hs
@@ -2,7 +2,7 @@
module Propellor.Property.Uwsgi where
-import Propellor
+import Propellor.Base
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service