diff --git a/.gitignore b/.gitignore index b70004eb..2665d5a7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,10 @@ build .cache *.swp doc/html +debian/files +debian/libra.debhelper.log +debian/libra.postinst.debhelper +debian/libra.preinst.debhelper +debian/libra.prerm.debhelper +debian/libra.substvars +debian/libra/ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..1dcc74db --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +libra (1.0-1) UNRELEASED; urgency=low + + * Initial release. + + -- Andrew Hutchings Thu, 16 Nov 2012 14:26:59 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..390f3077 --- /dev/null +++ b/debian/control @@ -0,0 +1,16 @@ +Source: libra +Section: python +Priority: optional +Maintainer: Andrew Hutchings (LinuxJedi) +Build-Depends: debhelper (>=9), python-support (>=1.0), cdbs (>=0.4.111), python-all-dev, python-eventlet (>=0.9), python-gearman (>=2.0), python-daemon (>=1.5), python-novaclient (>=2.9), python-requests (>=0.12) +Build-Depends-Indep: python-sphinx (>=1.0), rst2pdf (>=0.16) +Standards-Version: 3.9.4 +Homepage: https://launchpad.net/libra + +Package: libra +Architecture: all +XB-Python-Version: ${python-Versions} +Depends: ${misc:Depends}, ${python:Depends} +Provides: ${python:Provides} +Description: Tools for an Openstack Load Balancer as a Service + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..ec90da0d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: libra +Source: https://launchpad.net/libra/ + +Files: * +Copyright: 2012 Hewlett-Packard Development Company, L.P. +License: Apache 2.0 + Licensed 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 complete text of the Apache License 2.0 can + be found in "/usr/share/common-licenses/Apache-2.0" diff --git a/debian/libra.postinst b/debian/libra.postinst new file mode 100755 index 00000000..f3209ea7 --- /dev/null +++ b/debian/libra.postinst @@ -0,0 +1,25 @@ +#!/bin/sh + +set -e + +if [ "$1" = "configure" ]; then + if [ -z "`id -u libra 2> /dev/null`" ]; then + adduser --system --group --home /usr/lib/libra --gecos "Libra load balancer" \ + --no-create-home --disabled-password --quiet libra || true + fi + + ucf --three-way /usr/share/libra/sample_libra.cfg /etc/libra.cfg + + if [ ! -d /var/log/libra ]; then + mkdir /var/log/libra + chown libra:libra /var/log/libra + fi + + if [ ! -d /var/run/libra ]; then + mkdir /var/run/libra + chown libra:libra /var/run/libra + fi + +fi + +#DEBHELPER# diff --git a/debian/libra_pool_mgm.upstart b/debian/libra_pool_mgm.upstart new file mode 100644 index 00000000..14a613d3 --- /dev/null +++ b/debian/libra_pool_mgm.upstart @@ -0,0 +1,12 @@ +description "pool_mgm" + +start on (net-device-up + and local-filesystems + and runlevel [2345]) +stop on runlevel [!2345] + +script + libra_pool_mgm -c /etc/libra.cfg + +end script + diff --git a/etc/libra_worker.conf b/debian/libra_worker.upstart similarity index 56% rename from etc/libra_worker.conf rename to debian/libra_worker.upstart index 948ba8c3..16983710 100644 --- a/etc/libra_worker.conf +++ b/debian/libra_worker.upstart @@ -6,10 +6,7 @@ start on (net-device-up stop on runlevel [!2345] script - mkdir /var/run/libra - chown haproxy /var/run/libra - chgrp haproxy /var/run/libra - libra_worker -c /etc/libra.cnf + libra_worker -c /etc/libra.cfg end script diff --git a/debian/pyversions b/debian/pyversions new file mode 100644 index 00000000..3ad2293e --- /dev/null +++ b/debian/pyversions @@ -0,0 +1 @@ +2.7- diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..6eac57fc --- /dev/null +++ b/debian/rules @@ -0,0 +1,11 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +WITH_PYTHON2 = $(shell test -f /usr/bin/dh_python2 && echo "--with python2") + +%: + dh $@ ${WITH_PYTHON2} + +override_dh_installinit: + dh_installinit --name=libra_worker + dh_installinit --name=libra_pool_mgm --no-start diff --git a/etc/sample_libra.cfg b/etc/sample_libra.cfg index 50eb8943..f159a897 100644 --- a/etc/sample_libra.cfg +++ b/etc/sample_libra.cfg @@ -24,8 +24,8 @@ verbose = true # The [worker] section is specific to the libra_worker utility. [worker] -user = haproxy -group = haproxy +user = libra +group = libra driver = haproxy reconnect_sleep = 60 stats_poll = 300 @@ -36,9 +36,11 @@ logfile = /var/log/libra/libra_worker.log # The [mgm] section is specific to the libra_mgm utility. [mgm] +user = libra +group = libra pid = /var/run/libra/libra_mgm.pid logfile = /var/log/libra/libra_mgm.log -datadir = /etc/libra/ +datadir = /var/run/libra/ nova_auth_url = https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/ nova_user = username nova_pass = password diff --git a/setup.py b/setup.py index b1761184..0a257115 100644 --- a/setup.py +++ b/setup.py @@ -83,5 +83,8 @@ setuptools.setup( cmdclass=ci_cmdclass, tests_require=tests_requires, install_requires=requires, - setup_requires=setup_reqs + setup_requires=setup_reqs, + data_files=[ + ('share/libra/', ['etc/sample_libra.cfg']) + ] )