These are the updates I've put together for building both RPM, and DEB packages for Puppet Dashboard. This is based on work from both James Turnbull, and Igal Koshevoy.
This allows us to build the RPM, and DEB packages by running `rake package:deb` and `rake package:rpm`, and to test these builds by setting the UNSIGNED environment variable (`rake package:deb UNSIGNED=1`). It also includes some general clean-ups, and improvements to how Puppet Dashboard is packaged. The following changes since commit 2c1810d9650fc9b0e021f1a4bbd1658debdf3691: Merge branch 'feature/v1.0.4rc1/4757-mail_patches' into next (2010-09-17 03:11:41 -0700) are available in the git repository at: git://github.com/jhelwig/puppet-dashboard.git bug/next/4513-automate-packaging Igal Koshevoy (3): Remove unwanted ".bak" and "~" files. Merge remote branch 'jamtur01/master' into 4513-with_packaging [#4513] Fix ".deb" packaging and docs. Add `rake package:deb` task. Jacob Helwig (12): [#4513] Move clean working-tree check into "helper" task, and clean it up. [#4513] Add tasks for RPM packaging. [#4513] Update Requires in RPM .spec [#4513] Update RPM .spec install section to use $RPM_BUILD_ROOT [#4513] Update RPM .spec to create a user & group, and set proper permissions. [#4513] Update Red Hat init script to start as puppet-dashboard user [#4513] Update RPM .spec to mark config/database.yml as a config file. [#4513] Minor clean-ups to RPM .spec file [#4513] Update RPM .spec file to add missing installation files [#4513] Clean up README_PACKAGES.markdown [#4513] Add default file and init script for Debian [#4513] Advertise UNSIGNED "option" to package rake tasks, on build failure. James Turnbull (8): Added updated packaging information for Red Hat and Debian Merge branch 'master' of git://github.com/reductivelabs/puppet-dashboard Updated Red Hat spec file Merge branch 'master' of git://github.com/reductivelabs/puppet-dashboard Merge branch 'master' of git://github.com/reductivelabs/puppet-dashboard Merge branch 'master' of git://github.com/reductivelabs/puppet-dashboard Merge branch 'master' of git://github.com/reductivelabs/puppet-dashboard Updated packaging information README_PACKAGES.markdown | 82 +++--- ext/packaging/debian/README.Debian | 94 ++----- ext/packaging/debian/changelog | 18 ++ ext/packaging/debian/control | 4 +- ext/packaging/debian/default | 18 ++ ext/packaging/debian/dirs | 5 +- ext/packaging/debian/files | 2 +- ext/packaging/debian/install | 8 + ext/packaging/debian/postinst | 9 + ext/packaging/debian/postrm | 9 + ext/packaging/debian/puppet-dashboard.default | 9 + ext/packaging/debian/puppet-dashboard.init | 86 ++++++ ext/packaging/debian/rules | 9 +- ext/packaging/redhat/puppet-dashboard.init | 2 +- ext/packaging/redhat/puppet-dashboard.spec | 89 ++++-- lib/tasks/package.rake | 111 +++++++ public/stylesheets/sass/application.scss~ | 300 -------------------- .../implicitly_multipart_example.rhtml.bak | 1 - .../implicitly_multipart_example.text.html.erb~ | 10 - .../actionpack/test/fixtures/test/hello_world.erb~ | 1 - .../fixtures/test/malformed/malformed.en.html.erb~ | 1 - .../test/fixtures/test/malformed/malformed.erb~ | 1 - .../fixtures/test/malformed/malformed.html.erb~ | 1 - 23 files changed, 409 insertions(+), 461 deletions(-) create mode 100644 ext/packaging/debian/default create mode 100644 ext/packaging/debian/postinst create mode 100644 ext/packaging/debian/postrm create mode 100644 ext/packaging/debian/puppet-dashboard.default create mode 100644 ext/packaging/debian/puppet-dashboard.init create mode 100644 lib/tasks/package.rake delete mode 100644 public/stylesheets/sass/application.scss~ delete mode 100644 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak delete mode 100644 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ delete mode 100644 vendor/rails/actionpack/test/fixtures/test/hello_world.erb~ delete mode 100644 vendor/rails/actionpack/test/fixtures/test/malformed/malformed.en.html.erb~ delete mode 100644 vendor/rails/actionpack/test/fixtures/test/malformed/malformed.erb~ delete mode 100644 vendor/rails/actionpack/test/fixtures/test/malformed/malformed.html.erb~ diff --git README_PACKAGES.markdown README_PACKAGES.markdown index f5c9196..f4261d6 100644 --- README_PACKAGES.markdown +++ README_PACKAGES.markdown @@ -9,71 +9,81 @@ DEB Packages via APT ### Installation -1. Add the following to your /etc/apt/sources.list file: +1. Add the following to your `/etc/apt/sources.list` file: - deb http://apt.puppetlabs.com/ubuntu lucid main - deb-src http://apt.puppetlabs.com/ubuntu lucid main + deb http://apt.puppetlabs.com/ubuntu lucid main + deb-src http://apt.puppetlabs.com/ubuntu lucid main -2. Add the Puppet Labs repository key to APT. +2. Add the Puppet Labs repository key to APT by running: - $ gpg --recv-key 8347A27F - $ gpg -a --export 8347A27F | sudo apt-key add - + gpg --recv-key 8347A27F + gpg -a --export 8347A27F | sudo apt-key add - -3. Run apt-get update +3. Update APT's package cache: - $ sudo apt-get update + sudo apt-get update -4. Install Puppet Dashboard package +4. Install Puppet Dashboard package: - $ sudo apt-get install puppet-dashboard + sudo apt-get install puppet-dashboard -The Dashboard will be installed in `/usr/share/puppet-dashboard` and you run -the server from here or create a Passenger configuration. +5. Configure `/etc/puppet-dashboard/database.yml`. + +6. Modify `/etc/default/puppet-dashboard`: + + enabled=1 + +Puppet Dashboard will be installed in `/usr/share/puppet-dashboard` and you can +start it via `service puppet-dashboard start`. ### Upgrading -1. Run apt-get update +1. Update APT's package cache: - $ sudo apt-get update + sudo apt-get update -2. Upgrade just Puppet Dashboard +2. Upgrade just Puppet Dashboard: - $ sudo apt-get install puppet-dashboard + sudo apt-get install puppet-dashboard -3. Run the database migrations. See README.markdown for more information +3. Run the database migrations. See `README.markdown` for more + information. + +4. Restart your Puppet Dashboard server for these changes to take effect, + which may require restarting your webserver. -4. Restart your Puppet Dashboard server for these changes to take effect, which may require restarting your webserver RPM packages via Yum -------------------- ### Installation -1. Create a Yum repo entry for Puppet Labs - - $ vi /etc/yum.repos.d/puppetlabs.repo +1. Create a Yum repo entry for Puppet Labs in + `/etc/yum.repos.d/puppetlabs.repo`: - [puppetlabs] - name=Puppet Labs Packages - baseurl=http://yum.puppetlabs.com/base/ - enabled=1 - gpgcheck=1 - gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-reductive + [puppetlabs] + name=Puppet Labs Packages + baseurl=http://yum.puppetlabs.com/base/ + enabled=1 + gpgcheck=1 + gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-reductive -2. Install via yum +2. Install Puppet Dashboard via Yum: - $ sudo yum install puppet-dashboard + sudo yum install puppet-dashboard -You will be prompted to install the Puppet Labs release key as part of the installation process. +You will be prompted to install the Puppet Labs release key as part of the +installation process. -The Dashboard will be installed in `/usr/share/puppet-dashboard` and you run -the server from here or create a Passenger configuration. +Puppet Dashboard will be installed in `/usr/share/puppet-dashboard` and you can +start it via `service puppet-dashboard start`. ### Upgrading -1. Upgrade via yum +1. Upgrade Puppet Dashboard via Yum: - $ sudo yum update puppet-dashboard + sudo yum update puppet-dashboard -2. Run the database migrations. See README.markdown for more information +2. Run the database migrations. See `README.markdown` for more information. -3. Restart your Puppet Dashboard server for these changes to take effect, which may require restarting your webserver +3. Restart your Puppet Dashboard server for these changes to take effect, + which may require restarting your webserver. diff --git ext/packaging/debian/README.Debian ext/packaging/debian/README.Debian index ead9621..b036730 100644 --- ext/packaging/debian/README.Debian +++ ext/packaging/debian/README.Debian @@ -1,76 +1,30 @@ -puppet-dashboard for Debian ---------------------------- -* Puppet Dashboard v1.0 +Puppet Dashboard for Debian +=========================== -* SUPPORTS SETUP AND UPGRADES OF MULTIPLE DATABASE INSTANCES - This puppet-dashboard package is designed to automatically configure database - BUT NOT the web server. - The default database instance is called "default". - A debconf facility is provided for configuring several puppet-dashboard - instances. Use dpkg-reconfigure to define the instances identifiers. - NOTICE : every rake command has to know which instance it applies to. - TO SELECT THE INSTANCE, USE - X_DEBIAN_SITEID=<instancename> - BEFORE ANY RAKE TASK. - -* MANUAL WEB SERVER CONFIGURATION - For web server configuration, examples are available in /usr/share/doc/puppet-dashboard/examples - To choose which instance to run, set the environment variable : - X_DEBIAN_SITEID=<instancename> - By default, - X_DEBIAN_SITEID=default +Overview +-------- - If used with apache2, lighttpd and similar web servers, - it is HIGHLY RECOMMENDED to install libfcgi-ruby, - and when using apache2, libapache2-mod-fcgid. +This package installs the Puppet Dashboard into `/usr/share/puppet-dashboard` -- this directory will be referred to as the "Puppet Dashboard directory" throughout this document. -* QUICK LAUNCH USING WEBRICK - To test puppet-dashboard without installing a web server, run as root : - cd /usr/share/puppet-dashboard/ - sudo -u www-data X_DEBIAN_SITEID="default" ruby script/server webrick -e production - and point your browser to http://localhost:3000 - NOTICE : running without sudoing to www-data will change permissions on some files, e.g. - /var/log/puppet-dashboard files. Fix it or reinstall the puppet-dashboard package if you did so. +Please also read the general usage and installation instructions in the `README.markdown` file in the Puppet Dashboard directory. - * OWNERS AND PERMISSIONS - It is assumed ruby will run puppet-dashboard as www-data:www-data. - Accordingly, these files are owned by root:www-data and have 640 permissions : - /etc/puppet-dashboard/<instancename>/session.yml - /etc/puppet-dashboard/<instancename>/database.yml - These folders are owned by www-data:www-data and have 750 permissions : - /var/log/puppet-dashboard/* - /var/lib/puppet-dashboard/* - /var/cache/puppet-dashboard/* +Installation +------------ - Relaxing those permissions is discouraged. Please think twice before doing so. - If one really need to run puppet-dashboard as another user, please read what follows. +1. Install a MySQL server if you don't already have one, e.g.: -* MANUAL INSTALL / RUNNING AS UNPRIVILEGED USER WITHOUT COPYING /usr/share/puppet-dashboard - Why : puppet-dashboard package upgrades will benefit to all puppet-dashboard instances, although - calling manually rake db:migrate on each package upgrade is still necessary. - Besides support for X_DEBIAN_SITEID, several environment variables are available : - RAILS_ETC (where database.yml, email.yml are supposed to be) - RAILS_LOG (the log files) - RAILS_VAR (contains the files/ directory) - RAILS_CACHE (cached data) - and, of course, RAILS_ENV - That way, one can install puppet-dashboard as a user foo : - - first create some directories in e.g. /home/foo/puppet-dashboard : config, files, tmp, log - - in a terminal, declare those environment variables : - mydir=/home/dev/test/puppet-dashboard - export RAILS_ETC=$mydir/config - export RAILS_LOG=$mydir/log - export RAILS_VAR=$mydir - export RAILS_CACHE=$mydir/tmp - export RAILS_ENV=production - export X_DEBIAN_SITEID=myinstance - - copy /usr/share/puppet-dashboard/templates/database.yml.template to $mydir/config/database.yml - and adapt it to your needs; for a quick setup it's easier to use the sqlite template, - located in the same dir. - - link /usr/share/puppet-dashboard/db to $mydir/db : - ln -s /usr/share/puppet-dashboard/db $mydir/db - - then "install" puppet-dashboard : - rake -f /usr/share/puppet-dashboard/Rakefile generate_session_store - - Run puppet-dashboard using e.g. webrick and point your browser to localhost:3000 - ruby /usr/share/puppet-dashboard/script/server webrick -e production - + sudo apt-get install mysql-server + +1. Create a `/usr/share/puppet-dashboard/config/database.yml` file. Please see the `database.yml.example` file in that `config` directory for an example and instructions. + +2. Create the database by running the following commands from the Puppet Dashboard directory: + + rake RAILS_ENV=production db:create + +3. Apply the database migrations by running the following commands from the Puppet Dashboard directory, you will need to do this after upgrading to a new release: + + rake RAILS_ENV=production db:migrate + +4. Run the Puppet Dashboard server, e.g. run the following commands from the Puppet Dashboard directory, e.g.: + + su www-data -c './script/server -d -e production' diff --git ext/packaging/debian/changelog ext/packaging/debian/changelog index 41899a5..ec6cae4 100644 --- ext/packaging/debian/changelog +++ ext/packaging/debian/changelog @@ -1,3 +1,21 @@ +puppet-dashboard (1.0.4-1) lucid; urgency=low + + * 1.0.4-1 maintenance release + + -- James Turnbull <ja...@puppetlabs.com> Wed, 01 Sep 2010 16:59:19 -0700 + +puppet-dashboard (1.0.3) lucid; urgency=low + + * 1.0.3 maintenance release + + -- James Turnbull <ja...@puppetlabs.com> Thu, 29 Jul 2010 20:50:17 +1000 + +puppet-dashboard (1.0.1) lucid; urgency=low + + * 1.0.1 maintenance release + + -- James Turnbull <ja...@puppetlabs.com> Fri, 17 Jul 2010 17:22:13 +1000 + puppet-dashboard (1.0) lucid; urgency=low * Initial Release diff --git ext/packaging/debian/control ext/packaging/debian/control index 0ea9728..df66462 100644 --- ext/packaging/debian/control +++ ext/packaging/debian/control @@ -1,7 +1,7 @@ Source: puppet-dashboard Section: web Priority: extra -Maintainer: James Turnbull <ja...@lovedthanlost.net> +Maintainer: James Turnbull <ja...@puppetlabs.com> Build-Depends: debhelper (>= 7), cdbs Build-Depends-Indep: po-debconf Standards-Version: 3.8.4 @@ -10,7 +10,7 @@ Homepage: http://github.com/reductivelabs/puppet-dashboard Package: puppet-dashboard Architecture: all Pre-Depends: debconf -Depends: ruby, ruby1.8 (>= 1.8.7), rake (>=0.8.3), dbconfig-common, libdbd-mysql-ruby, mysql-client +Depends: ruby, ruby1.8 (>= 1.8.7), rake (>=0.8.3), dbconfig-common, libdbd-mysql-ruby, mysql-client, rubygems, libhttpclient-ruby1.8 Suggests: mysql-server Recommends: libapache2-mod-passenger Description: Dashboard for Puppet diff --git ext/packaging/debian/default ext/packaging/debian/default new file mode 100644 index 0000000..76be825 --- /dev/null +++ ext/packaging/debian/default @@ -0,0 +1,18 @@ +# Start puppet-dashboard on boot? +START=no + +# the location where puppet-dashboard is installed +#DASHBOARD_HOME=/usr/share/puppet-dashboard + +# the network interface which puppet-dashboard web server is running at +#DASHBOARD_IFACE=0.0.0.0 + +# the port 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 + +# the user which runs the web interface +#DASHBOARD_USER=puppet-dashboard + +# the rails environment in which puppet-dashboard runs +#DASHBOARD_ENV=production diff --git ext/packaging/debian/dirs ext/packaging/debian/dirs index 83a3285..5176672 100644 --- ext/packaging/debian/dirs +++ ext/packaging/debian/dirs @@ -1,5 +1,2 @@ -var/log/puppet-dashboard -var/cache/puppet-dashboard -var/lib/puppet-dashboard -etc/puppet-dashboard +usr/share/puppet-dashboard/log usr/share/puppet-dashboard/tmp diff --git ext/packaging/debian/files ext/packaging/debian/files index 60fbd7c..de9881a 100644 --- ext/packaging/debian/files +++ ext/packaging/debian/files @@ -1 +1 @@ -puppet-dashboard_1.0_all.deb web extra +puppet-dashboard_1.0.3_all.deb web extra diff --git ext/packaging/debian/install ext/packaging/debian/install index 5b8356a..a25dcd2 100644 --- ext/packaging/debian/install +++ ext/packaging/debian/install @@ -2,8 +2,16 @@ app usr/share/puppet-dashboard config usr/share/puppet-dashboard db usr/share/puppet-dashboard +ext usr/share/puppet-dashboard lib usr/share/puppet-dashboard public usr/share/puppet-dashboard +VERSION usr/share/puppet-dashboard +CHANGELOG usr/share/puppet-dashboard +COPYING usr/share/puppet-dashboard +LICENSE usr/share/puppet-dashboard +README.markdown usr/share/puppet-dashboard +README_PACKAGES.markdown usr/share/puppet-dashboard +RELEASE_NOTES.md usr/share/puppet-dashboard Rakefile usr/share/puppet-dashboard script usr/share/puppet-dashboard spec usr/share/puppet-dashboard diff --git ext/packaging/debian/postinst ext/packaging/debian/postinst new file mode 100644 index 0000000..83d1bae --- /dev/null +++ ext/packaging/debian/postinst @@ -0,0 +1,9 @@ +#!/bin/sh -e + +if [ "$1" = "configure" ]; then + for item in config/environment.rb public log tmp; do + chown -R www-data:www-data /usr/share/puppet-dashboard/${item} + done +fi + +#DEBHELPER# diff --git ext/packaging/debian/postrm ext/packaging/debian/postrm new file mode 100644 index 0000000..24dded7 --- /dev/null +++ ext/packaging/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh -e + +if [ "$1" = "purge" ]; then + if test -d /usr/share/puppet-dashboard; then + rm -rf /usr/share/puppet-dashboard + fi +fi + +#DEBHELPER# diff --git ext/packaging/debian/puppet-dashboard.default ext/packaging/debian/puppet-dashboard.default new file mode 100644 index 0000000..721439f --- /dev/null +++ ext/packaging/debian/puppet-dashboard.default @@ -0,0 +1,9 @@ +# IMPORTANT: Be sure you have checked the values below, and configured +# /etc/puppet-dashboard/database.yml appropriately. + +# Uncomment the line below to start Puppet Dashboard. +#dashboard_enabled=yes + +DASHBOARD_HOME=/usr/share/puppet-dashboard +DASHBOARD_RUBY=/usr/bin/ruby +DASHBOARD_ENVIRONMENT=production diff --git ext/packaging/debian/puppet-dashboard.init ext/packaging/debian/puppet-dashboard.init new file mode 100644 index 0000000..548df66 --- /dev/null +++ ext/packaging/debian/puppet-dashboard.init @@ -0,0 +1,86 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: puppet-dashboard +# 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 web server +### END INIT INFO +# +# puppet-dashboard This init.d script is used to start puppet-dashboard. + +ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin" +PIDFILE="/var/run/puppet-dashboard.pid" + +set -e + +. /lib/lsb/init-functions + +test -f /etc/default/rcS && . /etc/default/rcS +test -f /etc/default/puppet-dashboard && . /etc/default/puppet-dashboard + +check_dashboard_enabled_option() { + if [ ! "$dashboard_enabled" = "yes" ]; then + log_warning_msg "Not starting Puppet Dashboard, disabled via /etc/default/puppet-dashboard" + return 1 + else + return 0 + fi +} + +case $1 in + start) + log_daemon_msg "Starting Puppet Dashboard" + if check_dashboard_enabled_option && start-stop-daemon --start --quiet --oknodo --background --make-pidfile --pidfile ${PIDFILE} --user puppet-dashboard --chuid puppet-dashboard --exec ${DASHBOARD_RUBY} -- ${DASHBOARD_HOME}/script/server -e ${DASHBOARD_ENVIRONMENT} >/dev/null 2>&1 ; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping Puppet Dashboard" + if start-stop-daemon --stop --quiet --oknodo --pidfile ${PIDFILE} --user puppet-dashboard -dashboard --retry 10; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + restart) + log_daemon_msg "Restarting Puppet Dashboard" + set +e + start-stop-daemon --stop --quiet --retry 30 --pidfile ${PIDFILE} + RET="$?" + set -e + case ${RET} in + 0) + # Old server stopped + if check_dashboard_enabled_option && start-stop-daemon --start --quiet --oknodo --background --make-pidfile --pidfile ${PIDFILE} --user puppet-dashboard --chuid puppet-dashboard --exec ${DASHBOARD_RUBY} -- ${DASHBOARD_HOME}/script/server -e ${DASHBOARD_ENVIRONMENT} >/dev/null 2>&1 ; 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) + status_of_proc -p ${PIDFILE} ${DASHBOARD_RUBY} "Puppet Dashboard" && exit 0 || exit $? + ;; + *) + log_action_msg "Usage: /etc/init.d/puppet-dashboard {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git ext/packaging/debian/rules ext/packaging/debian/rules index eb48d6c..c6bc952 100755 --- ext/packaging/debian/rules +++ ext/packaging/debian/rules @@ -1,6 +1,10 @@ #!/usr/bin/make -f # -*- makefile -*- +# Uncomment these fllowing lines to display lots of debugging information during the build process: +### export DH_VERBOSE=1 +### export DH_OPTIONS=-v + include /usr/share/cdbs/1/rules/debhelper.mk DEB_UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | cut -d- -f1 ) @@ -9,8 +13,9 @@ TARBALL = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.tar.gz GIT_REVISION := $(shell echo $(DEB_UPSTREAM_VERSION) | awk -F"~" '{ print $$2 }' | sed 's/git//' ) GIT_URL := http://github.com/reductivelabs/puppet-dashboard.git - -binary-install/puppet-dashboard:: +build-install:: + # Copy in example "database.yml" file + cp ../../config/database.yml.example debian/doc/examples/ # Clean up the "extra" license files rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/doc/README_FOR_APP rm -f debian/puppet-dashboard/usr/share/puppet-dashboard/vendor/plugins/*/*LICENSE diff --git ext/packaging/redhat/puppet-dashboard.init ext/packaging/redhat/puppet-dashboard.init index fd97655..0e32061 100644 --- ext/packaging/redhat/puppet-dashboard.init +++ ext/packaging/redhat/puppet-dashboard.init @@ -17,7 +17,7 @@ RETVAL=0 start() { echo -n $"Starting $prog: " - /usr/bin/ruby ${DASHBOARD_HOME}/script/server >/dev/null 2>&1 & + su puppet-dashboard -c '/usr/bin/ruby ${DASHBOARD_HOME}/script/server -e production' >/dev/null 2>&1 & RETVAL=$? if [ $RETVAL = 0 ] then diff --git ext/packaging/redhat/puppet-dashboard.spec ext/packaging/redhat/puppet-dashboard.spec index 080cb52..0d8596f 100644 --- ext/packaging/redhat/puppet-dashboard.spec +++ ext/packaging/redhat/puppet-dashboard.spec @@ -2,63 +2,71 @@ %global initrddir /etc/rc.d/init.d Name: puppet-dashboard -Version: 1.0.0 -Release: 4%{?dist} +Version: 1.0.3 +Release: 3%{?dist} Summary: Systems Management web application Group: Applications/System License: GPLv2+ URL: http://www.puppetlabs.com Source0: http://yum.puppetlabs.com/sources/%{name}-%{version}.tar.gz BuildArch: noarch -Requires: ruby(abi) = 1.8, rubygems, rubygem(rake) +Requires: ruby(abi) = 1.8, rubygems, rubygem-rake, ruby-mysql BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires(post): chkconfig -Requires(preun): chkconfig -Requires(preun): initscripts +Requires(pre): shadow-utils +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts Requires(postun): initscripts %description Puppet Dashboard is a systems management web application for managing Puppet installations and is written using the Ruby on Rails framework. +%pre +getent group puppet-dashboard > /dev/null || groupadd -r puppet-dashboard +getent passwd puppet-dashboard > /dev/null || \ + useradd -r -g puppet-dashboard -d %{_datadir}/puppet-dashboard -s /sbin/nologin \ + -c "Puppet Dashboard" puppet-dashboard +exit 0 + %prep %setup -q %build %install -rm -rf %{buildroot} - -install -p -d -m0755 %{buildroot}%{_datadir}/%{name} -install -p -d -m0755 %{buildroot}%{_datadir}/%{name}/vendor -install -p -d -m0755 %{buildroot}%{_defaultdocdir}/%{name}-%{version} -cp -p -r app bin config db lib public Rakefile script spec %{buildroot}%{_datadir}/%{name} +rm -rf $RPM_BUILD_ROOT + +install -p -d -m0755 $RPM_BUILD_ROOT/%{_datadir}/%{name} +install -p -d -m0755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/log +install -p -d -m0755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/public +install -p -d -m0755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/tmp +install -p -d -m0755 $RPM_BUILD_ROOT/%{_datadir}/%{name}/vendor +install -p -d -m0755 $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}-%{version} +cp -p -r app bin config db ext lib public Rakefile script spec $RPM_BUILD_ROOT/%{_datadir}/%{name} +install -Dp -m0644 config/database.yml.example $RPM_BUILD_ROOT/%{_datadir}/%{name}/config/database.yml +install -Dp -m0644 RELEASE_NOTES.md $RPM_BUILD_ROOT/%{_datadir}/%{name}/RELEASE_NOTES.md +install -Dp -m0644 VERSION $RPM_BUILD_ROOT/%{_datadir}/%{name}/VERSION # Add sysconfig and init script -install -Dp -m0755 %{confdir}/%{name}.init %{buildroot}%{initrddir}/puppet-dashboard -install -Dp -m0644 %{confdir}/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/puppet-dashboard - -# Not all plugins are installed from our source file. -mkdir %{buildroot}%{_datadir}/%{name}/vendor/plugins -for plugin in authlogic inherited_resources jrails object_daddy resources_controller rspec-rails timeline_fu will_paginate; do - cp -p -r vendor/plugins/$plugin %{buildroot}%{_datadir}/%{name}/vendor/plugins/$plugin -done +install -Dp -m0755 %{confdir}/%{name}.init $RPM_BUILD_ROOT/%{initrddir}/puppet-dashboard +install -Dp -m0644 %{confdir}/%{name}.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/puppet-dashboard -cp -p -r vendor/gems %{buildroot}%{_datadir}/%{name}/vendor -cp -p -r vendor/rails %{buildroot}%{_datadir}/%{name}/vendor +cp -p -r vendor $RPM_BUILD_ROOT/%{_datadir}/%{name}/ -chmod a+x %{buildroot}%{_datadir}/%{name}/script/* +chmod a+x $RPM_BUILD_ROOT/%{_datadir}/%{name}/script/* -for file in $(find %{buildroot} -size 0) ; do +for file in $(find $RPM_BUILD_ROOT/ -size 0) ; do rm -f "$file" done -rm -f -r %{buildroot}%{_datadir}/%{name}/.git +rm -f -r $RPM_BUILD_ROOT/%{_datadir}/%{name}/.git mv CHANGELOG timestamp iconv -f ISO-8859-1 -t UTF-8 -o CHANGELOG timestamp -touch -r timestamp CHANGELOG +touch -r timestamp CHANGELOG +rm timestamp %post /sbin/chkconfig --add puppet-dashboard || : @@ -74,17 +82,38 @@ if [ "$1" -ge 1 ]; then /sbin/service puppet-dashboard condrestart >/dev/null 2>&1 || : fi -%clean -rm -rf %{buildroot} - %files %defattr(-,root,root,0755) %{_datadir}/%{name} +%config(noreplace) %{_datadir}/%{name}/config/database.yml %{initrddir}/puppet-dashboard %{_sysconfdir}/sysconfig/puppet-dashboard -%doc CHANGELOG COPYING README.markdown VERSION doc/README_FOR_APP doc/domain-model.graffle doc/domain-model.png +%attr(-,puppet-dashboard,puppet-dashboard) %{_datadir}/%{name}/config/environment.rb +%attr(-,puppet-dashboard,puppet-dashboard) %dir %{_datadir}/%{name}/log +%attr(-,puppet-dashboard,puppet-dashboard) %dir %{_datadir}/%{name}/public +%attr(-,puppet-dashboard,puppet-dashboard) %dir %{_datadir}/%{name}/tmp + +%doc CHANGELOG COPYING README.markdown README_PACKAGES.markdown %changelog +* Fri Jul 30 2010 James Turnbull <ja...@puppetlabs.com> - 1.0.3-3 +- Fixed database.yml error + +* Fri Jul 30 2010 James Turnbull <ja...@puppetlabs.com> - 1.0.3-2 +- Fixed VERSION issue + +* Thu Jul 29 2010 James Turnbull <ja...@puppetlabs.com> - 1.0.3-1 +- Incremented version + +* Sat Jul 15 2010 James Turnbull <ja...@puppetlabs.com> - 1.0.1-2 +- Added MySQL requires +- Configured database.yml file + +* Fri Jul 14 2010 James Turnbull <ja...@puppetlabs.com> - 1.0.1-1 +- Removed rspec-rails plugin +- Removed doc files +- Updated for Puppet Labs 1.0.1 release + * Mon May 03 2010 Todd Zullinger <t...@pobox.com> - 1.0.0-4 - Don't define %%_initrddir, rpm has defined it since the Red Hat Linux days (When RHEL-6 and Fedora-9 are the oldest supported releases, %%_initddir should diff --git lib/tasks/package.rake lib/tasks/package.rake new file mode 100644 index 0000000..6774bf7 --- /dev/null +++ lib/tasks/package.rake @@ -0,0 +1,111 @@ +namespace :package do + desc "Create .deb from this git repository, optionallyh set UNSIGNED=1 to leave unsigned." + task :deb => [:environment, :build_environment] do + build_dir = create_workspace('deb') + + cd build_dir do + cp_r File.join('ext', 'packaging', 'debian'), '.' + cp File.join(RAILS_ROOT, 'config', 'database.yml.example'), File.join('debian', 'doc', 'examples') + cmd = 'dpkg-buildpackage -a' + cmd << ' -us -uc' if ENV['UNSIGNED'] == '1' + + begin + sh cmd + rescue + puts <<-HERE +!! Building the .deb failed! +!! Perhaps you want to run: + + rake package:deb UNSIGNED=1 + HERE + end + end + + desc "Create .rpm from this git repository." + task :rpm => [:environment, :build_environment] do + unless File.exists?(File.expand_path('~/.rpmmacros')) + puts <<-HERE +!! You must setup a ~/.rpmmacros file. +!! You can do this by running: + + rake package:rpm:create_rpmmacros + + HERE + end + + version = File.open('VERSION', 'r').read.sub(/^v/, '').chomp + sh "git archive --format=tar --prefix=puppet-dashboard-#{version}/ HEAD | gzip > ~/rpmbuild/SOURCES/puppet-dashboard-#{version}.tar.gz" + cd File.expand_path("~/rpmbuild/SPECS") do + cp File.join(RAILS_ROOT, 'ext', 'packaging', 'redhat', 'puppet-dashboard.spec'), 'puppet-dashboard.spec' + + cmd = 'rpmbuild -ba' + cmd << ' --sign' unless ENV['UNSIGNED'] == '1' + cmd << ' puppet-dashboard.spec' + + begin + sh cmd + rescue + puts <<-HERE +!! Building the '.rpm's failed! +!! Perhaps you want to run: + + rake package:rpm UNSIGNED=1 + HERE + end + end + + namespace :rpm do + desc "Create ~/.rpmmacros and related directories" + task :create_rpmmacros do + rpmmacro_file = File.expand_path("~/.rpmmacros") + unless File.exists?(rpmmacro_file) + rpmmacro = " +%{_topdir} #{File.expand_path("~/rpmbuild")} +%{_builddir} %{_topdir}/BUILD +%{_rpmdir} %{_topdir}/RPMS +%{_sourcedir} %{_topdir}/SOURCES +%{_specdir} %{_topdir}/SPECS +%{_srcrpmdir} %{_topdir}/SRPMS +%{_buildrootdir} %{_topdir}/BUILDROOT + +%{buildroot} %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch} +$RPM_BUILD_ROOT %{buildroot} +" + File.open(rpmmacro_file, "w") {|f| f.write(rpmmacro)} + end + + %w{builddir rpmdir sourcedir specdir srcrpmdir buildrootdir}.each do |dir| + sh %Q|mkdir -p $(rpmbuild -E '%{_#{dir}}' #{File.join(RAILS_ROOT, 'ext', 'packaging', 'redhat', 'puppet-dashboard.spec')} 2> /dev/null)| + end + end + end + + task :build_environment do + unless ENV['FORCE'] == '1' + modified = `git status --porcelain | sed -e '/^\?/d'` + if modified.split(/\n/).length != 0 + puts <<-HERE +!! ERROR: Your git working directory is not clean. You must +!! remove or commit your changes before you can create a package: + +#{`git status | grep '^#'`.chomp} + +!! To override this check, set FORCE=1 -- e.g. `rake package:deb FORCE=1` + HERE + raise + end + end + end + + def create_workspace(package_type) + work = File.expand_path(File.join(RAILS_ROOT, 'tmp', 'packages', package_type)) + build = File.join(work, 'build') + + rm_rf work + mkdir_p work + + sh "git checkout-index -a -f --prefix=#{build}/" + + return build + end +end diff --git public/stylesheets/sass/application.scss~ public/stylesheets/sass/application.scss~ deleted file mode 100644 index cc048a7..0000000 --- public/stylesheets/sass/application.scss~ +++ /dev/null @@ -1,300 +0,0 @@ -/* - IMPORTANT: This stylesheet is processed using SASS! - - Edit this file: - public/stylesheets/sass/application.scss - - And after a Rails action, it'll generate a fresh copy of: - public/stylesheets/application.css - - Be sure to edit the right file, all changes to the .css file will be lost! -*/ - -/* omg; */ - -...@mixin buttony { - background: #5c80a8 -moz-linear-gradient(top, #638ab5, #55779c); - background: #5c80a8 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#638ab5), to(#55779c)); - border: 1px solid #DDD; - border-color: #FFF #AAA #AAA #FFF; - color: white; - cursor: pointer; - font-size: 1.1em; - line-height: 1.5em; - margin: 0.25em; - padding: 0 .5em; - -webkit-border-radius: 0.35em; - -moz-border-radius: 0.35em; - border-radius: 0.35em; } - -body { - background: #e8eef0; - color: #444; - min-width: 800px; - - #content { - padding: 1.5em 0 2em; } - - #footer p { - clear: both; - padding-top: 1em; - color: #777; } - - a#logo { - background: transparent url('../images/dashboard_logo.png') no-repeat top center; - text-indent: -9000px; - display: block; - height: 23px; - width: 155px; - position: relative; - top: 1px; - &:hover { - background-position: bottom center; } } - - ol.timeline li { - list-style-type: none; - padding-left: 20px; - margin-bottom: 5px; - position: relative; - span.date { - color: #666; - display: inline-block; - width: 9em; } } - - ul.status { - list-style: none; } - - span.sparkline { - vertical-align: bottom; } - - div.flot-graph { - margin-bottom: 10px; - width: 100%; } - - a.button { - display: inline-block; } - - a.button, button { - @include buttony; - - &:hover { - text-decoration: none; - background: #6a94c2 -moz-linear-gradient(top, #719dcf, #638ab5); - background: #6a94c2 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#719dcf), to(#638ab5)); - color: yellow; } - - &:active { - background: -moz-linear-gradient(top, #476382, #55769c); - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#476382), to(#55769c)); } - } - - .actions { - font-size: 12px; } - - /* SIDEBAR */ - - #content #sidebar { - .group { - position: relative; - border: 1px solid #DDD; - background: #FFF; - margin: 0 .5em 0.5em 0; - -webkit-border-radius: .2em; - -moz-border-radius: .2em; - border-radius: .2em; - h3 { - color: #444; - line-height: 1.25em; - position: relative; - display: block; - background: #DDD; - &.active { - background: #d2dde5; } - a { - display: block; - padding: .25em .5em; } } - span.count { - display: block; - position: absolute; - right: 3px; - top: 3px; - color: #FFF; - font-size: 12px; - padding: 0 .4em; - text-align: center; - background: #CCC; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; } - li span.count { - background: #DDD; } - ul { - max-height: 20em; - overflow: auto; - border-top: 1px solid #D8D8D8; - li { - position: relative; - font-size: 12px; - border-bottom: 1px solid #EEE; - &:last-child { - border: 0; } - &.active { - background: #e2edf5; } - a { - padding: .25em .5em; - display: block; } } } } - a.fold { - width: 1em; - display: inline-block; - text-align: center; - font-size: 14px; - font-weight: bold; } - ul { - list-style: none; } } - - /* ACTIONBAR */ - - .actionbar { - background: #DDD; - padding: 1px; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - .pagination { - font-size: 12px; - padding: .1em .5em; - float: right; } - ul { - float: left; - list-style: none; - margin-right: .25em; - li { - float: left; - position: relative; - &:first-child { - button, a.button { - -webkit-border-top-right-radius: 0px; - -webkit-border-bottom-right-radius: 0px; - -moz-border-radius-topright: 0px; - -moz-border-radius-bottomright: 0px; - border-top-right-radius: 0px; - border-bottom-right-radius: 0px; } } - &:last-child { - button, a.button { - -webkit-border-top-left-radius: 0px; - -webkit-border-bottom-left-radius: 0px; - -moz-border-radius-topleft: 0px; - -moz-border-radius-bottomleft: 0px; - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; } } - &:only-child { - button, a.button { - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; } } } } } - - .navigation { - position: relative; } - - button.drop:after, a.drop:after { - content: " \002193"; } - - ul li .dropdown { - /* drop down menu */ - display: none; - left: 0; - position: absolute; - top: 1.5em; - background: #FFF; - border: 1px solid #CCC; - color: #666; - font-size: 14px; - width: 15em; - z-index: 7; } - - .actionbar .dropdown { - top: 1.75em; } - - ul li .dropdown ul { - width: 100%; - margin-bottom: .25em; - max-height: 30em; - overflow: auto; } - - .dropdown { - li { - list-style: none; - a { - display: block; - padding: .2em .5em; } } - .actions { - border-top: 1px solid #DDD; - background-color: #EEE; - clear: both; - padding: .25em .5em; } - input { - display: inline; - vertical-align: middle; } } - - .actionbar { - form { - padding: .25em; } - #add_node { - margin: 2px 2px 1px; - form { - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; } } } - - .clear { - clear: both; } - - .header { - background: #DDD; - padding: 0; - margin: 0; - position: relative; - h2, input { - border: 1px solid transparent; - margin: 0 2px; - padding: 0 .25em; - line-height: 1.333em; } } - - .item { - background: #FFF; - padding: 1em; - margin-bottom: 1em; - overflow: hidden; } - - .section { - margin-bottom: 1em; - &.error, &.warning { - padding: 10px 10px 0; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; } - &.error { - background: #FDD; - border: 1px solid #FCC; - color: #433; } - &.warning { - background: #DDD; - border: 1px solid #CCC; - color: #444; } - &.error h3 { - margin: -10px -10px .5em; - padding: .5em 10px .5em 26px; - background: #ffcccc url(images/icons/failure.png) 8px center no-repeat; - color: #433; } - &.warning h3 { - margin: -10px -10px .5em; - padding: .5em 10px; - background: #cccccc url(images/icons/warning.png) 8px center no-repeat; - color: #444; } } - - .half { - width: 45%; - margin-right: 5%; - float: left; } -} - diff --git vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak deleted file mode 100644 index 6940419..0000000 --- vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +++ /dev/null @@ -1 +0,0 @@ -Ignored when searching for implicitly multipart parts. diff --git vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ deleted file mode 100644 index 946d99e..0000000 --- vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +++ /dev/null @@ -1,10 +0,0 @@ -<html> - <body> - HTML formatted message to <strong><%= @recipient %></strong>. - </body> -</html> -<html> - <body> - HTML formatted message to <strong><%= @recipient %></strong>. - </body> -</html> diff --git vendor/rails/actionpack/test/fixtures/test/hello_world.erb~ vendor/rails/actionpack/test/fixtures/test/hello_world.erb~ deleted file mode 100644 index 21934a1..0000000 --- vendor/rails/actionpack/test/fixtures/test/hello_world.erb~ +++ /dev/null @@ -1 +0,0 @@ -Don't pick me! \ No newline at end of file diff --git vendor/rails/actionpack/test/fixtures/test/malformed/malformed.en.html.erb~ vendor/rails/actionpack/test/fixtures/test/malformed/malformed.en.html.erb~ deleted file mode 100644 index d009950..0000000 --- vendor/rails/actionpack/test/fixtures/test/malformed/malformed.en.html.erb~ +++ /dev/null @@ -1 +0,0 @@ -Don't render me! \ No newline at end of file diff --git vendor/rails/actionpack/test/fixtures/test/malformed/malformed.erb~ vendor/rails/actionpack/test/fixtures/test/malformed/malformed.erb~ deleted file mode 100644 index d009950..0000000 --- vendor/rails/actionpack/test/fixtures/test/malformed/malformed.erb~ +++ /dev/null @@ -1 +0,0 @@ -Don't render me! \ No newline at end of file diff --git vendor/rails/actionpack/test/fixtures/test/malformed/malformed.html.erb~ vendor/rails/actionpack/test/fixtures/test/malformed/malformed.html.erb~ deleted file mode 100644 index d009950..0000000 --- vendor/rails/actionpack/test/fixtures/test/malformed/malformed.html.erb~ +++ /dev/null @@ -1 +0,0 @@ -Don't render me! \ No newline at end of file -- Jacob Helwig
signature.asc
Description: Digital signature