Commit 55c36638 authored by Stavros Sachtouris's avatar Stavros Sachtouris

Devise a CI mechanism based on docker containers

Rename "paste_deploy/" to "ci/" and add a Dockerfile to create an
image which runs the snf-occi service.
Write instructions in ci/README.md on how to build and run the
container.
Update the docs and fix emerging bugs and typos.
parent 12b2c6cc
# Copyright (C) 2016 GRNET S.A.
#
# 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 program 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/>.
#
# VERSION: 0.1
#
# docker run -ti --name occi-ci --net host -p 127.0.0.1:8080:8080 \
# -e AUTH_URL='https://accounts.okeanos.grnet.gr/identity/v2.0' \
# -e KEYSTONE_URL='https://okeanos-astavoms.hellasgrid.gr' -d \
# snf-occi-ci:latest
# docker logs -ft occi-ci
FROM debian:jessie
MAINTAINER Stavros Sachtouris <saxtouri@grnet.gr>
RUN apt update && apt upgrade -y \
&& apt install -y python-pip python-dev git curl
RUN pip install Paste PasteScript pytz ooi
RUN git clone https://github.com/grnet/snf-occi.git
COPY config.py /snf-occi/soi/config.py
RUN cd /snf-occi && python setup.py clean install
EXPOSE 8080
CMD ["python", "/snf-occi/ci/run-server.py"]
There are two options to setup a testing snf-occi deployment: with docker or
from scratch.
Deploy with docker (recommended)
---
Use docker to build the snf-occi image and deploy the snf-occi in a container.
::
$ echo "Build the docker snf-occi-ci image"
$ docker build -t snf-occi-ci https://github.com/grnet/snf-occi.git#master:ci
...
$ echo "Run the occi-ci container"
$ docker run -ti --name occi-ci --net host -p 127.0.0.1:8080:8080 \
-e AUTH_URL='https://accounts.okeanos.grnet.gr/identity/v2.0' \
-e KEYSTONE_URL='https://okeanos-astavoms.hellasgrid.gr' -d \
snf-occi-ci
...
$ echo "(optional) check the service logs"
$ docker logs -f occi-ci
serving on http://127.0.0.1:8080
...
.. note: To use a different host port, try "-p 127.0.0.1:<PORT>:8080" e.g.,
"-p 127.0.0.1:9000:8080"
Deploy from scratch
---
Here is how to run a local paste server. This is useful only for experimenting
and development and should not be used in production. We suggest to run this
test in a sandboxed environment e.g., virtualenv
::
$ virtualenv mytest
$ source mytest/bin/activate
$ pip install Paste PasteDeploy
$ cp soi/config.py.template soi/config.py
$ vim soi/config.py
... (set the appropriate values here) ...
$ python setup.py install
$ python ci/run-server.py .
serving on http://127.0.0.1:8080
...
# Copyright (C) 2016 GRNET S.A.
#
# 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 program 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/>
# Copy this file as config.py and fill in the appropriate values
import os
AUTH_URL = os.environ.get('AUTH_URL')
CA_CERTS = os.environ.get('CA_CERTS', '/etc/ssl/certs/ca-certificates.crt')
KEYSTONE_URL = os.environ.get('KEYSTONE_URL')
HOST = os.environ.get('HOST', '127.0.0.1')
PORT = os.environ.get('PORT', '8080')
PASTE_INI = '/snf-occi/ci/soi.ini'
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
from paste import deploy from paste import deploy
import logging import logging
from soi.config immport PASTE_INI from soi.config import PASTE_INI
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
......
...@@ -16,7 +16,16 @@ ...@@ -16,7 +16,16 @@
from paste import deploy from paste import deploy
import logging import logging
from paste import httpserver from paste import httpserver
from soi.config import PASTE_INI, HOST, PORT
try:
from soi.config import PASTE_INI, HOST, PORT
except (ImportError, NameError) as err:
from sys import stderr, exit
stderr.write('{err}\n'.format(err=err))
stderr.write(
'Make sure soi/config.py exists and contains appropriate values.\n')
stderr.write('Refer to the documentation for more information\n')
exit(1)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
......
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# snf_voms authentication PasteDeploy configuration file
[composite:main] [composite:main]
use = egg:Paste#urlmap use = egg:Paste#urlmap
/:snf_occiapp /:snf_occiapp
......
...@@ -23,9 +23,9 @@ copyright = u'2012-2016, GRNET' ...@@ -23,9 +23,9 @@ copyright = u'2012-2016, GRNET'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.2' version = '0.3'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.2' release = '0.3'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
......
This diff is collapsed.
...@@ -26,5 +26,5 @@ setup( ...@@ -26,5 +26,5 @@ setup(
[paste.app_factory] [paste.app_factory]
snf_occi_app=soi:main snf_occi_app=soi:main
''', ''',
install_requires=['kamaki', 'ooi', ] install_requires=['kamaki', 'ooi==0.3.2', ]
) )
...@@ -21,4 +21,4 @@ KEYSTONE_URL = 'https://okeanos-astavoms.example.com' ...@@ -21,4 +21,4 @@ KEYSTONE_URL = 'https://okeanos-astavoms.example.com'
HOST = 'this-host.example.com or IP' HOST = 'this-host.example.com or IP'
PORT = '8080' PORT = '8080'
PASTE_INI = '/home/user/snf-occi/paste_deploy/soi.ini' PASTE_INI = '/home/user/snf-occi/ci/soi.ini'
# Copyright (C) 2016 GRNET S.A.
#
# 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 program 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/>.
# Dockerfile for snf-occi-manual-ci # Dockerfile for snf-occi-manual-ci
# contains functional testing scripts # contains functional testing scripts
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment