Commit f0468c0a authored by build's avatar build

distributed version of propellor

parents
debian/changelog
\ No newline at end of file
Copyright 2014 Joey Hess <id@joeyh.name> and contributors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY AUTHORS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
CABAL?=cabal
DATE := $(shell dpkg-parsechangelog 2>/dev/null | grep Date | cut -d " " -f2-)
build: tags propellor.1 dist/setup-config
$(CABAL) build
ln -sf dist/build/propellor-config/propellor-config propellor
install:
install -d $(DESTDIR)/usr/bin $(DESTDIR)/usr/src/propellor
install -s dist/build/propellor/propellor $(DESTDIR)/usr/bin/propellor
mkdir -p dist/gittmp
$(CABAL) sdist
cat dist/propellor-*.tar.gz | (cd dist/gittmp && tar zx --strip-components=1)
# cabal sdist does not preserve symlinks, so copy over file
cd dist/gittmp && for f in $$(find -type f); do rm -f $$f; cp -a ../../$$f $$f; done
# reset mtime on files in git bundle so bundle is reproducible
find dist/gittmp -print0 | xargs -0r touch --no-dereference --date="$(DATE)"
export GIT_AUTHOR_NAME=build \
&& export GIT_AUTHOR_EMAIL=build@buildhost \
&& export GIT_AUTHOR_DATE="$(DATE)" \
&& export GIT_COMMITTER_NAME=build \
&& export GIT_COMMITTER_EMAIL=build@buildhost \
&& export GIT_COMMITTER_DATE="$(DATE)" \
&& cd dist/gittmp && git init \
&& git add . \
&& git commit -q -m "distributed version of propellor" \
&& git bundle create $(DESTDIR)/usr/src/propellor/propellor.git master HEAD \
&& git show-ref master --hash > $(DESTDIR)/usr/src/propellor/head
rm -rf dist/gittmp
clean:
rm -rf dist Setup tags propellor propellor.1 privdata/local
find -name \*.o -exec rm {} \;
find -name \*.hi -exec rm {} \;
# hothasktags chokes on some template haskell etc, so ignore errors
# duplicate tags with Propellor.Property. removed from the start, as we
# often import qualified by just the module base name.
tags:
find . | grep -v /.git/ | grep -v /tmp/ | grep -v /dist/ | grep -v /doc/ | egrep '\.hs$$' | xargs hothasktags 2>/dev/null | perl -ne 'print; s/Propellor\.Property\.//; print' | sort > tags || true
dist/setup-config: propellor.cabal
@if [ "$(CABAL)" = ./Setup ]; then ghc --make Setup; fi
@$(CABAL) configure
propellor.1: doc/usage.mdwn doc/mdwn2man
doc/mdwn2man propellor 1 < doc/usage.mdwn > propellor.1
.PHONY: tags
doc/README.mdwn
\ No newline at end of file
{- cabal setup file -}
import Distribution.Simple
main = defaultMain
-- This is the main configuration file for Propellor, and is used to build
-- the propellor program.
--
-- This shows how to set up a FreeBSD host (and a Linux host too).
import Propellor
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Network as Network
import qualified Propellor.Property.Cron as Cron
import Propellor.Property.Scheduled
import qualified Propellor.Property.User as User
import qualified Propellor.Property.Docker as Docker
import qualified Propellor.Property.FreeBSD.Pkg as Pkg
import qualified Propellor.Property.ZFS as ZFS
import qualified Propellor.Property.FreeBSD.Poudriere as Poudriere
main :: IO ()
main = defaultMain hosts
-- The hosts propellor knows about.
hosts :: [Host]
hosts =
[ freebsdbox
, linuxbox
]
-- An example freebsd host.
freebsdbox :: Host
freebsdbox = host "freebsdbox.example.com" $ props
& osFreeBSD (FBSDProduction FBSD102) X86_64
& Pkg.update
& Pkg.upgrade
& Poudriere.poudriere poudriereZFS
& Poudriere.jail (Poudriere.Jail "formail" (fromString "10.2-RELEASE") (fromArchitecture X86_64))
poudriereZFS :: Poudriere.Poudriere
poudriereZFS = Poudriere.defaultConfig
{ Poudriere._zfs = Just $ Poudriere.PoudriereZFS
(ZFS.ZFS (fromString "zroot") (fromString "poudriere"))
(ZFS.fromList [ZFS.Mountpoint (fromString "/poudriere"), ZFS.ACLInherit ZFS.AIPassthrough])
}
-- An example linux host.
linuxbox :: Host
linuxbox = host "linuxbox.example.com" $ props
& osDebian' KFreeBSD Unstable X86_64
& Apt.stdSourcesList
& Apt.unattendedUpgrades
& Apt.installed ["etckeeper"]
& Apt.installed ["ssh"]
& User.hasSomePassword (User "root")
& Network.ipv6to4
& File.dirExists "/var/www"
& Docker.docked webserverContainer
& Docker.garbageCollected `period` Daily
& Cron.runPropellor (Cron.Times "30 * * * *")
-- A generic webserver in a Docker container.
webserverContainer :: Docker.Container
webserverContainer = Docker.container "webserver" (Docker.latestImage "debian") $ props
& osDebian' KFreeBSD (Stable "stretch") X86_64
& Apt.stdSourcesList
& Docker.publish "80:80"
& Docker.volume "/var/www:/var/www"
& Apt.serviceInstalledRunning "apache2"
-- This is the main configuration file for Propellor, and is used to build
-- the propellor program.
import Propellor
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Cron as Cron
import qualified Propellor.Property.User as User
main :: IO ()
main = defaultMain hosts
-- The hosts propellor knows about.
hosts :: [Host]
hosts =
[ mybox
]
-- An example host.
mybox :: Host
mybox = host "mybox.example.com" $ props
& osDebian Unstable X86_64
& Apt.stdSourcesList
& Apt.unattendedUpgrades
& Apt.installed ["etckeeper"]
& Apt.installed ["ssh"]
& User.hasSomePassword (User "root")
& File.dirExists "/var/www"
& Cron.runPropellor (Cron.Times "30 * * * *")
config-simple.hs
\ No newline at end of file
#!/bin/sh
#
# git post-merge (and post-checkout) hook, used by propellor's author to
# maintain a joeyconfig branch with some changes while being able to merge
# between it and branches without the changes.
#
# Each time this hook is run, it checks if it's on a branch with
# name ending in "config". If so, config.hs is pointed at $branch.hs
# and privdata/relocate is written to make files in privdata/.$branch/ be
# used.
#
# Otherwise, config.hs is pointed at config-simple.hs, and
# privdata/relocate is removed.
set -e
commit () {
if [ -n "$(git status --short privdata/relocate config.hs)" ]; then
git commit -m "$1"
fi
}
branch="$(git symbolic-ref --short HEAD)"
case "$branch" in
"")
true
;;
*config)
ln -sf "$branch".hs config.hs
git add config.hs
echo ".$branch" > privdata/relocate
git add privdata/relocate
commit "setting up $branch after merge"
;;
*)
ln -sf config-simple.hs config.hs
git add config.hs
if [ -e privdata/relocate ]; then
rm -f privdata/relocate
git rm --quiet privdata/relocate
fi
commit "clean up after merge"
;;
esac
This diff is collapsed.
Source: propellor
Section: admin
Priority: optional
Build-Depends:
cabal-install,
cdbs,
debhelper (>= 10),
ghc (>= 8.4.3),
git (>= 1:2.0),
haskell-devscripts,
libghc-ansi-terminal-dev,
libghc-ansi-terminal-prof,
libghc-async-dev,
libghc-async-prof,
libghc-exceptions-dev (>= 0.6),
libghc-exceptions-prof (>= 0.6),
libghc-hashable-dev,
libghc-hashable-prof,
libghc-hslogger-dev,
libghc-hslogger-prof,
libghc-ifelse-dev,
libghc-ifelse-prof,
libghc-mtl-dev,
libghc-mtl-prof,
libghc-network-dev,
libghc-network-prof,
libghc-split-dev,
libghc-split-prof,
libghc-text-dev,
libghc-text-prof,
libghc-transformers-dev,
libghc-transformers-prof,
libghc-unix-compat-dev,
libghc-unix-compat-prof,
Maintainer: Sean Whitton <spwhitton@spwhitton.name>
Standards-Version: 4.1.0
Homepage: https://propellor.branchable.com/
Vcs-Git: https://git.spwhitton.name/propellor -b debian
Vcs-Browser: https://git.spwhitton.name/propellor
X-Description: property-based host configuration management in haskell
Propellor ensures that the system it's run in satisfies a list of
properties, taking action as necessary when a property is not yet met.
.
It is configured using haskell.
.
The easiest way to get started with propellor is to install the binary package
`propellor' and run `propellor --init'.
Package: libghc-propellor-dev
Section: haskell
Architecture: any
Depends:
${haskell:Depends},
${misc:Depends},
${shlibs:Depends},
Recommends:
${haskell:Recommends},
Suggests:
${haskell:Suggests},
Conflicts:
${haskell:Conflicts},
Provides:
${haskell:Provides},
Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
${haskell:LongDescription}
.
${haskell:Blurb}
Package: libghc-propellor-doc
Architecture: all
Section: doc
Depends:
${haskell:Depends},
${misc:Depends},
Suggests:
${haskell:Suggests},
Conflicts:
${haskell:Conflicts},
Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
${haskell:LongDescription}
.
${haskell:Blurb}
Package: libghc-propellor-prof
Section: haskell
Architecture: any
Depends:
${haskell:Depends},
${misc:Depends},
Recommends:
${haskell:Recommends},
Suggests:
${haskell:Suggests},
Conflicts:
${haskell:Conflicts},
Provides:
${haskell:Provides},
Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
${haskell:LongDescription}
.
${haskell:Blurb}
Package: propellor
Architecture: any
Depends:
cabal-install,
ghc (>= 8.4.3),
git (>= 1:2.9),
libghc-ansi-terminal-dev,
libghc-async-dev,
libghc-exceptions-dev (>= 0.6),
libghc-hashable-dev,
libghc-hslogger-dev,
libghc-ifelse-dev,
libghc-mtl-dev,
libghc-network-dev,
libghc-propellor-dev,
libghc-split-dev,
libghc-text-dev,
libghc-transformers-dev,
libghc-unix-compat-dev,
${misc:Depends},
${shlibs:Depends},
Description: property-based host configuration management in haskell
Propellor ensures that the system it's run in satisfies a list of
properties, taking action as necessary when a property is not yet met.
.
It is configured using haskell.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://propellor.branchable.com/
Files: *
Copyright: © 2010-2016 Joey Hess <id@joeyh.name> and contributors
License: BSD-2-clause
License: BSD-2-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY AUTHORS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The Debian package of propellor ships its full source code because
propellor is configured by rebuilding it, and embraces modification of any
of the source code.
/usr/bin/propellor is a wrapper which will set up a propellor git
repository in ~/.propellor/, and run ~/.propellor/propellor if it exists.
Edit ~/.propellor/config.hs to configure it.
Note that upgrading the propellor package will not update your
~/.propellor/ repository. This is because you may have local changes
to the source, or may need to adapt your config.hs to work with the new
version of propellor. Instead, if your ~/.propellor/ is from an older
version of propellor, /usr/bin/propellor will warn that it's out of date,
and tell you how to merge in the changes.
#!/usr/bin/make -f
# don't install CHANGELOG as it duplicates d/changelog
DEB_INSTALL_CHANGELOGS_ALL=-XCHANGELOG
# Avoid using cabal, as it writes to $HOME
export CABAL=./Setup
build/propellor::
$(MAKE) build
install/propellor::
DESTDIR=$(CURDIR)/debian/propellor $(MAKE) install
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/hlibrary.mk
[Propellor](https://propellor.branchable.com/) is a
configuration management system using Haskell and Git.
Each system has a list of properties, which Propellor ensures
are satisfied.
[Linux](http://propellor.branchable.com/Linux/) and
[FreeBSD](http://propellor.branchable.com/FreeBSD/) are supported.
Propellor is configured via a git repository, which typically lives
in `~/.propellor/` on your development machine. Propellor clones the
repository to each host it manages, in a
[secure](http://propellor.branchable.com/security/) way. See
[components](http://propellor.branchable.com/components/)
for details.
Properties are defined using Haskell in the file `~/.propellor/config.hs`.
There is fairly complete
[API documentation](http://hackage.haskell.org/package/propellor/),
which includes many built-in Properties for dealing with
[Apt](http://hackage.haskell.org/package/propellor/docs/Propellor-Property-Apt.html)
and
[Apache](http://hackage.haskell.org/package/propellor/docs/Propellor-Property-Apache.html),
[Cron](http://hackage.haskell.org/package/propellor/docs/Propellor-Property-Cron.html)
and
[Commands](http://hackage.haskell.org/package/propellor/docs/Propellor-Property-Cmd.html),
[Dns](http://hackage.haskell.org/package/propellor/docs/Propellor-Property-Dns.html)
and
[Docker](http://hackage.haskell.org/package/propellor/docs/Propellor-Property-Docker.html), etc.
There is no special language as used in puppet, chef, ansible, etc.. just
the full power of Haskell. Hopefully that power can be put to good use in
making declarative properties that are powerful, nicely idempotent, and
easy to adapt to a system's special needs!
If using Haskell to configure Propellor seems intimidating,
see [configuration for the Haskell newbie](https://propellor.branchable.com/haskell_newbie/).
## quick start
1. Get propellor installed on your development machine (ie, laptop).
`cabal install propellor`
or
`stack install propellor`
or
`apt-get install propellor`
2. Run `propellor --init` ; this will set up a `~/.propellor/` git
repository for you.
3. Edit `~/.propellor/config.hs`, and add a host you want to manage.
You can start by not adding any properties, or only a few.
4. Run: `propellor --spin $HOST`
5. Now you have a simple propellor deployment to a host. Continue editing
`~/.propellor/config.hs` to further configure the host, add more hosts
etc, and re-run `propellor --spin $HOST` after each change.
6. Once you have a lot of hosts, and running `propellor --spin HOST` for
each host becomes tiresome, you can
[automate that](http://propellor.branchable.com/automated_spins/).
7. Write some neat new properties and send patches!
(Want to get your feet wet with propellor before plunging in?
[try this](http://propellor.branchable.com/forum/Simple_quickstart_without_git__44___SSH__44___GPG))
../config.hs
\ No newline at end of file
module Main where
import Propellor.Wrapper
main :: IO ()
main = runWrapper
This diff is collapsed.
Name: propellor
Version: 5.5.0
Cabal-Version: 1.20
License: BSD2
Maintainer: Joey Hess <id@joeyh.name>
Author: Joey Hess
Stability: Stable
Copyright: 2014 Joey Hess
License-File: LICENSE
Build-Type: Simple
Homepage: https://propellor.branchable.com/
Category: Utility
Extra-Source-Files:
README.md
doc/README.mdwn
CHANGELOG
Makefile
config-simple.hs
config-freebsd.hs
joeyconfig.hs
config.hs
contrib/post-merge-hook
stack.yaml
debian/changelog
debian/propellor.README.Debian
debian/compat
debian/control
debian/copyright
debian/rules
debian/lintian-overrides
Synopsis: property-based host configuration management in haskell
Description:
Propellor ensures that the system it's run in satisfies a list of
properties, taking action as necessary when a property is not yet met.
.
It is configured using haskell.
Library
Default-Language: Haskell98
GHC-Options: -Wall -fno-warn-tabs -O0
if impl(ghc >= 8.0)
GHC-Options: -fno-warn-redundant-constraints
Default-Extensions: TypeOperators
Hs-Source-Dirs: src
Build-Depends:
-- propellor needs to support the ghc shipped in Debian stable,
-- and also only depends on packages in Debian stable.
base >= 4.9, base < 5,
directory, filepath, IfElse, process, bytestring, hslogger, split,
unix, unix-compat, ansi-terminal, containers (>= 0.5), network, async,
time, mtl, transformers, exceptions (>= 0.6), stm, text, hashable
Exposed-Modules:
Propellor
Propellor.Base
Propellor.DotDir
Propellor.Location
Propellor.Property
Propellor.Property.Aiccu
Propellor.Property.Apache
Propellor.Property.Apt
Propellor.Property.Apt.PPA
Propellor.Property.Atomic
Propellor.Property.Attic
Propellor.Property.Bootstrap
Propellor.Property.Borg
Propellor.Property.Ccache
Propellor.Property.Cmd
Propellor.Property.Concurrent
Propellor.Property.Conductor
Propellor.Property.Hostname
Propellor.Property.Chroot
Propellor.Property.ConfFile
Propellor.Property.Cron
Propellor.Property.DebianMirror
Propellor.Property.Debootstrap
Propellor.Property.DiskImage
Propellor.Property.DiskImage.PartSpec
Propellor.Property.Dns
Propellor.Property.DnsSec
Propellor.Property.Docker
Propellor.Property.EtcDefault
Propellor.Property.Fail2Ban
Propellor.Property.File
Propellor.Property.Firejail
Propellor.Property.Firewall
Propellor.Property.FlashKernel
Propellor.Property.FreeBSD
Propellor.Property.FreeBSD.Pkg
Propellor.Property.FreeBSD.Poudriere
Propellor.Property.FreeDesktop
Propellor.Property.Fstab
Propellor.Property.Git
Propellor.Property.Gpg
Propellor.Property.Group
Propellor.Property.Grub
Propellor.Property.Installer
Propellor.Property.Installer.Types
Propellor.Property.Installer.Target
Propellor.Property.Journald
Propellor.Property.Kerberos
Propellor.Property.Laptop
Propellor.Property.LetsEncrypt
Propellor.Property.List
Propellor.Property.LightDM
Propellor.Property.Locale
Propellor.Property.Logcheck
Propellor.Property.Lvm
Propellor.Property.Machine
Propellor.Property.Mount
Propellor.Property.Network
Propellor.Property.Nginx
Propellor.Property.Obnam
Propellor.Property.OpenId
Propellor.Property.Openssl
Propellor.Property.OS
Propellor.Property.Pacman
Propellor.Property.Parted
Propellor.Property.Parted.Types
Propellor.Property.Partition
Propellor.Property.Postfix
Propellor.Property.PropellorRepo
Propellor.Property.Prosody
Propellor.Property.Qemu
Propellor.Property.Reboot
Propellor.Property.Restic
Propellor.Property.Rsync
Propellor.Property.Sbuild
Propellor.Property.Scheduled
Propellor.Property.Schroot
Propellor.Property.Service
Propellor.Property.Ssh
Propellor.Property.Sudo
Propellor.Property.Systemd
Propellor.Property.Systemd.Core
Propellor.Property.Timezone
Propellor.Property.Tor
Propellor.Property.Uboot
Propellor.Property.Unbound
Propellor.Property.User
Propellor.Property.Uwsgi
Propellor.Property.Versioned
Propellor.Property.XFCE
Propellor.Property.ZFS
Propellor.Property.ZFS.Process
Propellor.Property.ZFS.Properties
Propellor.Property.HostingProvider.DigitalOcean
Propellor.Property.HostingProvider.Exoscale
Propellor.Property.HostingProvider.Linode
Propellor.Property.SiteSpecific.GitHome
Propellor.Property.SiteSpecific.JoeySites
Propellor.Property.SiteSpecific.GitAnnexBuilder
Propellor.Property.SiteSpecific.Branchable
Propellor.PropAccum
Propellor.Utilities
Propellor.CmdLine
Propellor.Container
Propellor.Info
Propellor.Message
Propellor.Debug
Propellor.PrivData
Propellor.Engine
Propellor.EnsureProperty
Propellor.Exception
Propellor.Types
Propellor.Types.Bootloader
Propellor.Types.ConfigurableValue
Propellor.Types.Core
Propellor.Types.Chroot
Propellor.Types.CmdLine
Propellor.Types.Container
Propellor.Types.Docker
Propellor.Types.Dns
Propellor.Types.Empty
Propellor.Types.Exception
Propellor.Types.Info
Propellor.Types.MetaTypes
Propellor.Types.OS
Propellor.Types.PartSpec
Propellor.Types.PrivData
Propellor.Types.Result
Propellor.Types.ResultCheck
Propellor.Types.Singletons
Propellor.Types.ZFS
Propellor.Wrapper
Other-Modules:
Propellor.Bootstrap
Propellor.Git
Propellor.Git.Config
Propellor.Git.VerifiedBranch
Propellor.Gpg
Propellor.Spin
Propellor.Ssh
Propellor.PrivData.Paths