propellor spin
This commit is contained in:
parent
fd0cfda04c
commit
cc169f4ac0
|
@ -33,7 +33,7 @@ job desc times user cddir command = cronjobfile `File.hasContent`
|
|||
`requires` Apt.installed ["util-linux", "moreutils"]
|
||||
`describe` ("cronned " ++ desc)
|
||||
where
|
||||
cmdline = "cd " ++ cddir ++ " && " ++ command
|
||||
cmdline = "cd " ++ cddir ++ " && ( " ++ command ++ " )"
|
||||
cronjobfile = "/etc/cron.d/" ++ map sanitize desc
|
||||
sanitize c
|
||||
| isAlphaNum c = c
|
||||
|
|
|
@ -97,14 +97,17 @@ installed = Apt.installed ["obnam"]
|
|||
|
||||
-- | Ensures that a recent version of obnam gets installed.
|
||||
--
|
||||
-- Only useful on Stable.
|
||||
-- Only does anything for Debian Stable.
|
||||
latestVersion :: Property
|
||||
latestVersion = propertyList "obnam latest version"
|
||||
[ toProp $ Apt.trustsKey key
|
||||
, Apt.setSourcesListD sources "obnam"
|
||||
]
|
||||
latestVersion = withOS "obnam latest version" $ \o -> case o of
|
||||
(Just (System (Debian suite) _)) | isStable suite -> ensureProperty $
|
||||
Apt.setSourcesListD (sources suite) "obnam"
|
||||
`requires` toProp (Apt.trustsKey key)
|
||||
_ -> noChange
|
||||
where
|
||||
sources = ["deb http://code.liw.fi/debian wheezy main"]
|
||||
sources suite =
|
||||
[ "deb http://code.liw.fi/debian " ++ Apt.showSuite suite ++ " main"
|
||||
]
|
||||
-- gpg key used by the code.liw.fi repository.
|
||||
key = Apt.AptKey "obnam" $ unlines
|
||||
[ "-----BEGIN PGP PUBLIC KEY BLOCK-----"
|
||||
|
|
|
@ -16,9 +16,60 @@ import qualified Propellor.Property.Obnam as Obnam
|
|||
import qualified Propellor.Property.Apache as Apache
|
||||
import Utility.SafeCommand
|
||||
|
||||
import Data.List
|
||||
import System.Posix.Files
|
||||
|
||||
oldUseNetServer :: [Host] -> Property
|
||||
oldUseNetServer hosts = propertyList ("olduse.net server")
|
||||
[ oldUseNetInstalled "oldusenet-server"
|
||||
, Obnam.latestVersion
|
||||
, Obnam.backup datadir "33 4 * * *"
|
||||
[ "--repository=sftp://2318@usw-s002.rsync.net/~/olduse.net"
|
||||
, "--client-name=spool"
|
||||
] Obnam.OnlyClient
|
||||
`requires` Ssh.keyImported SshRsa "root"
|
||||
`requires` Ssh.knownHost hosts "usw-s002.rsync.net" "root"
|
||||
, check (not . isSymbolicLink <$> getSymbolicLinkStatus newsspool) $
|
||||
Property "olduse.net spool in place" $ makeChange $ do
|
||||
removeDirectoryRecursive newsspool
|
||||
createSymbolicLink (datadir </> "news") newsspool
|
||||
, Apt.installed ["leafnode"]
|
||||
, "/etc/news/leafnode/config" `File.hasContent`
|
||||
[ "# olduse.net configuration (deployed by propellor)"
|
||||
, "expire = 1000000" -- no expiry via texpire
|
||||
, "server = " -- no upstream server
|
||||
, "debugmode = 1"
|
||||
, "allowSTRANGERS = 42" -- lets anyone connect
|
||||
, "nopost = 1" -- no new posting (just gather them)
|
||||
]
|
||||
, Apt.serviceInstalledRunning "openbsd-inetd"
|
||||
, File.notPresent "/etc/cron.daily/leafnode"
|
||||
, File.notPresent "/etc/cron.d/leafnode"
|
||||
, Cron.niceJob "oldusenet-expire" "11 1 * * *" "news" newsspool $ intercalate ";"
|
||||
[ "find \\( -path ./out.going -or -path ./interesting.groups -or -path './*/.overview' \\) -prune -or -type f -ctime +60 -print | xargs --no-run-if-empty rm"
|
||||
, "find -type d -empty | xargs --no-run-if-empty rmdir"
|
||||
]
|
||||
, Cron.niceJob "oldusenet-uucp" "*/5 * * * *" "news" "/" $
|
||||
"/usr/bin/uucp " ++ datadir
|
||||
, toProp $ Apache.siteEnabled "nntp.olduse.net" $ apachecfg "nntp.olduse.net" False
|
||||
[ " DocumentRoot " ++ datadir ++ "/"
|
||||
, " <Directory " ++ datadir ++ "/>"
|
||||
, " Options Indexes FollowSymlinks"
|
||||
, " AllowOverride None"
|
||||
, " Require all granted"
|
||||
, " </Directory>"
|
||||
]
|
||||
]
|
||||
where
|
||||
newsspool = "/var/spool/news"
|
||||
datadir = "/var/spool/oldusenet"
|
||||
|
||||
oldUseNetShellBox :: Property
|
||||
oldUseNetShellBox = check (not <$> Apt.isInstalled "oldusenet") $
|
||||
propertyList ("olduse.net shellbox")
|
||||
oldUseNetShellBox = oldUseNetInstalled "oldusenet"
|
||||
|
||||
oldUseNetInstalled :: Apt.Package -> Property
|
||||
oldUseNetInstalled pkg = check (not <$> Apt.isInstalled pkg) $
|
||||
propertyList ("olduse.net " ++ pkg)
|
||||
[ Apt.installed (words "build-essential devscripts debhelper git libncursesw5-dev libpcre3-dev pkg-config bison libicu-dev libidn11-dev libcanlock2-dev libuu-dev ghc libghc-strptime-dev libghc-hamlet-dev libghc-ifelse-dev libghc-hxt-dev libghc-utf8-string-dev libghc-missingh-dev libghc-sha-dev")
|
||||
`describe` "olduse.net build deps"
|
||||
, scriptProperty
|
||||
|
@ -26,12 +77,13 @@ oldUseNetShellBox = check (not <$> Apt.isInstalled "oldusenet") $
|
|||
, "git clone git://olduse.net/ /root/tmp/oldusenet/source"
|
||||
, "cd /root/tmp/oldusenet/source/"
|
||||
, "dpkg-buildpackage -us -uc"
|
||||
, "dpkg -i ../oldusenet*.deb || true"
|
||||
, "dpkg -i ../" ++ pkg ++ "_*.deb || true"
|
||||
, "apt-get -fy install" -- dependencies
|
||||
, "rm -rf /root/tmp/oldusenet"
|
||||
] `describe` "olduse.net built"
|
||||
]
|
||||
|
||||
|
||||
kgbServer :: Property
|
||||
kgbServer = withOS desc $ \o -> case o of
|
||||
(Just (System (Debian Unstable) _)) ->
|
||||
|
|
|
@ -111,6 +111,9 @@ hosts = -- (o) `
|
|||
[]
|
||||
& JoeySites.twitRss
|
||||
|
||||
& cname "nntp.olduse.net"
|
||||
& JoeySites.oldUseNetServer hosts
|
||||
|
||||
& Apt.installed ["ntop"]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue