Adding packaging and debian instructions

Creates 2 debian packages from source.
    aic-valet-core (main pkg: API, engine)
    aic-valet-openstack-plugins (heat lifecycle plugin, nova scheduler filter)

Change-Id: I473ca046c432cd3383388987e1fe7e5a737e8ddb
This commit is contained in:
Omar Rivera 2017-08-16 13:45:53 -05:00
parent 8d11af2357
commit 285e4297df
23 changed files with 252 additions and 51 deletions

4
debian/aic-valet-core.dirs vendored Normal file
View File

@ -0,0 +1,4 @@
/var/lib/valet
/var/log/valet
/var/log/apache2/valet
/var/run/valet

0
debian/aic-valet-core.docs vendored Normal file
View File

6
debian/aic-valet-core.install vendored Normal file
View File

@ -0,0 +1,6 @@
valet/valet/api/app.wsgi var/www/valet/
valet/valet/api/config.py var/www/valet/
valet/etc/apache2/180-valet.conf etc/apache2/sites-available/
valet/etc/valet/valet.conf etc/valet/
valet/tools/utils/* opt/app/valet/tools/
valet/bin/valet-engine usr/bin

12
debian/aic-valet-core.logrotate vendored Normal file
View File

@ -0,0 +1,12 @@
/var/log/apache2/valet/*.log
/var/log/valet/*.log
{
daily
rotate 14
compress
delaycompress
missingok
copytruncate
notifempty
}

16
debian/aic-valet-core.postinst vendored Normal file
View File

@ -0,0 +1,16 @@
chown -R valet:valet /etc/valet
chmod 0750 /etc/valet
chown -R valet:valet /opt/app/valet/tools
chmod 755 /opt/app/valet/tools/*
chown valet:valet /var/log/valet
chmod 0750 /var/log/valet
chown valet:valet /var/run/valet
chown valet:valet /var/www/valet/app.wsgi
chown valet:valet /var/www/valet/config.py
find /var/lib/valet -xdev -type d -exec chown valet:valet {} \;
ln -s /etc/apache2/sites-available/180-valet.conf /etc/apache2/sites-enabled/180-valet.conf

16
debian/aic-valet-core.postrm vendored Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
set -e
case "$1" in
purge)
# Remove swift user if possible
userdel valet || true
rm -rf /var/lib/valet
;;
esac
#DEBHELPER#
exit 0

47
debian/aic-valet-core.preinst vendored Normal file
View File

@ -0,0 +1,47 @@
#!/bin/sh
set -e
case "$1" in
install|upgrade)
# create the valet group
if ! getent group valet > /dev/null 2>&1
then
addgroup --system valet >/dev/null
fi
# create the valet user to avoid running as root
if ! getent passwd valet > /dev/null 2>&1
then
adduser --quiet \
--system \
--home /var/lib/valet \
--no-create-home \
--ingroup valet \
--shell /bin/false \
valet
fi
if [ "$(id -gn valet)" = "nogroup" ]
then
usermod -g valet valet
fi
;;
configure)
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

13
debian/aic-valet-core.prerm vendored Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
set -e
case $1 in
remove|purge)
unlink /etc/apache2/sites-enabled/180-valet.conf
service apache2 restart
;;
esac
#DEBHELPER#

View File

View File

@ -0,0 +1,4 @@
#!/bin/sh
ln -s /usr/lib/python2.7/dist-packages/valet/valet/plugins/nova/valet_filter.py /usr/lib/python2.7/dist-packages/nova/scheduler/filters/valet_filter.py

View File

@ -0,0 +1,3 @@
#!/bin/sh
unlink /usr/lib/python2.7/dist-packages/nova/scheduler/filters/valet_filter.py

12
debian/changelog vendored Normal file
View File

@ -0,0 +1,12 @@
aic-valet-core (1.0.0-00) stable; urgency=low
* This is Valet release 1.0.0-00
-- Jenkins job <jenkins@unknown> Thu, 23 Jun 2016 14:48:02 +0000
aic-valet-openstack-plugins (1.0.0-00) stable; urgency=low
* This is Valet release 1.0.0-00
-- Jenkins job <jenkins@unknown> Thu, 23 Jun 2016 14:48:02 +0000

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

43
debian/control vendored Normal file
View File

@ -0,0 +1,43 @@
Source: aic-valet-core
Section: python
Priority: optional
Maintainer: valet <valet@intl.att.com>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 1.0.0
XS-Python-Version: >= 2.7
Homepage: https://valet.research.att.com
Package: aic-valet-core
Architecture: any
Depends:
apache2,
libapache2-mod-wsgi,
python-dev,
python-keystoneauth,
python-keystoneauth1,
python-keystoneclient,
python-notario,
python-novaclient,
python-oslo.config,
python-oslo.context,
python-oslo.i18n,
python-oslo.log,
python-oslo.messaging,
python-oslo.middleware,
python-oslo.serialization,
python-oslo.utils,
python-pbr (>=1.8),
python-pecan,
python-pecan-notario,
python-pika,
python-positional,
python-simplejson,
python-six,
python-tz
Description: Valet OpenStack service application
Package: aic-valet-openstack-plugins
Architecture: any
Depends: python-nova, python-heat
Description: Valet plugins for the OpenStack scheduler and orchestration services

35
debian/copyright vendored Normal file
View File

@ -0,0 +1,35 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: valet
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: GPL-3.0+
Files: debian/*
Copyright: 2016 root <root@unknown>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

11
debian/rules vendored Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@ --with python2 --buildsystem=python_distutils -D valet
override_dh_usrlocal:

2
debian/source/format vendored Normal file
View File

@ -0,0 +1,2 @@
3.0 (native)

View File

@ -1,4 +0,0 @@
# /var/www/valet/app.wsgi
from valet.api.app import load_app
application = load_app(config_file='/var/www/valet/config.py')

View File

@ -1,46 +0,0 @@
#
# Copyright 2014-2017 AT&T Intellectual Property
#
# 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.
"""Notification Listener."""
import json
from oslo_config import cfg
import oslo_messaging
class NotificationEndpoint(object):
"""Endponit for a notifcation (info, warn, error)."""
def info(self, ctxt, publisher_id, event_type, payload, metadata):
"""Print notifaction was received and dumb json data to print."""
print('recv notification:')
print(json.dumps(payload, indent=4))
def warn(self, ctxt, publisher_id, event_type, payload, metadata):
"""Warn."""
None
def error(self, ctxt, publisher_id, event_type, payload, metadata):
"""Error."""
None
transport = oslo_messaging.get_notification_transport(cfg.CONF)
targets = [oslo_messaging.Target(topic='notifications')]
endpoints = [NotificationEndpoint()]
server = oslo_messaging.get_notification_listener(
transport, targets, endpoints)
server.start()
server.wait()

View File

@ -1,5 +1,5 @@
[metadata]
name = openstack-valet
name = valet
summary = Valet Placement Service
description-file = README.md
keywords = placement, service, openstack

26
valet/api/app.wsgi Normal file
View File

@ -0,0 +1,26 @@
# -*- mode: python -*-
#
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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.
# /var/www/valet/app.wsgi
"""Use this file for deploying the API under mod_wsgi.
See http://pecan.readthedocs.org/en/latest/deployment.html for details.
"""
from valet import service
from valet.api import app
conf = service.prepare_service([])
application = app.load_app(config_file='/var/www/valet/config.py')