Browse files

Confs pour le dashboard

  • Loading branch information...
1 parent 7b4ffca commit 85e99d6f73778ce8ac28c6028ef26ba97bb9a597 @binbashfr committed Mar 19, 2012
Showing with 224 additions and 0 deletions.
  1. +37 −0 nginx.conf
  2. +25 −0 puppet-dashboard
  3. +10 −0 puppet-dashboard-workers
  4. +134 −0 puppet-init
  5. +18 −0 puppetdashboard
View
37 nginx.conf
@@ -0,0 +1,37 @@
+worker_processes 4;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11;
+ passenger_ruby /usr/bin/ruby;
+ passenger_use_global_queue on;
+ passenger_max_pool_size 15;
+ passenger_pool_idle_time 300;
+ # Option non disponible
+ # passenger_max_request 1000;
+
+ include mime.types;
+ default_type application/octet-stream;
+
+ sendfile on;
+ tcp_nopush on;
+
+ # KeepAlive
+ keepalive_timeout 65;
+ tcp_nodelay on;
+
+ server {
+ listen 3000;
+ server_name dashboard.domaine;
+
+ passenger_enabled on;
+
+ access_log /var/log/nginx/puppetdashboard.access.log;
+ error_log /var/log/nginx/puppetdashboard.error.log;
+
+ root /usr/share/puppet-dashboard/public;
+ }
+}
View
25 puppet-dashboard
@@ -0,0 +1,25 @@
+# IMPORTANT: Be sure you have checked the values below, appropriately
+# configured 'config/database.yml' in your DASHBOARD_HOME, and
+# created and migrated the database.
+
+# Uncomment the line below to start Puppet Dashboard.
+# START=yes
+
+# Location where puppet-dashboard is installed:
+DASHBOARD_HOME=/usr/share/puppet-dashboard
+
+# User which runs the puppet-dashboard program:
+DASHBOARD_USER=puppet-dashboard
+
+# Ruby version to run the puppet-dashboard as:
+DASHBOARD_RUBY=/usr/bin/ruby
+
+# Rails environment in which puppet-dashboard runs:
+DASHBOARD_ENVIRONMENT=production
+
+# Network interface which puppet-dashboard web server is running at:
+DASHBOARD_IFACE=0.0.0.0
+
+# Port on which puppet-dashboard web server is running at, note that if the
+# puppet-dashboard user is not root, it has to be a > 1024:
+DASHBOARD_PORT=3000
View
10 puppet-dashboard-workers
@@ -0,0 +1,10 @@
+# IMPORTANT: Be sure you have checked the values below, appropriately
+# configured 'config/database.yml' in your DASHBOARD_HOME, and
+# created and migrated the database.
+. /etc/default/puppet-dashboard
+START=yes
+
+# Number of dashboard workers to start. This will be the number of jobs that
+# can be concurrently processed. A simple recommendation would be to start
+# with the number of cores you have available.
+NUM_DELAYED_JOB_WORKERS=2
View
134 puppet-init
@@ -0,0 +1,134 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: puppet-dashboard-workers
+# Required-Start: $local_fs $remote_fs $network $syslog
+# Required-Stop: $local_fs $remote_fs $network $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# X-Interactive: true
+# Short-Description: Start/stop puppet-dashboard-workers delayed_job helpers
+### END INIT INFO
+#
+# puppet-dashboard-workers This init.d script is used to start puppet-dashboard-workers.
+
+name=puppet-dashboard-workers
+ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
+
+set -e
+
+. /lib/lsb/init-functions
+
+test -f /etc/default/rcS && . /etc/default/rcS
+test -f /etc/default/${name} && . /etc/default/${name}
+
+# Set defaults in case they're not in the above defaults file:
+DASHBOARD_HOME=${DASHBOARD_HOME:-/usr/share/puppet-dashboard}
+DASHBOARD_USER=${DASHBOARD_USER:-www-data}
+DASHBOARD_RUBY=${DASHBOARD_RUBY:-/usr/bin/ruby}
+DASHBOARD_ENVIRONMENT=${DASHBOARD_ENVIRONMENT:-production}
+DASHBOARD_IFACE=${DASHBOARD_IFACE:-0.0.0.0}
+DASHBOARD_PORT=${DASHBOARD_PORT:-3000}
+
+check_dashboard_enabled_option() {
+ if [ ! "$START" = "yes" ]; then
+ log_warning_msg "Not starting Puppet Dashboard Workers, disabled via /etc/default/${name}"
+ return 1
+ else
+ return 0
+ fi
+}
+
+check_puppet_dashboard_worker_status() {
+ RETVAL=1
+ for pidfile in $(ls -1 "${DASHBOARD_HOME}"/tmp/pids/delayed_job*.pid 2>/dev/null)
+ do
+ status_of_proc -p $pidfile ${DASHBOARD_RUBY} "Puppet Dashboard Worker (pid $(cat $pidfile))" || return $?
+ RETVAL=$?
+ done
+ if [ "$RETVAL" -eq "1" ] ; then
+ log_daemon_msg "${name} is not running."
+ fi
+ return $RETVAL
+}
+
+stop_puppet_dashboard_workers() {
+ RETVAL=0
+ for pidfile in $(ls -1 "${DASHBOARD_HOME}"/tmp/pids/delayed_job*.pid 2>/dev/null)
+ do
+ start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile --retry 10
+ ((RETVAL=RETVAL+$?))
+ done
+ return $RETVAL
+}
+
+start_puppet_dashboard_workers() {
+ start-stop-daemon --start --quiet --oknodo --user ${DASHBOARD_USER} --chuid ${DASHBOARD_USER} --exec /bin/bash -- -e -c "
+ export PATH='${PATH}';
+ export RUBYLIB='${RUBYLIB:-}';
+ export RAILS_ENV=production;
+ ${DASHBOARD_HOME}/script/delayed_job -p dashboard -n ${NUM_DELAYED_JOB_WORKERS:-2} -m start;"
+ check_puppet_dashboard_worker_status
+}
+
+case $1 in
+ start)
+ log_daemon_msg "Starting Puppet Dashboard Workers"
+ if ! check_dashboard_enabled_option; then
+ log_end_msg 0
+ exit
+ fi
+ if start_puppet_dashboard_workers; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+ ;;
+ stop)
+ log_daemon_msg "Stopping Puppet Dashboard Workers"
+ if stop_puppet_dashboard_workers ; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+ ;;
+ restart)
+ log_daemon_msg "Restarting Puppet Dashboard Workers"
+ set +e
+ stop_puppet_dashboard_workers
+ RET="$?"
+ set -e
+ case ${RET} in
+ 0)
+ # Old server stopped
+ if ! check_dashboard_enabled_option; then
+ log_end_msg 0
+ exit
+ fi
+ if start_puppet_dashboard_workers; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+ ;;
+ 1)
+ # Server not running
+ log_progress_msg "(not running)"
+ log_end_msg 0
+ ;;
+ *)
+ # Failed to stop
+ log_progress_msg "(failed to stop)"
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ status)
+ check_puppet_dashboard_worker_status && exit 0 || exit $?
+ ;;
+ *)
+ log_action_msg "Usage: /etc/init.d/${name} {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
View
18 puppetdashboard
@@ -0,0 +1,18 @@
+Listen 3000
+<VirtualHost *:3000>
+ ServerName dashboard.domaine
+
+ ErrorLog /var/log/apache2/dashboard_error.log
+ LogLevel warn
+ SetEnvIf Remote_Addr "::1" dontlog
+ CustomLog /var/log/apache2/dashboard_access.log combined env=!dontlog
+
+ RackAutoDetect On
+ DocumentRoot /usr/share/puppet-dashboard/public
+ <Directory /usr/share/puppet-dashboard/public>
+ Options None
+ AllowOverride AuthConfig
+ Order allow,deny
+ allow from all
+ </Directory>
+</VirtualHost>

0 comments on commit 85e99d6

Please sign in to comment.