From: prithiv Date: Tue, 10 Oct 2017 12:12:55 +0000 (+0100) Subject: MON Packaging Changes X-Git-Tag: v4.0.0~64^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F52%2F5552%2F5;p=osm%2FMON.git MON Packaging Changes Signed-off-by: prithiv --- diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..f2e0417 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,32 @@ +properties([ + parameters([ + string(defaultValue: env.BRANCH_NAME, description: '', name: 'GERRIT_BRANCH'), + string(defaultValue: 'osm/MON', description: '', name: 'GERRIT_PROJECT'), + string(defaultValue: env.GERRIT_REFSPEC, description: '', name: 'GERRIT_REFSPEC'), + string(defaultValue: env.GERRIT_PATCHSET_REVISION, description: '', name: 'GERRIT_PATCHSET_REVISION'), + string(defaultValue: 'https://osm.etsi.org/gerrit', description: '', name: 'PROJECT_URL_PREFIX'), + booleanParam(defaultValue: false, description: '', name: 'TEST_INSTALL'), + string(defaultValue: 'artifactory-osm', description: '', name: 'ARTIFACTORY_SERVER'), + ]) +]) + +def devops_checkout() { + dir('devops') { + git url: "${PROJECT_URL_PREFIX}/osm/devops", branch: params.GERRIT_BRANCH + } +} + +node { + checkout scm + devops_checkout() + + ci_helper = load "devops/jenkins/ci-pipelines/ci_stage_2.groovy" + ci_helper.ci_pipeline( 'MON', + params.PROJECT_URL_PREFIX, + params.GERRIT_PROJECT, + params.GERRIT_BRANCH, + params.GERRIT_REFSPEC, + params.GERRIT_PATCHSET_REVISION, + params.TEST_INSTALL, + params.ARTIFACTORY_SERVER) +} diff --git a/Makefile b/Makefile index af9afa7..491a83d 100644 --- a/Makefile +++ b/Makefile @@ -26,63 +26,57 @@ SHELL := /bin/bash all: package install clean_deb: - rm -rf .build + rm -rf .build clean: - rm -rf build + rm -rf build prepare: - pip install --upgrade setuptools - mkdir -p build/ - VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \ - VER2=$(shell git describe | cut -d- -f2); \ - VER3=$(shell git describe | cut -d- -f3); \ - cp MANIFEST.in build/ - cp requirements.txt build/ - cp README.rst build/ - cp stdeb.cfg build/ - cp kafkad build/ - cp -r core build/ - cp -r plugins build/ - cp -r devops_stages build/ - cp -r test build/ - cp setup.py build/ + pip install --upgrade setuptools + mkdir -p build/ + cp MANIFEST.in build/ + cp requirements.txt build/ + cp README.rst build/ + cp stdeb.cfg build/ + cp kafkad build/ + cp -r core build/ + cp -r plugins build/ + cp -r devops_stages build/ + cp -r test build/ + cp -r scripts build/ + cp setup.py build/ build: clean openstack_plugins prepare - python -m py_compile build/plugins/OpenStack/*.py + python -m py_compile build/plugins/OpenStack/*.py build: clean vrops_plugins prepare - python -m py_compile build/plugins/vRealiseOps/*.py + python -m py_compile build/plugins/vRealiseOps/*.py build: clean cloudwatch_plugins prepare - python -m py_compile build/plugins/CloudWatch/*.py + python -m py_compile build/plugins/CloudWatch/*.py build: clean core prepare - python -m py_compile build/core/message_bus/*.py + python -m py_compile build/core/message_bus/*.py pip: prepare - cd build ./setup.py sdist - cd build ./plugin_setup.py sdist + cd build ./setup.py sdist + cd build ./plugin_setup.py sdist package: clean clean_deb prepare - apt-get --yes install python-software-properties \ - python-pip \ - python-stdeb \ - libmysqlclient-dev \ - libxml2 \ - python-dev - cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True - cd build/deb_dist/* && dpkg-buildpackage -rfakeroot -uc -us - mkdir -p .build - cp build/deb_dist/python-*.deb .build/ - pip install -r build/requirements.txt + cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True + cd build/deb_dist/* && dpkg-buildpackage -rfakeroot -uc -us + mkdir -p .build + cp build/deb_dist/python-*.deb .build/ install: - DEBIAN_FRONTEND=noninteractive apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install --yes python-pip && \ - pip install --upgrade pip + DEBIAN_FRONTEND=noninteractive apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install --yes python-pip && \ + pip install --upgrade pip #dpkg -i build/deb_dist/*.deb develop: prepare - pip install -r requirements.txt - cd build && ./setup.py develop + pip install -r requirements.txt + cd build && ./setup.py develop + +build-docker-from-source: + docker build -t osm:MON -f docker/Dockerfile \ No newline at end of file diff --git a/core/kafka.service b/core/kafka.service deleted file mode 100644 index f517811..0000000 --- a/core/kafka.service +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2017 Intel Research and Development Ireland Limited -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Intel Corporation - -# 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. - -# For those usages not covered by the Apache License, Version 2.0 please -# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com - -[Unit] -Description=Apache Kafka server (broker) -Documentation=http://kafka.apache.org/documentation.html -Requires=network.target remote-fs.target -After=network.target remote-fs.target - -[Service] -Type=simple -PIDFile=/var/run/kafka.pid -#User=root -#Group=kafka -ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties -ExecStop=/opt/kafka/bin/kafka-server-stop.sh -Restart=on-failure -SyslogIdentifier=kafka - -[Install] -WantedBy=multi-user.target diff --git a/devops_stages/stage-archive.sh b/devops_stages/stage-archive.sh new file mode 100644 index 0000000..8f6e11d --- /dev/null +++ b/devops_stages/stage-archive.sh @@ -0,0 +1,33 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# 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. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + +#__author__ = "Prithiv Mohan" +#__date__ = "25/Sep/2017" + + +#!/bin/sh +rm -rf pool +rm -rf dists +mkdir -p pool/MON +mv .build/*.deb pool/MON/ +mkdir -p dists/unstable/MON/binary-amd64/ +apt-ftparchive packages pool/MON > dists/unstable/MON/binary-amd64/Packages +gzip -9fk dists/unstable/MON/binary-amd64/Packages diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..e6adb49 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,42 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# 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. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + +#__author__ = "Prithiv Mohan" +#__date__ = "25/Sep/2017" + +FROM ubuntu:16.04 +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install git tox make python-all python-pip debhelper && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install wget python-dev python-software-properties python-stdeb&& \ + DEBIAN_FRONTEND=noninteractive pip install -U pip && \ + DEBIAN_FRONTENT=noninteractive pip install -U requests logutils jsonschema lxml && \ + DEBIAN_FRONTEND=noninteractive pip install -U setuptools setuptools-version-command stdeb jsmin && \ + DEBIAN_FRONTEND=noninteractive pip install -U six pyvcloud bottle cherrypy pyopenssl && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install default-jre libmysqlclient-dev && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install libmysqlclient-dev libxml2 && \ + DEBIAN_FRONTEND=noninteractive pip install -U MySQL-python \ + python-openstackclient \ + python-keystoneclient \ + aodhclient \ + gnocchiclient \ + boto==2.48 \ + python-cloudwatchlogs-logging \ + py-cloudwatch diff --git a/requirements.txt b/requirements.txt index 35f7137..d701122 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,7 @@ # For those usages not covered by the Apache License, Version 2.0 please # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com +stdeb MySQL-python lxml requests diff --git a/scripts/kafka.sh b/scripts/kafka.sh new file mode 100644 index 0000000..fcdde67 --- /dev/null +++ b/scripts/kafka.sh @@ -0,0 +1,45 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# 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. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + +mkdir -p /etc/systemd/system/ +cat > /etc/systemd/system/kafka.service << EOF +[Unit] +Description=Apache Kafka server (broker) +Documentation=http://kafka.apache.org/documentation.html +Requires=network.target remote-fs.target +After=network.target remote-fs.target + +[Service] +Type=simple +PIDFile=/var/run/kafka.pid +#User=root +#Group=kafka +ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties +ExecStop=/opt/kafka/bin/kafka-server-stop.sh +Restart=on-failure +SyslogIdentifier=kafka + +[Install] +WantedBy=multi-user.target +EOF +systemctl daemon-reload +systemctl enable kafka.service +systemctl start kafka.service diff --git a/setup.py b/setup.py index 01f6dea..f0e8f43 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,7 @@ _license = 'Apache 2.0' _copyright = 'Intel Research and Development Ireland' _url = 'https://osm.etsi.org/gitweb/?p=osm/MON.git;a=tree' _requirements = [ + "stdeb", "MySQL-python", "requests", "logutils", @@ -76,7 +77,7 @@ setup(name="mon_core", package_data = {_name: ['core/message_bus/*.py', 'core/models/*.json', 'plugins/OpenStack/Aodh/*.py', 'plugins/OpenStack/Gnocchi/*.py', 'plugins/vRealiseOps/*', 'plugins/CloudWatch/*']}, - data_files = [('/etc/systemd/system/', ['core/kafka.service']), + data_files = [('/etc/systemd/system/', ['scripts/kafka.sh']), ], scripts=['plugins/vRealiseOps/vROPs_Webservice/vrops_webservice', 'kafkad'],