From 2ff03ab2613aabf8d69301993c9c04f4f8e56bd3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Fri, 7 Mar 2014 17:20:13 +0100 Subject: [PATCH] Packaging of rOCCI server for wheezy. --- rocci-server/debian/README.Debian | 17 +++++ rocci-server/debian/compat | 1 + rocci-server/debian/control | 22 ++++++ rocci-server/debian/copyright | 24 ++++++ rocci-server/debian/dirs | 1 + .../debian/etc/apache2/conf.d/rocci-server | 1 + rocci-server/debian/install | 25 ++++++ rocci-server/debian/links | 2 + rocci-server/debian/patches/bundler.patch | 52 +++++++++++++ rocci-server/debian/patches/series | 2 + rocci-server/debian/patches/unbundle.patch | 89 ++++++++++++++++++++++ rocci-server/debian/postinst | 56 ++++++++++++++ rocci-server/debian/postrm | 16 ++++ rocci-server/debian/preinst | 7 ++ rocci-server/debian/rules | 19 +++++ rocci-server/debian/source/format | 1 + rocci-server/gen-rocci-server.sh | 36 +++++++++ 17 files changed, 371 insertions(+) create mode 100644 rocci-server/debian/README.Debian create mode 100644 rocci-server/debian/compat create mode 100644 rocci-server/debian/control create mode 100644 rocci-server/debian/copyright create mode 100644 rocci-server/debian/dirs create mode 100644 rocci-server/debian/etc/apache2/conf.d/rocci-server create mode 100644 rocci-server/debian/install create mode 100644 rocci-server/debian/links create mode 100644 rocci-server/debian/patches/bundler.patch create mode 100644 rocci-server/debian/patches/series create mode 100644 rocci-server/debian/patches/unbundle.patch create mode 100644 rocci-server/debian/postinst create mode 100644 rocci-server/debian/postrm create mode 100644 rocci-server/debian/preinst create mode 100755 rocci-server/debian/rules create mode 100644 rocci-server/debian/source/format create mode 100755 rocci-server/gen-rocci-server.sh diff --git a/rocci-server/debian/README.Debian b/rocci-server/debian/README.Debian new file mode 100644 index 0000000..6e9dde1 --- /dev/null +++ b/rocci-server/debian/README.Debian @@ -0,0 +1,17 @@ +Configurations +============== + +/etc/rocci-server +/etc/apache2/site-available/occi-ssl + +Automatically launched setup +============================ + +# rocci-server +a2enmod ssl +a2ensite occi-ssl +service apache2 restart + +# ruby-passenger +a2enmod passenger +service apache2 restart diff --git a/rocci-server/debian/compat b/rocci-server/debian/compat new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/rocci-server/debian/compat @@ -0,0 +1 @@ +8 diff --git a/rocci-server/debian/control b/rocci-server/debian/control new file mode 100644 index 0000000..c2e4cf3 --- /dev/null +++ b/rocci-server/debian/control @@ -0,0 +1,22 @@ +Source: rocci-server +Section: ruby +Priority: optional +Maintainer: František Dvořák +Standards-Version: 3.9.4 +Build-Depends: debhelper (>= 8), bundler, git, ca-certificates, ruby-dev, libssl-dev, rake, ruby-redcarpet, yard +# gem2deb - not working with local deps +Vcs-Browser: https://github.com/EGI-FCTF/rOCCI-server +Vcs-Git: https://github.com/EGI-FCTF/rOCCI-server.git +#XS-Ruby-Versions: ruby1.9.1 + +Package: rocci-server +Architecture: any +#XB-Ruby-Versions: ${ruby:Versions} +Depends: ${misc:Depends}, ruby | ruby-interpreter, bundler, memcached +Recommends: libapache2-mod-passenger (>= 4.0.29) +Description: Ruby OCCI Server + OCCI (the Open Cloud Computing Interface) is a standard by the Open Grid Forum, + specifying a protocol and API to perform various remote management tasks in + clouds. The rOCCI-server extends cloud managers, which are not OCCI-compliant + natively, with its own OCCI interface. It is based on the rOCCI (Ruby OCCI) + Framework. diff --git a/rocci-server/debian/copyright b/rocci-server/debian/copyright new file mode 100644 index 0000000..5eaea21 --- /dev/null +++ b/rocci-server/debian/copyright @@ -0,0 +1,24 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: rOCCI-server +Files: * +Copyright: Copyright (c) 2013 GWDG, CESNET +License: Apache 2.0 + +License: Apache 2.0 + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the full text of the Apache Software License version 2 can + be found in the file `/usr/share/common-licenses/Apache-2.0'. diff --git a/rocci-server/debian/dirs b/rocci-server/debian/dirs new file mode 100644 index 0000000..3936561 --- /dev/null +++ b/rocci-server/debian/dirs @@ -0,0 +1 @@ +usr/lib/rocci-server diff --git a/rocci-server/debian/etc/apache2/conf.d/rocci-server b/rocci-server/debian/etc/apache2/conf.d/rocci-server new file mode 100644 index 0000000..3666ef3 --- /dev/null +++ b/rocci-server/debian/etc/apache2/conf.d/rocci-server @@ -0,0 +1 @@ +Listen 11443 diff --git a/rocci-server/debian/install b/rocci-server/debian/install new file mode 100644 index 0000000..7d4ace1 --- /dev/null +++ b/rocci-server/debian/install @@ -0,0 +1,25 @@ +.bundle usr/lib/rocci-server +app usr/lib/rocci-server +bin usr/lib/rocci-server +config usr/lib/rocci-server +db usr/lib/rocci-server +etc usr/lib/rocci-server +lib usr/lib/rocci-server +# XXX: this should be /var/log +log usr/lib/rocci-server +public usr/lib/rocci-server +spec usr/lib/rocci-server +test usr/lib/rocci-server +# XXX: dirty hack - bundle all gems +vendor usr/lib/rocci-server +Capfile usr/lib/rocci-server +Rakefile usr/lib/rocci-server +Gemfile usr/lib/rocci-server +Gemfile.lock usr/lib/rocci-server +Guardfile usr/lib/rocci-server +config.ru usr/lib/rocci-server + +# prepare configuration +debian/occi-ssl etc/apache2/sites-available +debian/occi-ssl usr/lib/doc/rocci-server/examples/etc/apache2/sites-available +debian/etc . diff --git a/rocci-server/debian/links b/rocci-server/debian/links new file mode 100644 index 0000000..e0b9a01 --- /dev/null +++ b/rocci-server/debian/links @@ -0,0 +1,2 @@ +# no FHS support, just point /etc/rocci-server to proper place +usr/lib/rocci-server/etc etc/rocci-server diff --git a/rocci-server/debian/patches/bundler.patch b/rocci-server/debian/patches/bundler.patch new file mode 100644 index 0000000..b1e458e --- /dev/null +++ b/rocci-server/debian/patches/bundler.patch @@ -0,0 +1,52 @@ +commit 55aa8051ff0998f2b43b1ebd6ed4425990fa322c +Author: František Dvořák +Date: Fri Mar 7 13:14:19 2014 +0100 + + Patch for compatibility with Debian 7 bundler. + +diff --git a/Gemfile.lock b/Gemfile.lock +index 8dc2ef3..5a40d60 100644 +--- a/Gemfile.lock ++++ b/Gemfile.lock +@@ -13,20 +13,6 @@ GIT + specs: + openssl_cms_1_9_3 (0.0.2) + +-GIT +- remote: https://github.com/arax/openssl-cms.git +- revision: 7fea071f542ff1cb57c28dffe623122848ed3f99 +- branch: ruby_2_0_0 +- specs: +- openssl_cms_2_0_0 (0.0.2) +- +-GIT +- remote: https://github.com/arax/openssl-cms.git +- revision: b789b696d821bd6563dd207fb6b562c06acc835b +- branch: ruby_2_1 +- specs: +- openssl_cms_2_1 (0.0.2) +- + GEM + remote: https://rubygems.org/ + specs: +@@ -275,8 +261,6 @@ DEPENDENCIES + occi-core (~> 4.2.10) + opennebula (~> 4.4.0) + openssl_cms_1_9_3! +- openssl_cms_2_0_0! +- openssl_cms_2_1! + passenger (= 4.0.29) + pry-rails + pry-rescue +diff --git a/lib/authentication_strategies/bundles/Gemfile.keystone b/lib/authentication_strategies/bundles/Gemfile.keystone +index 7abebc5..cbce134 100644 +--- a/lib/authentication_strategies/bundles/Gemfile.keystone ++++ b/lib/authentication_strategies/bundles/Gemfile.keystone +@@ -2,7 +2,3 @@ + #raise "KeystoneStrategy requires CRuby!" unless RUBY_ENGINE == "ruby" + + gem "openssl_cms_1_9_3", git: 'https://github.com/arax/openssl-cms.git', branch: 'ruby_1_9_3', require: false, platforms: :ruby_19 +- +-gem "openssl_cms_2_0_0", git: 'https://github.com/arax/openssl-cms.git', branch: 'ruby_2_0_0', require: false, platforms: :ruby_20 +- +-gem "openssl_cms_2_1", git: 'https://github.com/arax/openssl-cms.git', branch: 'ruby_2_1', require: false, platforms: :ruby_21 diff --git a/rocci-server/debian/patches/series b/rocci-server/debian/patches/series new file mode 100644 index 0000000..3414ba9 --- /dev/null +++ b/rocci-server/debian/patches/series @@ -0,0 +1,2 @@ +bundler.patch +unbundle.patch diff --git a/rocci-server/debian/patches/unbundle.patch b/rocci-server/debian/patches/unbundle.patch new file mode 100644 index 0000000..669a800 --- /dev/null +++ b/rocci-server/debian/patches/unbundle.patch @@ -0,0 +1,89 @@ +commit 1eccf855b481ff7867f30f3571b57082ad2ffaa7 +Author: František Dvořák +Date: Fri Mar 7 13:16:09 2014 +0100 + + Use system passenger, rake, yard and redcarpet. + +diff --git a/Gemfile b/Gemfile +index 43fb151..af98c4b 100644 +--- a/Gemfile ++++ b/Gemfile +@@ -25,9 +25,6 @@ gem 'debugger', group: [:development, :test] + # Use whenever for scheduled jobs + gem 'whenever', require: false + +-# Use passenger for deployment (standalone or in Apache2) +-gem 'passenger', '= 4.0.29' +- + # Use simplecov for coverage reports + gem 'simplecov', group: [:development, :test] + +@@ -49,10 +46,6 @@ gem 'guard-rails', group: :development + gem 'rb-inotify', require: false, group: :development + gem 'libnotify', group: :development + +-# Use YARD for documentation +-gem 'yard', group: :development +-gem 'redcarpet', group: :development +- + # Use bond+hirb to extend irb + # + # Add the following to your ~/.irbrc: +diff --git a/Gemfile.lock b/Gemfile.lock +index 5a40d60..14a5367 100644 +--- a/Gemfile.lock ++++ b/Gemfile.lock +@@ -139,10 +139,6 @@ GEM + opennebula (4.4.0) + json + nokogiri +- passenger (4.0.29) +- daemon_controller (>= 1.1.0) +- rack +- rake (>= 0.8.1) + polyglot (0.3.4) + pry (0.9.12.6) + coderay (~> 1.0) +@@ -173,15 +169,12 @@ GEM + railties (4.0.3) + actionpack (= 4.0.3) + activesupport (= 4.0.3) +- rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) +- rake (10.1.1) + rb-fsevent (0.9.4) + rb-inotify (0.9.3) + ffi (>= 0.5.0) + rdoc (4.1.1) + json (~> 1.4) +- redcarpet (3.1.1) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) +@@ -236,7 +229,6 @@ GEM + whenever (0.9.2) + activesupport (>= 2.3.4) + chronic (>= 0.6.3) +- yard (0.8.7.3) + + PLATFORMS + ruby +@@ -261,18 +253,15 @@ DEPENDENCIES + occi-core (~> 4.2.10) + opennebula (~> 4.4.0) + openssl_cms_1_9_3! +- passenger (= 4.0.29) + pry-rails + pry-rescue + pry-stack_explorer + rails (~> 4.0.0) + rails-api (~> 0.2.0) + rb-inotify +- redcarpet + rspec-rails + rvm-capistrano + sdoc + simplecov + warden + whenever +- yard diff --git a/rocci-server/debian/postinst b/rocci-server/debian/postinst new file mode 100644 index 0000000..c474216 --- /dev/null +++ b/rocci-server/debian/postinst @@ -0,0 +1,56 @@ +#!/bin/sh +set -e + +case "$1" in +configure|reconfigure) + ;; +*) + exit 0 + ;; +esac + +conf="/etc/apache2/sites-available/occi-ssl" +econf="/etc/apache2/sites-enabled/occi-ssl" +hname=`hostname -f` || hname="" + + +reload_apache() +{ + if apache2ctl configtest 2>/dev/null; then + invoke-rc.d apache2 force-reload || true + else + echo "Your apache2 configuration is broken, not restarted." + fi +} + + +# logs +chown -R nobody:nogroup /usr/lib/rocci-server/log + +# hostname in configuration +if [ -n "$hname" ]; then + sed -i \ + -e "s,^\(\s*SetEnv\s*ServerName\s*\),\1$hname," \ + -e "s,^\(\s*SetEnv\s*ROCCI_SERVER_HOSTNAME\s*\),\1$hname," \ + $conf +else + echo "Hostname could not be determined! Please update 'ServerName' and 'ROCCI_SERVER_HOSTNAME' in $conf." +fi + +# apache reload +if [ -n "$2" ]; then +# we're upgrading. test if we're enabled, and if so, restart to reload the module. + if [ -e "$econf" ]; then + reload_apache + fi + exit 0 +fi + +if [ -e /etc/apache2/apache2.conf ]; then +# enable the site and SSL module + a2enmod ssl >/dev/null || : + a2ensite occi-ssl >/dev/null || : + reload_apache +fi + +#DEBHELPER# diff --git a/rocci-server/debian/postrm b/rocci-server/debian/postrm new file mode 100644 index 0000000..7c9d63e --- /dev/null +++ b/rocci-server/debian/postrm @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +case "$1" in +remove|purge) + ;; +*) + exit 0 + ;; +esac + +if [ -e /etc/apache2/apache2.conf ]; then + a2dissite occi-ssl || : +fi + +#DEBHELPER# diff --git a/rocci-server/debian/preinst b/rocci-server/debian/preinst new file mode 100644 index 0000000..7724d44 --- /dev/null +++ b/rocci-server/debian/preinst @@ -0,0 +1,7 @@ +#!/bin/sh +set -e + +getent group rocci >/dev/null || addgroup --system rocci +getent passwd rocci >/dev/null || adduser --system --group --home /usr/lib/rocci-server rocci + +#DEBHELPER# diff --git a/rocci-server/debian/rules b/rocci-server/debian/rules new file mode 100755 index 0000000..9f3b843 --- /dev/null +++ b/rocci-server/debian/rules @@ -0,0 +1,19 @@ +#!/usr/bin/make -f +#export DH_VERBOSE=1 + +# not using "dh $@ --setubprb ?? --buildsystem=ruby --with ruby", we want locally deployed deps + +p_name=rocci-server + +binary: + sed examples/etc/apache2/sites-available/occi-ssl \ + -e 's,\(DocumentRoot\|Directory\).*\(/public\),\1 /usr/lib/rocci-server\2,i' \ + > debian/occi-ssl + dh $@ + +build: + bundle install --deployment --standalone --without 'test development' + dh $@ + +%: + dh $@ diff --git a/rocci-server/debian/source/format b/rocci-server/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/rocci-server/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/rocci-server/gen-rocci-server.sh b/rocci-server/gen-rocci-server.sh new file mode 100755 index 0000000..ff5a894 --- /dev/null +++ b/rocci-server/gen-rocci-server.sh @@ -0,0 +1,36 @@ +#! /bin/sh -e + +# +# Use these commands to create source package: +# +# rm -rf rOCCI-server +# ./gen-rocci-server.sh -S -uc -us +# + +if [ -d rOCCI-server ]; then + echo "WARNING: rOCCI-server directory already exists!" +else + git clone https://github.com/EGI-FCTF/rOCCI-server.git +fi + +cd rOCCI-server + +uver=`grep "\ ../rocci-server_$ver.orig.tar.gz + +cp -rp ../debian . +cat < debian/changelog +rocci-server (${ver}-${age}) stable; urgency=low + + * Debian packaging + + -- $maint `date "+%a, %d %b %Y %H:%M:%S %z"` +EOF + +dpkg-buildpackage $@ -- 1.8.2.3