This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge branch 'master' into master-merge-srcpackage

  • Loading branch information...
kurtiss committed Mar 13, 2011
2 parents 81d1cc3 + 6171b3f commit 1d805497c497fd9efd488cd86aac0d8dad67f742
View
@@ -1,6 +0,0 @@
-#!/usr/bin/env python
-
-from kokki.command import main
-
-if __name__ == "__main__":
- main()
@@ -0,0 +1,9 @@
+
+__description__ = "Jenkins CI"
+__config__ = {
+ "jenkins.http_port": dict(
+ description = "HTTP port to listen on",
+ default = 8080,
+ )
+}
+
@@ -0,0 +1,32 @@
+
+from kokki import *
+
+if env.system.platform in ("ubuntu", "debian"):
+ Execute("wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -",
+ not_if = "(apt-key list | grep 'Kohsuke Kawaguchi' > /dev/null)")
+
+
+ apt = "deb http://pkg.jenkins-ci.org/debian binary/"
+ apt_list_path = '/etc/apt/sources.list.d/jenkins.list'
+
+ Execute("apt-update-jenkins",
+ command = "apt-get update",
+ action = "nothing")
+
+ File(apt_list_path,
+ owner = "root",
+ group ="root",
+ mode = 0644,
+ content = apt+"\n",
+ notifies = [("run", env.resources["Execute"]["apt-update-jenkins"], True)])
+
+Package("jenkins")
+
+Service("jenkins")
+
+File("/etc/default/jenkins",
+ owner = "root",
+ group = "root",
+ mode = 0644,
+ content = Template("jenkins/default.j2"),
+ notifies = [("restart", env.resources["Service"]["jenkins"])])
@@ -0,0 +1,53 @@
+# defaults for jenkins continuous integration server
+
+# pulled in from the init script; makes things easier.
+NAME=jenkins
+
+# location of java
+JAVA=/usr/bin/java
+
+# arguments to pass to java
+#JAVA_ARGS="-Xmx256m"
+
+PIDFILE=/var/run/jenkins/jenkins.pid
+
+# user id to be invoked as (otherwise will run as root; not wise!)
+JENKINS_USER=jenkins
+
+# location of the jenkins war file
+JENKINS_WAR=/usr/share/jenkins/jenkins.war
+
+# jenkins home location
+JENKINS_HOME=/var/lib/jenkins
+
+# set this to false if you don't want Hudson to run by itself
+# in this set up, you are expected to provide a servlet containr
+# to host jenkins.
+RUN_STANDALONE=true
+
+# log location. this may be a syslog facility.priority
+JENKINS_LOG=/var/log/jenkins/$NAME.log
+#HUDSON_LOG=daemon.info
+
+# OS LIMITS SETUP
+# comment this out to observe /etc/security/limits.conf
+# this is on by default because http://github.com/feniix/hudson/commit/d13c08ea8f5a3fa730ba174305e6429b74853927
+# reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file
+# descriptors are forced to 1024 regardless of /etc/security/limits.conf
+MAXOPENFILES=8192
+
+# port for HTTP connector (default 8080; disable with -1)
+HTTP_PORT={{ env.config.jenkins.http_port }}
+
+# port for AJP connector (disabled by default)
+AJP_PORT=-1
+
+# arguments to pass to jenkins.
+# --javahome=$JAVA_HOME
+# --httpPort=$HTTP_PORT (default 8080; disable with -1)
+# --httpsPort=$HTTP_PORT
+# --ajp13Port=$AJP_PORT
+# --argumentsRealm.passwd.$ADMIN_USER=[password]
+# --argumentsRealm.$ADMIN_USER=admin
+# --webroot=~/.jenkins/war
+JENKINS_ARGS="--webroot=/var/run/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT"
@@ -31,19 +31,27 @@ def setup(name, **kwargs):
content = Template("mongodb/mongodb.conf.j2", variables=dict(mongodb=config)))
# notifies = [("restart", env.resources["MonitService"]["mongodb-%s" % name])])
- # env.include_recipe("monit")
- # env.cookbooks.monit.rc("mongodb-%s" % name,
- # Template("mongodb/monit.conf.j2", variables=dict(name=name, mongodb=config)))
- # env.cookbooks.monit.MonitService("mongodb-%s" % name,
- # subscribes = [("restart", env.resources["File"][config.configpath])])
-
- Service("mongodb-%s" % name,
- subscribes = [("restart", env.resources["File"][config.configpath])])
- File("/etc/init/mongodb-%s.conf" % name,
- owner = "root",
- group = "root",
- mode = 0644,
- content = Template("mongodb/upstart.conf.j2", variables=dict(mongodb=config)),
- notifies = [
- ("reload", env.resources["Service"]["mongodb-%s" % name], True),
- ])
+ controller = kwargs.get("controller")
+ if controller == "monit":
+ env.include_recipe("monit")
+ env.cookbooks.monit.rc("mongodb-%s" % name,
+ Template("mongodb/monit.conf.j2", variables=dict(name=name, mongodb=config)))
+ env.cookbooks.monit.MonitService("mongodb-%s" % name,
+ subscribes = [("restart", env.resources["File"][config.configpath])])
+ elif controller == "supervisord":
+ env.include_recipe("supervisor")
+ env.cookbooks.supervisor.configuration("mongodb-%s" % name,
+ Template("mongodb/supervisord.conf.j2", variables=dict(name=name, mongodb=config)))
+ env.cookbooks.supervisor.SupervisorService("mongodb-%s" % name,
+ subscribes = [("restart", env.resources["File"][config.configpath])])
+ else:
+ Service("mongodb-%s" % name,
+ subscribes = [("restart", env.resources["File"][config.configpath])])
+ File("/etc/init/mongodb-%s.conf" % name,
+ owner = "root",
+ group = "root",
+ mode = 0644,
+ content = Template("mongodb/upstart.conf.j2", variables=dict(mongodb=config)),
+ notifies = [
+ ("reload", env.resources["Service"]["mongodb-%s" % name], True),
+ ])
@@ -58,7 +58,7 @@
mode = 0644,
content = Template("mongodb/upstart.conf.j2", variables=dict(mongodb=env.config.mongodb)),
notifies = [
- ("reload", env.resources["Service"]["mongodb"], True),
+ ("restart", env.resources["Service"]["mongodb"], True),
])
File(env.config.mongodb.configpath,
@@ -0,0 +1,4 @@
+[program:mongodb_{{ name }}]
+command=/usr/bin/mongod --config {{ mongodb.configpath }} {{ " ".join(mongodb.options) }}
+# autostart=true
+stopwaitsecs=300
@@ -1,18 +1,9 @@
import subprocess
from kokki import *
+from kokki.providers.service import ServiceProvider
-class MonitServiceProvider(Provider):
- def action_start(self):
- if not self.status():
- self._init_cmd("start", 0)
- self.resource.updated()
-
- def action_stop(self):
- if self.status():
- self._init_cmd("stop", 0)
- self.resource.updated()
-
+class MonitServiceProvider(ServiceProvider):
def action_restart(self):
self._init_cmd("restart", 0)
self.resource.updated()
@@ -10,5 +10,6 @@ class PipPackage(Resource):
action = ForcedListArgument(default="install")
package_name = ResourceArgument(default=lambda obj:obj.name)
+ location = ResourceArgument(default=lambda obj:obj.package_name)
version = ResourceArgument(required = True)
- actions = ["install", "upgrade", "remove", "purge"]
+ actions = ["install", "upgrade", "remove", "purge"]
@@ -9,4 +9,12 @@
description = "Pipe command",
default = None,
),
+ "powerdns.allow_recursion": dict(
+ description = "List of addresses from which to allow recursion",
+ default = "127.0.0.1",
+ ),
+ "powerdns.recursor": dict(
+ description = "IP address of recursing nameserver if desired",
+ default = None,
+ ),
}
@@ -8,7 +8,7 @@
#################################
# allow-recursion List of netmasks that are allowed to recurse
#
-allow-recursion=127.0.0.1
+allow-recursion={{ env.config.powerdns.allow_recursion }}
#################################
# allow-recursion-override Local data even about hosts that don't exist will
@@ -197,7 +197,9 @@ module-dir=/usr/lib/powerdns
#################################
# recursor If recursion is desired, IP address of a recursing nameserver
#
-# recursor=
+{% if env.config.powerdns.recursor %}
+recursor={{ env.config.powerdns.recursor }}
+{% endif %}
#################################
# setgid If set, change group id to this gid for more security
@@ -0,0 +1,8 @@
+
+__description__ = "RabbitMQ Messaging Server"
+__config__ = {
+ "rabbitmq.path": dict(
+ description = "Install path for rabbitmq",
+ default = "/usr/local/rabbitmq",
+ )
+}
@@ -0,0 +1,10 @@
+
+from kokki import *
+
+Package("erlang")
+
+if env.system.platform in ("ubuntu", "debian"):
+ pkg_url = "http://www.rabbitmq.com/releases/rabbitmq-server/v2.3.1/rabbitmq-server_2.3.1-1_all.deb"
+ Execute("cd /tmp ; wget %s ; dpkg -i %s ; rm rabbitmq*deb" % (pkg_url, pkg_url.rsplit('/', 1)[-1]),
+ not_if = "dpkg-query -c rabbitmq-server > /dev/null")
+
@@ -1,12 +1,13 @@
+import os
from kokki import *
-def config(name, content):
+def configuration(name, content):
env = Environment.get_instance()
return File("supervisor-%s" % name,
content = content,
owner = "root",
group = "root",
mode = 0644,
- path = "%s/supervisor.d/%s" % (env.config.supervisor.config_path, name),
- notifies = [("restart", env.resources["Service"]["supervisor"])])
+ path = os.path.join(env.config.supervisor.custom_config_path, name) + ".conf",
+ notifies = [("reload", env.resources["Service"]["supervisor"])])
@@ -22,7 +22,7 @@ def action_restart(self):
self.resource.updated()
def action_reload(self):
- self._init_cmd("reload", 0)
+ self._init_cmd("update", 0)
self.resource.updated()
def status(self):
@@ -2,22 +2,26 @@
__description__ = "Process monitoring"
__config__ = {
"supervisor.config_path": dict(
- display_name = "Supervisor config path",
description = "Config file path for supervisor",
- default = "/etc",
+ default = "/etc/supervisor/supervisord.conf",
+ ),
+ "supervisor.socket_path": dict(
+ description = "Unix socket path",
+ default = "/var/run/supervisor.sock",
+ ),
+ "supervisor.custom_config_path": dict(
+ description = "Path to custom supervisor config files",
+ default = "/etc/supervisor/conf.d",
),
"supervisor.binary_path": dict(
- display_name = "Supervisor binary path",
description = "Path to the supervisor binaries",
- default = "/usr/local/bin",
+ default = "/usr/bin",
),
"supervisor.pidfile": dict(
- display_name = "Supervisor pid file path",
description = "Path to the supervisor pid file",
default = "/var/run/supervisord.pid",
),
"supervisor.logfile": dict(
- display_name = "Supervisor log file path",
description = "Path to the supervisor log file",
default = "/var/log/supervisord.log",
),
@@ -1,20 +1,27 @@
+import os
from kokki import *
-env.include_recipe("monit")
+# env.include_recipe("monit")
-Package("supervisor",
- provider = "kokki.providers.package.easy_install.EasyInstallProvider")
+Package("supervisor")
+# provider = "kokki.providers.package.easy_install.EasyInstallProvider")
File("supervisord.conf",
- path = "%s/supervisord.conf" % env.config.supervisor.config_path,
+ path = env.config.supervisor.config_path,
content = Template("supervisor/supervisord.conf.j2"))
Directory("supervisor.d",
- path = "%s/supervisor.d" % env.config.supervisor.config_path)
+ path = env.config.supervisor.custom_config_path)
-env.cookbooks.monit.rc("supervisord",
- content = Template("supervisor/monit.conf.j2"))
+supervisorctl = os.path.join(env.config.supervisor.binary_path, "supervisorctl")
+Service("supervisor",
+ restart_command = "%s reload" % supervisorctl,
+ reload_command = "%s update" % supervisorctl,
+ subscribes = [("reload", env.resources["File"]["supervisord.conf"])])
-env.cookbooks.monit.MonitService("supervisord",
- subscribes = [("restart", env.resources["File"]["supervisord.conf"])])
+#env.cookbooks.monit.rc("supervisord",
+# content = Template("supervisor/monit.conf.j2"))
+
+#env.cookbooks.monit.MonitService("supervisord",
+# subscribes = [("restart", env.resources["File"]["supervisord.conf"])])
@@ -1,5 +1,6 @@
[unix_http_server]
-file=/tmp/supervisor.sock ; (the path to the socket file)
+file={{ env.config.supervisor.socket_path }} ; (the path to the socket file)
+chmod=0700
[supervisord]
logfile={{ env.config.supervisor.logfile }} ; (main log file;default $CWD/supervisord.log)
@@ -10,12 +11,13 @@ pidfile={{ env.config.supervisor.pidfile }} ; (supervisord pidfile;default super
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
+childlogdir=/var/log/supervisor
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
-serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
+serverurl=unix://{{ env.config.supervisor.socket_path }} ; use a unix:// URL for a unix socket
[include]
-files = supervisor.d/*
+files = {{ env.config.supervisor.custom_config_path }}/*.conf
@@ -1,8 +1,8 @@
__description__ = "Manage user accounts and sysadmins"
__config__ = {
- "sysadmins": dict(
- description = "List of sysadmins (id,username,sshkey_id,sshkey_type,sshkey)",
- default = [],
+ "users": dict(
+ description = "Disctionary of sysadmins with username as the key and value as a dictionary of (id,sshkey_id,sshkey_type,sshkey)",
+ default = {},
)
}
Oops, something went wrong.

0 comments on commit 1d80549

Please sign in to comment.