Index: VERSION
===================================================================
--- VERSION	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ VERSION	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,1 @@
+0.5.99
Index: buildhelpers/code_generator
===================================================================
--- buildhelpers/code_generator	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ buildhelpers/code_generator	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -1,29 +1,71 @@
-#!/bin/bash
+#!/usr/bin/python
 
-DIR=`dirname "$0"`
-SRC="${DIR}/../src/gnuboat"
-SRC_GEN="${DIR}/../src/gnuboat/"
-PACKAGE_NAME="mapservice"
-PACKAGE_NAME_GEN="gnuboat.${PACKAGE_NAME}"
-PACKAGE_VERSION="0.5.90"
-TARGET_TMP="${SRC_GEN}/${PACKAGE_NAME}_tmp/"
+import os
+from pathlib import Path
+import subprocess
+import re
+import shutil
+import yaml
 
-echo "Cleaning directory"
-if [ -d "${SRC_GEN}/${PACKAGE_NAME}" ]; then
-	rm -R "${SRC_GEN}/${PACKAGE_NAME}"
-fi
-if [ -d "${TARGET_TMP}" ]; then
-	rm -R "${TARGET_TMP}"
-fi
+CURRENT_DIR = Path(os.path.dirname(__file__))
+SRC = CURRENT_DIR.joinpath('../src/gnuboat')
+SRC_GEN = CURRENT_DIR.joinpath('../src/gnuboat/')
+version_file = open(CURRENT_DIR.joinpath('../VERSION').resolve(), 'r')
+VERSION = version_file.read().strip()
+version_file.close()
 
-echo "Preparing symlinks"
-mkdir -p "${TARGET_TMP}"
+PACKAGES=["mapservice", "deviceservice"]
 
-echo "Generating backend API code"
-${DIR}/codegen/openapi-generator-cli generate -i "${SRC}/mapservice.yaml" -g python-flask -t "${DIR}/codegen/templates/" --additional-properties=packageVersion=${PACKAGE_VERSION},packageName=${PACKAGE_NAME_GEN} -o "${TARGET_TMP}"
-mv "${TARGET_TMP}/gnuboat/${PACKAGE_NAME}" "${SRC_GEN}/${PACKAGE_NAME}"
-rm -R "${TARGET_TMP}"
+print('Generating the {} services:'.format(len(PACKAGES)))
+for package in PACKAGES:
+    print('  {}'.format(package))
 
-# running yapf
-echo "Formatting the generated code accoring to style file"
-yapf --style "python-style.yapf" -r -i "${SRC_GEN}/${PACKAGE_NAME}"
+for package in PACKAGES:
+    package_name_gen = 'gnuboat.{}'.format(package)
+    target = SRC_GEN.joinpath(package)
+    target_tmp = SRC_GEN.joinpath('{}_tmp'.format(package))
+    service_specification_file = SRC.joinpath('{}.yaml'.format(package)).resolve()
+    server_port = 8080
+    
+    openapi_specification = yaml.safe_load(open(service_specification_file))
+    if 'servers' in openapi_specification:
+        for entry in openapi_specification['servers']:
+            if 'description' in entry and 'development' in entry['description'].lower():
+                result = re.search(r':([0-9]+)', entry['url'])
+                if result is not None:
+                    server_port = result.group(1)
+
+    print('Preparing package {} version {} using port {}'.format(package, VERSION, server_port))
+    print('  Cleaning directory')
+    if os.path.isdir(target):
+        shutil.rmtree(target.resolve())
+    if os.path.isdir(target_tmp):
+        shutil.rmtree(target_tmp.resolve())
+    os.mkdir(target_tmp)
+
+    print('  Generating backend API code')
+    try:
+        subprocess.run([
+            CURRENT_DIR.joinpath('codegen/openapi-generator-cli').resolve(),
+            'generate', '-i', service_specification_file,
+            '-g', 'python-flask', '-t',
+            CURRENT_DIR.joinpath('codegen/templates').resolve(),
+            ('--additional-properties=packageVersion={},packageName={},'
+             'serverPort={}').format(VERSION, package_name_gen, server_port),
+            '-o', target_tmp.resolve()
+            ],
+            check=True,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE)
+    except subprocess.CalledProcessError as e:
+        print('    openapi-generator-cli failed:')
+        print('    STDOUT: {}'.format(e.stdout))
+        print('    STDERR: {}'.format(e.stderr))
+
+    shutil.move(target_tmp.joinpath('gnuboat/{}'.format(package)).resolve(), target.resolve())
+    shutil.rmtree(target_tmp.resolve())
+
+    # running yapf
+    print('  Formatting the generated code accoring to style file')
+    subprocess.run(['yapf', '--style', 'python-style.yapf', '-r', '-i',
+        target.resolve()])
Index: buildhelpers/codegen/templates/__init__test.mustache
===================================================================
--- buildhelpers/codegen/templates/__init__test.mustache	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ buildhelpers/codegen/templates/__init__test.mustache	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -1,65 +1,19 @@
-import logging
+from flask_testing import TestCase
 
-import flask
-import connexion
-from flask_cors import CORS
-from flask_testing import TestCase
-from flask_mail import Mail
-from sqlalchemy.event import listen
-from celery import Celery
-import tempfile
-import os
-from PIL import Image
-import shutil
-
-from {{packageName}}.encoder import JSONEncoder
-from {{packageName}}_impl.database.Model import (
-    db, db_setup, load_spatialite
+from {{packageName}}_impl.tests import (
+    create_app as orig_create_app,
+    setUp as orig_setUp,
+    tearDown as orig_tearDown
 )
-from {{packageName}}_impl.tests import db_test_setup
 
 class BaseTestCase(TestCase):
 	def create_app(self):
-		logging.getLogger('connexion.operation').setLevel('ERROR')
-		app = connexion.App(__name__, specification_dir='../openapi/')
-		application = app.app
-		CORS(application)
-		mail = Mail()
-		application.json_encoder = JSONEncoder
-		app.add_api('openapi.yaml')
-
-		application.config.from_object('{{packageName}}_impl.Config.TestingConfig')
-		application.template_folder = os.path.join(os.path.dirname(__file__), '../../mapservice_impl/templates')
-		celery = Celery(__name__, broker=application.config['CELERY_BROKER_URL'])
-		celery.config_from_object(application.config)
-		mail.init_app(application)
-		db.init_app(application)
-		application.app_context().push()
-		
-		self._create_test_tile(application)
-		
-		return application
+		return orig_create_app(self)
 
 	def setUp(self):
-		listen(db.engine, 'connect', load_spatialite)
-		db.drop_all()
-		# create the tables whether the database already exists or not
-		db_setup(True)
-		self.db_content = db_test_setup.DatabaseContent()
-		self.db_content.setup()
+		orig_setUp(self)
         
 	def tearDown(self):
-		db.session.remove()
-		db.drop_all()
-		shutil.rmtree(self.tiles_cache)
-
-	def _create_test_tile(self, application):
-		self.tiles_cache = tempfile.mkdtemp(prefix='gnuboat-tests')
-		application.config['TILES_CACHE_PATH'] = self.tiles_cache
-		
-		tile_path = os.path.join(self.tiles_cache, '100_100/256/15/17298/')
-		os.makedirs(tile_path)
-		img = Image.new('RGBA', (100, 100), (255, 0, 0, 0))
-		img.save(os.path.join(tile_path, "21435.png"), "PNG")
+		orig_tearDown(self)
 		
 	def check_key(self, key, value, data):
Index: buildhelpers/codegen/templates/__main__.mustache
===================================================================
--- buildhelpers/codegen/templates/__main__.mustache	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ buildhelpers/codegen/templates/__main__.mustache	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -9,5 +9,5 @@
 
 from {{packageName}}_impl import (
-    app, application, mail, celery, setup_app, config_object
+    app, application, setup_app, config_object
 )
 
Index: setup.py
===================================================================
--- setup.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ setup.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -5,5 +5,7 @@
 
 NAME = 'gnuboat'
-VERSION = '0.5.99'
+version = open('VERSION', 'r')
+VERSION = version.read().strip()
+version.close()
 
 # shapely is required by geoalchemy2
Index: src/gnuboat/common/device/rrdschema.py
===================================================================
--- src/gnuboat/common/device/rrdschema.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/common/device/rrdschema.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,42 @@
+'''
+    Copyright (C) 2017 - 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+
+try:
+    from dataclasses import dataclass
+    @dataclass
+    class RrdArchive:
+        """
+            Describes an RRD Archive.
+            Durations and resolution are in seconds
+        """
+        duration: int
+        resolution: int
+except:
+    class RrdArchive:
+        """
+            Describes an RRD Archive.
+            Durations and resolution are in seconds
+        """
+        def __init__(self, duration, resolution):
+            self.duration = duration
+            self.resolution = resolution
+
+archives = [
+    RrdArchive(240, 2),
+    RrdArchive(3600, 10),
+    RrdArchive(86400, 60),
+]
Index: src/gnuboat/common/tests/test_config.py
===================================================================
--- src/gnuboat/common/tests/test_config.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/common/tests/test_config.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,56 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+
+import unittest
+import tempfile
+import yaml
+import os
+
+from gnuboat.common.webservice import Config as configure
+
+
+class Config(object):
+    TEST = 'blabla'
+
+
+class TestConfig(unittest.TestCase):
+    def test_config_from_file(self):
+        """Test case load config from file
+        """
+        new_config = {'TESTING': True, 'DOES_NOT_EXISTS': 1234}
+
+        config_file = tempfile.NamedTemporaryFile(
+            mode='w', prefix='gnuboat-test-config', delete=False
+        )
+        yaml.dump(
+            new_config,
+            config_file,
+            default_flow_style=False,
+            allow_unicode=True
+        )
+        config_file.close()
+        config_file = os.path.join(tempfile.gettempdir(), config_file.name)
+
+        config = configure.config_from_file(config_file, Config())
+        assert config.TEST == 'blabla'
+        assert config.TESTING is True
+        assert config.DOES_NOT_EXISTS == 1234
+        os.remove(config_file)
+
+
+if __name__ == '__main__':
+    unittest.main()
Index: src/gnuboat/common/webservice/Config.py
===================================================================
--- src/gnuboat/common/webservice/Config.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/common/webservice/Config.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,27 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+
+import yaml
+
+
+def config_from_file(config_file, config):
+    config_from_file = yaml.safe_load(open(config_file))
+
+    for entry in config_from_file:
+        setattr(config, entry, config_from_file[entry])
+
+    return config
Index: src/gnuboat/common/webservice/HttpErrors.py
===================================================================
--- src/gnuboat/common/webservice/HttpErrors.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/common/webservice/HttpErrors.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,97 @@
+'''
+    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+
+from werkzeug.exceptions import (
+    BadRequest, Unauthorized, NotFound, InternalServerError
+)
+from connexion.exceptions import ProblemException
+
+
+class GnuboatBadRequest(ProblemException, BadRequest):
+    def __init__(
+        self,
+        type="bad-request",
+        title=None,
+        detail=None,
+        instance=None,
+        **kwargs
+    ):
+        super(GnuboatBadRequest, self).__init__(
+            status=400,
+            title="Bad Request",
+            detail=detail,
+            type=type,
+            instance=instance,
+            **kwargs
+        )
+
+
+class GnuboatUnauthorized(ProblemException, Unauthorized):
+    def __init__(
+        self,
+        type="unauthorized",
+        title="Access denied",
+        detail="You need to login to access the requested resource",
+        instance=None,
+        **kwargs
+    ):
+        super(GnuboatUnauthorized, self).__init__(
+            status=401,
+            title=title,
+            detail=detail,
+            type=type,
+            instance=instance,
+            **kwargs
+        )
+
+
+class GnuboatNotFound(ProblemException, NotFound):
+    def __init__(
+        self,
+        type="not-found",
+        title="Resouce not found",
+        detail="The requested resource was not found",
+        instance=None,
+        **kwargs
+    ):
+        super(GnuboatNotFound, self).__init__(
+            status=404,
+            title=title,
+            detail=detail,
+            type=type,
+            instance=instance,
+            **kwargs
+        )
+
+
+class GnuboatInternalServerError(ProblemException, InternalServerError):
+    def __init__(
+        self,
+        type="internal-server-error",
+        title=None,
+        detail=None,
+        instance=None,
+        **kwargs
+    ):
+        super(GnuboatInternalServerError, self).__init__(
+            status=500,
+            title="Internal Server Error",
+            detail=detail,
+            type=type,
+            instance=instance,
+            **kwargs
+        )
Index: src/gnuboat/device/daemon/rrdhandler.py
===================================================================
--- src/gnuboat/device/daemon/rrdhandler.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/device/daemon/rrdhandler.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
 '''
-    Copyright (C) 2016 - 2017 EngSaS - Langenbach. All rights reserved.
+    Copyright (C) 2016 - 2020 EngSaS - Langenbach. All rights reserved.
 
     This program is free software: you can redistribute it and/or modify
@@ -21,4 +21,5 @@
 import traceback
 
+import gnuboat.common.device.rrdschema as rrdschema
 
 def rrd_create_database(database_file, logperiod, start_time='N'):
@@ -32,25 +33,12 @@
     step = logperiod
     # durations: each archive should contain values for in seconds
-    archives = [
-        {
-            "duration": 240,
-            "resolution": 2
-        },
-        {
-            "duration": 3600,
-            "resolution": 10
-        },
-        {
-            "duration": 86400,
-            "resolution": 60
-        },
-    ]
+    archives = rrdschema.archives
     rrd_archives = []
     for i in range(0, len(archives)):
         rrd_archives += [
             'RRA:AVERAGE:0.5:{:d}:{:d}'.format(
-                _steps(archives[i]["resolution"], step),
+                _steps(archives[i].resolution, step),
                 _rows(
-                    archives[i]["duration"], archives[i]["resolution"], step
+                    archives[i].duration, archives[i].resolution, step
                 )
             )
Index: src/gnuboat/deviceservice.yaml
===================================================================
--- src/gnuboat/deviceservice.yaml	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/deviceservice.yaml	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -12,10 +12,10 @@
   description: API for GNUBoat devices
 servers:
-  - url: 'http://gnuboat/{version}'
+  - url: 'http://gnuboat/deviceservice/{version}'
     description: The production API server
     variables:
       version:
         default: v1
-  - url: 'http://localhost:8090/device/{version}'
+  - url: 'http://localhost:8090/deviceservice/{version}'
     description: The local flask development url
     variables:
@@ -60,10 +60,6 @@
       operationId: shutdown
       responses:
-        '200':
-          description: OK
-          content:
-            application/json:
-              schema:
-                type: boolean
+        '204':
+          description: Shutdown initiated
         '500':
           $ref: '#/components/responses/InternalServerError'
@@ -72,5 +68,5 @@
       description: List of local logfiles
       tags:
-        - device
+        - deviceLogs
       operationId: logfilesGet
       responses:
@@ -83,5 +79,5 @@
         '500':
           $ref: '#/components/responses/InternalServerError'
-  '/logfiles/{id*}':
+  '/logfiles/{id}':
     get:
       description: Download local logfiles
@@ -90,5 +86,5 @@
       operationId: logsGet
       parameters:
-        - name: id*
+        - name: id
           in: path
           description: Logfiles to download
@@ -96,4 +92,6 @@
           schema:
             type: string
+          style: simple
+          explode: true
           example: 'nmea0183.log,replay-test.log'
       responses:
@@ -181,5 +179,5 @@
         '500':
           $ref: '#/components/responses/InternalServerError'
-  '/maps/{map}[zoom}/{x_tile}/{y_tile}.png':
+  '/maps/{map}/{zoom}/{x_tile}/{y_tile}.png':
     get:
       description: Get tiles of a map with help of it's tiles urls
@@ -413,5 +411,5 @@
       items:
         $ref: '#/components/schemas/Logfile'
-    Map:
+    map:
       title: Represents a Map
       description: Following the tilejson specification https://github.com/mapbox Version 2.0.0
@@ -494,5 +492,5 @@
       type: array
       items:
-        $ref: '#/components/schemas/Map'
+        $ref: '#/components/schemas/map'
     itemName:
       title: Item Name
Index: src/gnuboat/deviceservice_impl/Config.py
===================================================================
--- src/gnuboat/deviceservice_impl/Config.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/deviceservice_impl/Config.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,41 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+
+
+class Config(object):
+    DEBUG = False
+    TESTING = False
+
+
+class ProductionConfig(Config):
+    # array used for shutdown command with subprocess
+    SHUTDOWN_COMMAND = ['sudo', 'shutdown', '-h', 'now']
+
+
+class DevelopmentConfig(Config):
+    DEBUG = True
+    MAPSERVICE = 'http://localhost:8080'
+    MAPSERVICE_API_KEY = 'test_key'
+    DEVICE_DATABASE = '/tmp/gnuboat-device.rrd'
+    SHUTDOWN_COMMAND = ['echo', '1']
+
+class TestingConfig(DevelopmentConfig):
+    """
+        Configuration for testing purposes only (like tox/nosetests)
+    """
+    TESTING = True
+    DEBUG = False
Index: src/gnuboat/deviceservice_impl/__init__.py
===================================================================
--- src/gnuboat/deviceservice_impl/__init__.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/deviceservice_impl/__init__.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,74 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+
+import connexion
+import flask
+from flask_cors import CORS
+from werkzeug.utils import import_string
+import os
+
+from gnuboat.deviceservice import encoder
+
+from pathlib import Path
+
+def load_config_object(config_name):
+    return import_string(
+        'gnuboat.deviceservice_impl.Config.{}Config'.format(config_name)
+    )
+
+# determine requested configuration
+config_file = '/etc/gnuboat/deviceservice.conf'
+if 'FLASK_ENV' in os.environ and os.environ['FLASK_ENV']:
+    config_object = load_config_object(os.environ['FLASK_ENV'].title())
+elif os.path.isfile(config_file):
+    from gnuboat.common.webservice import Config as configure
+    config_object = configure.config_from_file(config_file,
+        load_config_object(''))
+else:
+    config_object = load_config_object('Production')
+
+app = connexion.App(__name__, specification_dir='../deviceservice/openapi/')
+application = app.app
+CORS(application)
+
+#@app.route("/")
+#def index():
+   #return render_template("index.html")
+
+def setup_app(app_name, config, template_folder=None):
+    application.json_encoder = encoder.JSONEncoder
+    app.add_api(
+        'openapi.yaml',
+        arguments={'title': app_name},
+        validate_responses=True,
+        strict_validation=True,
+    )
+    application.config.from_object(config)
+    
+    application.static_url_path = '/client'
+    # Remove the old rule from Map._rules.
+    for rule in application.url_map.iter_rules('static'):
+        application.url_map._rules.remove(rule)  # There is probably only one.
+
+    # Remove the old rule from Map._rules_by_endpoint. In this case we can just 
+    # start fresh.
+    application.url_map._rules_by_endpoint['static'] = []  
+
+    # Add the updated rule.
+    application.add_url_rule(f'{application.static_url_path}/<path:filename>',
+                    endpoint='static',
+                    view_func=application.send_static_file)
Index: src/gnuboat/deviceservice_impl/controllers/DeviceController.py
===================================================================
--- src/gnuboat/deviceservice_impl/controllers/DeviceController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/deviceservice_impl/controllers/DeviceController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,124 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+import connexion
+import flask
+import subprocess
+import rrdtool
+import os
+
+import gnuboat.common.device.rrdschema as rrdschema
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest, GnuboatUnauthorized,
+    GnuboatNotFound, GnuboatInternalServerError
+)
+
+
+def instrument_data_get():
+    rrdfile = _rrdfile_get()
+    try:
+        result = rrdtool.lastupdate(rrdfile)
+    except Exception as e:
+        raise GnuboatInternalServerError(detail='Could not query rrd database. Error: {}'.format(repr(e)))
+    if 'ds' not in result:
+        raise GnuboatNotFound(detail='No databset found')
+    return {
+        'speedThroughWater': result['ds']['speedthroughwater'],
+        'speedOverGround': result['ds']['speedoverground'],
+        'courseOverGround': result['ds']['courseoverground'],
+        'waterDepth': result['ds']['waterdepth'],
+        'waterTemperature': result['ds']['watertemperature'],
+        'position': [result['ds']['longitude'], result['ds']['latitude']],
+        'gpsFix': gpsfix_to_enum(result['ds']['gpsfix']),
+    }
+
+
+def track_get():
+    rrdfile = _rrdfile_get()
+    
+    track = {}
+    for archive in rrdschema.archives:
+        result = _rrd_fetch(rrdfile, archive.resolution, '{}s'.format(archive.duration))
+
+        start, end, interval = result[0]
+        keys = result[1]
+        latitude = keys.index('latitude')
+        longitude = keys.index('longitude')
+        speedthroughwater = keys.index('speedthroughwater')
+        speedoverground = keys.index('speedoverground')
+        courseoverground = keys.index('courseoverground')
+        waterdepth = keys.index('waterdepth')
+        watertemperature = keys.index('watertemperature')
+        gpsfix = keys.index('gpsfix')
+        
+        i = 0
+        for dataset in result[2]:
+            timestamp = start + i * interval
+            if timestamp not in track and dataset[gpsfix]:
+                track[timestamp] = {
+                    'speedThroughWater': dataset[speedthroughwater],
+                    'speedOverGround': dataset[speedoverground],
+                    'courseOverGround': dataset[courseoverground],
+                    'waterDepth': dataset[waterdepth],
+                    'waterTemperature': dataset[watertemperature],
+                    'position': [dataset[longitude], dataset[latitude]],
+                    'gpsFix': gpsfix_to_enum(dataset[gpsfix]),
+                }
+            i += 1
+   
+    return track
+
+
+def shutdown():
+    if 'SHUTDOWN_COMMAND' not in flask.current_app.config:
+        raise GnuboatInternalServerError(
+            detail='SHUTDOWN_COMMAND not configured'
+        )
+    command = flask.current_app.config['SHUTDOWN_COMMAND']
+    if not isinstance(command, list):
+        raise GnuboatInternalServerError(
+            detail='SHUTDOWN_COMMAND must be a list'
+        )
+    try:
+        subprocess.run(command, check=True)
+    except subprocess.CalledProcessError as e:
+        raise GnuboatInternalServerError(detail=repr(e))
+
+
+def _rrdfile_get():
+    if 'DEVICE_DATABASE' not in flask.current_app.config or not os.access(
+        flask.current_app.config['DEVICE_DATABASE'], os.R_OK
+    ):
+        raise GnuboatInternalServerError(
+            detail='DEVICE_DATABASE not configured or not accessible'
+        )
+    return flask.current_app.config['DEVICE_DATABASE']
+
+
+def _rrd_fetch(rrdfile, interval, period):
+    try:
+        return rrdtool.fetch(rrdfile, 'AVERAGE', '--resolution', str(interval), '--start', '-{}'.format(period), '--align-start')
+    except Exception as e:
+        raise GnuboatInternalServerError(detail='Could not fetch from rrd database. Error: {}'.format(repr(e)))
+    
+
+def gpsfix_to_enum(gpsfix):
+    if gpsfix == 2:
+        return "2D";
+    elif gpsfix == 3:
+        return "3D";
+    else:
+        return "-";
Index: src/gnuboat/deviceservice_impl/controllers/DeviceLogsController.py
===================================================================
--- src/gnuboat/deviceservice_impl/controllers/DeviceLogsController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/deviceservice_impl/controllers/DeviceLogsController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,34 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+import connexion
+
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest, GnuboatUnauthorized,
+    GnuboatNotFound, GnuboatInternalServerError
+)
+
+
+def logfiles_get():
+    raise GnuboatInternalServerError
+
+
+def logs_get():
+    raise GnuboatInternalServerError
+
+def logs_track_get():
+    raise GnuboatInternalServerError
+
Index: src/gnuboat/deviceservice_impl/controllers/DeviceMapsController.py
===================================================================
--- src/gnuboat/deviceservice_impl/controllers/DeviceMapsController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/deviceservice_impl/controllers/DeviceMapsController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,26 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+import connexion
+
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest, GnuboatUnauthorized, 
+    GnuboatNotFound, GnuboatInternalServerError
+)
+
+
+def maps_get():
+    raise GnuboatInternalServerError
Index: src/gnuboat/deviceservice_impl/controllers/MapserviceController.py
===================================================================
--- src/gnuboat/deviceservice_impl/controllers/MapserviceController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/deviceservice_impl/controllers/MapserviceController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,37 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+import connexion
+
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest, GnuboatUnauthorized, 
+    GnuboatNotFound, GnuboatInternalServerError
+)
+
+
+def devices_get():
+    raise GnuboatInternalServerError
+
+
+def log_create():
+    raise GnuboatInternalServerError
+
+
+def mapservice_status():
+    raise GnuboatInternalServerError
+
+def waters_get():
+    raise GnuboatInternalServerError
Index: src/gnuboat/deviceservice_impl/tests/__init__.py
===================================================================
--- src/gnuboat/deviceservice_impl/tests/__init__.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/deviceservice_impl/tests/__init__.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,131 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+
+import logging
+import flask
+import connexion
+from flask_cors import CORS
+import rrdtool
+import os
+import tempfile
+import time
+import random
+
+import gnuboat.common.device.rrdschema as rrdschema
+
+from gnuboat.deviceservice.encoder import JSONEncoder
+
+
+def create_app(testcase):
+    logging.getLogger('connexion.operation').setLevel('ERROR')
+    app = connexion.App(__name__,
+        specification_dir='../../deviceservice/openapi/')
+    application = app.app
+    CORS(application)
+    application.json_encoder = JSONEncoder
+    app.add_api('openapi.yaml',
+        validate_responses=True,
+        strict_validation=True,
+    )
+
+    application.config.from_object(
+        'gnuboat.deviceservice_impl.Config.TestingConfig')
+    application.app_context().push()
+    
+    _create_rrdfile(testcase, application)
+    
+    return application
+
+
+def setUp(testcase):
+    pass
+
+
+def tearDown(testcase):
+    os.remove(testcase.rrdfile)
+
+
+def _create_rrdfile(testcase, application):
+    rrd_file_handle, testcase.rrdfile = tempfile.mkstemp(suffix='.rrd', prefix='gnuboat-tests')
+    application.config['DEVICE_DATABASE'] = testcase.rrdfile
+    
+    logperiod = 2
+    duration = 24 * 60 * 60
+    timestamp = int(time.time())
+    start_time = timestamp - duration - logperiod
+    latitude_min = 10.0
+    latitude_max = 10.9
+    longitude_min = 42.0
+    longitude_max = 42.9
+    
+    _rrd_create_database(testcase.rrdfile, logperiod, str(start_time))
+    for current_time in range(timestamp - duration, timestamp, logperiod):
+        latitude = random.uniform(latitude_min, latitude_max)
+        longitude = random.uniform(longitude_min, longitude_max)
+        speedThroughWater = random.randint(0, 10)
+        speedOverGround = random.randint(-2, 15)
+        courseOverGround = random.randint(0, 360)
+        waterDepth = random.randint(0, 20)
+        waterTemperature = random.randint(2, 25)
+        gpsFix = 3
+        # update rrd database for the webservice
+        _rrd_update(
+            testcase.rrdfile, '{}:{}:{}:{}:{}:{}:{}:{}:{}'.format(
+                current_time, latitude, longitude, speedThroughWater,
+                speedOverGround, courseOverGround, waterDepth,
+                waterTemperature, gpsFix
+            )
+        )
+    
+def _rrd_create_database(database_file, logperiod, start_time='N'):
+    rrd_data_sources = [
+        'DS:latitude:GAUGE:15:-90:90', 'DS:longitude:GAUGE:15:-180:180',
+        'DS:speedthroughwater:GAUGE:15:U:U', 'DS:speedoverground:GAUGE:15:U:U',
+        'DS:courseoverground:GAUGE:15:U:U', 'DS:waterdepth:GAUGE:15:0:10000',
+        'DS:watertemperature:GAUGE:15:-10:50', 'DS:gpsfix:GAUGE:15:-999:3'
+    ]
+
+    step = logperiod
+    archives = rrdschema.archives
+    rrd_archives = []
+    for i in range(0, len(archives)):
+        rrd_archives += [
+            'RRA:AVERAGE:0.5:{:d}:{:d}'.format(
+                _steps(archives[i].resolution, step),
+                _rows(
+                    archives[i].duration, archives[i].resolution, step
+                )
+            )
+        ]
+
+    rrdtool.create(
+        database_file, "--start", start_time, "--step", str(step),
+        rrd_data_sources, rrd_archives
+    )
+
+
+def _rrd_update(rrdfile, value_string):
+    rrdtool.update(rrdfile, value_string)
+    
+def _rows(duration, resolution, step):
+    return int(
+        round(float(duration) / _steps(resolution, float(step)) / float(step))
+    )
+
+
+def _steps(resolution, step):
+    return int(round(float(resolution) / float(step)))
Index: src/gnuboat/mapservice_impl/Config.py
===================================================================
--- src/gnuboat/mapservice_impl/Config.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/mapservice_impl/Config.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -19,15 +19,4 @@
 from pathlib import Path
 import os
-import yaml
-
-
-def load_from_file(config_file):
-    config_from_file = yaml.safe_load(open(config_file))
-    config = Config()
-
-    for entry in config_from_file:
-        setattr(config, entry, config_from_file[entry])
-
-    return config
 
 
Index: c/gnuboat/mapservice_impl/HttpErrors.py
===================================================================
--- src/gnuboat/mapservice_impl/HttpErrors.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ 	(revision )
@@ -1,97 +1,0 @@
-'''
-    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
-
-    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/>.
-'''
-
-from werkzeug.exceptions import (
-    BadRequest, Unauthorized, NotFound, InternalServerError
-)
-from connexion.exceptions import ProblemException
-
-
-class MapserviceBadRequest(ProblemException, BadRequest):
-    def __init__(
-        self,
-        type="bad-request",
-        title=None,
-        detail=None,
-        instance=None,
-        **kwargs
-    ):
-        super(MapserviceBadRequest, self).__init__(
-            status=400,
-            title="Bad Request",
-            detail=detail,
-            type=type,
-            instance=instance,
-            **kwargs
-        )
-
-
-class MapserviceUnauthorized(ProblemException, Unauthorized):
-    def __init__(
-        self,
-        type="unauthorized",
-        title="Access denied",
-        detail="You need to login to access the requested resource",
-        instance=None,
-        **kwargs
-    ):
-        super(MapserviceUnauthorized, self).__init__(
-            status=401,
-            title=title,
-            detail=detail,
-            type=type,
-            instance=instance,
-            **kwargs
-        )
-
-
-class MapserviceNotFound(ProblemException, NotFound):
-    def __init__(
-        self,
-        type="not-found",
-        title="Resouce not found",
-        detail="The requested resource was not found",
-        instance=None,
-        **kwargs
-    ):
-        super(MapserviceNotFound, self).__init__(
-            status=404,
-            title=title,
-            detail=detail,
-            type=type,
-            instance=instance,
-            **kwargs
-        )
-
-
-class MapserviceInternalServerError(ProblemException, InternalServerError):
-    def __init__(
-        self,
-        type="internal-server-error",
-        title=None,
-        detail=None,
-        instance=None,
-        **kwargs
-    ):
-        super(MapserviceInternalServerError, self).__init__(
-            status=500,
-            title="Internal Server Error",
-            detail=detail,
-            type=type,
-            instance=instance,
-            **kwargs
-        )
Index: src/gnuboat/mapservice_impl/__init__.py
===================================================================
--- src/gnuboat/mapservice_impl/__init__.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/mapservice_impl/__init__.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -44,6 +44,7 @@
     config_object = load_config_object(os.environ['FLASK_ENV'].title())
 elif os.path.isfile(config_file):
-    from . import Config as configure
-    config_object = configure.load_from_file(config_file)
+    from gnuboat.common.webservice import Config as configure
+    config_object = configure.config_from_file(config_file,
+        load_config_object(''))
 else:
     config_object = load_config_object('Production')
Index: src/gnuboat/mapservice_impl/controllers/DevicesController.py
===================================================================
--- src/gnuboat/mapservice_impl/controllers/DevicesController.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/mapservice_impl/controllers/DevicesController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -1,4 +1,4 @@
 '''
-    Copyright (C) 2019 EngSaS - Langenbach. All rights reserved.
+    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
 
     This program is free software: you can redistribute it and/or modify
@@ -18,6 +18,6 @@
 
 from gnuboat.mapservice_impl.database.Model import User, Device, db
-from gnuboat.mapservice_impl.HttpErrors import (
-    MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest, GnuboatUnauthorized, GnuboatNotFound
 )
 
@@ -28,5 +28,5 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     query = Device.query.filter_by(owner=user)
@@ -43,9 +43,9 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     device = Device.query.filter_by(owner=user).filter_by(id=id).all()
     if len(device) != 1:
-        raise MapserviceNotFound
+        raise GnuboatNotFound
     return device[0].to_dict()
 
@@ -54,5 +54,5 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     comment = ""
@@ -74,8 +74,8 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     if not Device.query.filter_by(owner=user).filter_by(id=id).delete():
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail="Could not delete device with id {}".format(id)
         )
Index: src/gnuboat/mapservice_impl/controllers/LogsController.py
===================================================================
--- src/gnuboat/mapservice_impl/controllers/LogsController.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/mapservice_impl/controllers/LogsController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -21,6 +21,6 @@
     Water, Device, Gauge, ProcessingStatus, Queue, db
 )
-from gnuboat.mapservice_impl.HttpErrors import (
-    MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest, GnuboatUnauthorized, GnuboatNotFound
 )
 from gnuboat.mapservice_impl.tasks.tasks import log_process
@@ -33,5 +33,5 @@
         submitter = User.query.filter_by(username=submitter).all()
         if len(submitter) != 1:
-            raise MapserviceNotFound(
+            raise GnuboatNotFound(
                 detail="Could not find the submitter with id {}".
                 format(submitter)
@@ -55,5 +55,5 @@
     log = Log.query.filter_by(id=id).all()
     if len(log) != 1:
-        raise MapserviceNotFound
+        raise GnuboatNotFound
     if connexion.request.headers['Accept'] == "application/geo+json":
         return log[0].to_geojson(), 200, {
@@ -66,9 +66,9 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     water = Water.query.filter_by(id=log_creation.water).all()
     if len(water) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='Water {} not found database'.format(log_creation.water)
         )
@@ -77,5 +77,5 @@
     device = Device.query.filter_by(id=log_creation.device).all()
     if len(device) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='Device {} not found in database'.
             format(log_creation.device)
@@ -85,5 +85,5 @@
     gauge = Gauge.query.filter_by(id=log_creation.gauge).all()
     if len(gauge) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='Gauge {} not found in database'.format(log_creation.gauge)
         )
@@ -91,10 +91,10 @@
 
     if log_creation.gauge_height is None:
-        raise MapserviceBadRequest(detail='Gauge Height (Stage) missing')
+        raise GnuboatBadRequest(detail='Gauge Height (Stage) missing')
     else:
         try:
             float(log_creation.gauge_height)
         except ValueError:
-            raise MapserviceBadRequest(
+            raise GnuboatBadRequest(
                 detail='Gauge Height (Stage) {} is no number'.
                 format(log_creation.gauge_height)
@@ -122,8 +122,8 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     if body is None or not body:
-        raise MapserviceBadRequest(detail='No log data')
+        raise GnuboatBadRequest(detail='No log data')
 
     processing_state = ProcessingStatus.query.filter_by(
@@ -131,5 +131,5 @@
     ).all()
     if len(processing_state) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='Processing status Queued for Parsing not found database'
         )
@@ -138,5 +138,5 @@
     log = Log.query.filter_by(id=log_id).all()
     if len(log) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='Log {} not found database'.format(log_id)
         )
@@ -145,5 +145,5 @@
     # check if Log has already log entries
     if LogEntry.query.filter_by(log=log).count() > 0:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='Log {} has already log entries. Aborting'.format(log_id)
         )
@@ -164,8 +164,8 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     if not Log.query.filter_by(submitter=user).filter_by(id=id).delete():
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail="Could not delete log with id {}".format(id)
         )
Index: src/gnuboat/mapservice_impl/controllers/TilesController.py
===================================================================
--- src/gnuboat/mapservice_impl/controllers/TilesController.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/mapservice_impl/controllers/TilesController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -20,6 +20,6 @@
 import os
 
-from gnuboat.mapservice_impl.HttpErrors import (
-    MapserviceInternalServerError, MapserviceBadRequest, MapserviceNotFound
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatInternalServerError, GnuboatBadRequest, GnuboatNotFound
 )
 
@@ -29,5 +29,5 @@
         flask.current_app.config['TILES_CACHE_PATH'], os.R_OK
     ):
-        raise MapserviceInternalServerError(
+        raise GnuboatInternalServerError(
             detail='TILES_CACHE_PATH not configured or not accessible'
         )
@@ -35,18 +35,18 @@
 
     if 'TILES_DENSITIES' not in flask.current_app.config:
-        raise MapserviceInternalServerError(
-            details='TILES_DENSITIES not configured'
+        raise GnuboatInternalServerError(
+            detail='TILES_DENSITIES not configured'
         )
     tiles_densities = flask.current_app.config['TILES_DENSITIES']
 
     if 'TILES_DENSITY_BASEE' not in flask.current_app.config:
-        raise MapserviceInternalServerError(
-            details='TILES_DENSITY_BASEE not configured'
+        raise GnuboatInternalServerError(
+            detail='TILES_DENSITY_BASEE not configured'
         )
     tiles_densitiy_base = flask.current_app.config['TILES_DENSITY_BASEE']
 
     if 'TILES_SKIP_EMPTY' not in flask.current_app.config:
-        raise MapserviceInternalServerError(
-            details='TILES_SKIP_EMPTY not configured'
+        raise GnuboatInternalServerError(
+            detail='TILES_SKIP_EMPTY not configured'
         )
     tiles_skip_empty = flask.current_app.config['TILES_SKIP_EMPTY']
@@ -57,6 +57,6 @@
         accuracy = '{}_{}'.format(min(tiles_densities), tiles_densitiy_base)
     else:
-        raise MapserviceBadRequest(
-            details=('No valid accuracy requested. '
+        raise GnuboatBadRequest(
+            detail=('No valid accuracy requested. '
                      'Valid are high, low. Requested was: {}')
             .format(accuracy)
@@ -73,5 +73,5 @@
     if not os.path.isfile(tile_path):
         if not tiles_skip_empty or not os.path.isfile(tile__empty_path):
-            raise MapserviceNotFound(
+            raise GnuboatNotFound(
                 detail=('Tile ({}, {}) for accuracy {} with resolution {} '
                         'at zoomlevel {} not found')
Index: src/gnuboat/mapservice_impl/controllers/UsersController.py
===================================================================
--- src/gnuboat/mapservice_impl/controllers/UsersController.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/mapservice_impl/controllers/UsersController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -26,6 +26,6 @@
 from gnuboat.mapservice_impl import mail
 from gnuboat.mapservice_impl.database.Model import User, ApiKey, db
-from gnuboat.mapservice_impl.HttpErrors import (
-    MapserviceBadRequest, MapserviceUnauthorized, MapserviceNotFound
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest, GnuboatUnauthorized, GnuboatNotFound
 )
 
@@ -51,5 +51,5 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     api_key = hashlib.md5(
@@ -70,8 +70,8 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     if not ApiKey.query.filter_by(key=api_key).delete():
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail="Could not delete api key {}".format(api_key)
         )
@@ -87,5 +87,5 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     return user_to_dict(user)
@@ -94,22 +94,22 @@
 def users_register(user_creation):
     if user_creation is None:
-        raise MapserviceBadRequest(detail='No data specified')
+        raise GnuboatBadRequest(detail='No data specified')
     if user_creation.username is None or not user_creation.username:
-        raise MapserviceBadRequest(detail='No username given')
+        raise GnuboatBadRequest(detail='No username given')
     if user_creation.password is None or not user_creation.password:
-        raise MapserviceBadRequest(detail='No password given')
+        raise GnuboatBadRequest(detail='No password given')
     if user_creation.first_name is None or not user_creation.first_name:
-        raise MapserviceBadRequest(detail='No first name given')
+        raise GnuboatBadRequest(detail='No first name given')
     if user_creation.last_name is None or not user_creation.last_name:
-        raise MapserviceBadRequest(detail='No last name given')
+        raise GnuboatBadRequest(detail='No last name given')
     if user_creation.email is None or not user_creation.email:
-        raise MapserviceBadRequest(detail='No email given')
+        raise GnuboatBadRequest(detail='No email given')
     if not mail_regex.match(user_creation.email):
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='Email contains more than one @, no @ or no .'
         )
     if (user_creation.license_accepted is None or
             not user_creation.license_accepted):
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='You must accept the license to register an account'
         )
Index: src/gnuboat/mapservice_impl/controllers/WatersController.py
===================================================================
--- src/gnuboat/mapservice_impl/controllers/WatersController.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/mapservice_impl/controllers/WatersController.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -1,4 +1,4 @@
 '''
-    Copyright (C) 2019 EngSaS - Langenbach. All rights reserved.
+    Copyright (C) 2019 - 2020 EngSaS - Langenbach. All rights reserved.
 
     This program is free software: you can redistribute it and/or modify
@@ -18,7 +18,7 @@
 
 from gnuboat.mapservice_impl.database.Model import User, Water, Gauge, Log, db
-from gnuboat.mapservice_impl.HttpErrors import (
-    MapserviceBadRequest,
-    MapserviceUnauthorized, MapserviceNotFound
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest,
+    GnuboatUnauthorized, GnuboatNotFound
 )
 
@@ -37,5 +37,5 @@
         manager = User.query.filter_by(username=manager).all()
         if len(manager) != 1:
-            raise MapserviceNotFound(
+            raise GnuboatNotFound(
                 detail="Could not find the manager with id {}".format(manager)
             )
@@ -56,5 +56,5 @@
         stakeholder = User.query.filter_by(username=stakeholder).all()
         if len(stakeholder) != 1:
-            raise MapserviceNotFound(details='Stakeholder not found')
+            raise GnuboatNotFound(detail='Stakeholder not found')
         stakeholder = stakeholder[0]
 
@@ -91,5 +91,5 @@
     water = Water.query.filter_by(id=id).all()
     if len(water) != 1:
-        raise MapserviceNotFound
+        raise GnuboatNotFound
     return water[0].to_dict()
 
@@ -98,5 +98,5 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     water = Water(
@@ -114,5 +114,5 @@
     water = Water.query.filter_by(id=water_id).all()
     if len(water) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail="Water with id {} not found".format(water_id)
         )
@@ -121,5 +121,5 @@
     gauge = Gauge.query.filter_by(water=water).filter_by(id=gauge_id).all()
     if len(gauge) != 1:
-        raise MapserviceNotFound(
+        raise GnuboatNotFound(
             detail="Did not find gauge with id {} for water {}".
             format(gauge_id, water.name)
@@ -135,9 +135,9 @@
     user = User.loggedin_user()
     if user is None:
-        raise MapserviceUnauthorized
+        raise GnuboatUnauthorized
 
     water = Water.query.filter_by(id=water_id).all()
     if len(water) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail="Did not find water with id {}".format(water_id)
         )
@@ -164,5 +164,5 @@
     water = Water.query.filter_by(id=water_id).all()
     if len(water) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail="Did not find water with id {}".format(water_id)
         )
@@ -173,5 +173,5 @@
         manager = User.query.filter_by(username=manager).all()
         if len(manager) != 1:
-            raise MapserviceNotFound(
+            raise GnuboatNotFound(
                 detail="Could not find the manager with id {}".format(manager)
             )
Index: src/gnuboat/mapservice_impl/demo/DbSetup.py
===================================================================
--- src/gnuboat/mapservice_impl/demo/DbSetup.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ src/gnuboat/mapservice_impl/demo/DbSetup.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -23,4 +23,7 @@
     db, User, ApiKey, Water,
     OsmType, Gauge, Device, Log, Queue, ProcessingStatus, db_setup
+)
+from gnuboat.common.webservice.HttpErrors import (
+    GnuboatBadRequest
 )
 from gnuboat.mapservice_impl.tasks.tasks import log_process
@@ -200,5 +203,5 @@
     ).all()
     if len(processing_state) != 1:
-        raise MapserviceBadRequest(
+        raise GnuboatBadRequest(
             detail='Processing status Queued for Parsing not found database'
         )
Index: src/gnuboat/mapservice_impl/tests/__init__.py
===================================================================
--- src/gnuboat/mapservice_impl/tests/__init__.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
+++ src/gnuboat/mapservice_impl/tests/__init__.py	(revision f9321aa08da1df127707bea0ebe5b5d4a6ca01d9)
@@ -0,0 +1,85 @@
+'''
+    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
+
+    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/>.
+'''
+
+import logging
+
+import flask
+import connexion
+from flask_cors import CORS
+from flask_mail import Mail
+from sqlalchemy.event import listen
+from celery import Celery
+import tempfile
+import os
+from PIL import Image
+import shutil
+
+from gnuboat.mapservice.encoder import JSONEncoder
+from gnuboat.mapservice_impl.database.Model import (
+    db, db_setup, load_spatialite
+)
+from gnuboat.mapservice_impl.tests import db_test_setup
+
+
+def create_app(testcase):
+    logging.getLogger('connexion.operation').setLevel('ERROR')
+    app = connexion.App(__name__,
+        specification_dir='../../mapservice/openapi/')
+    application = app.app
+    CORS(application)
+    mail = Mail()
+    application.json_encoder = JSONEncoder
+    app.add_api('openapi.yaml')
+
+    application.config.from_object(
+        'gnuboat.mapservice_impl.Config.TestingConfig')
+    application.template_folder = os.path.join(os.path.dirname(__file__),
+        '../../mapservice_impl/templates')
+    celery = Celery(__name__, broker=application.config['CELERY_BROKER_URL'])
+    celery.config_from_object(application.config)
+    mail.init_app(application)
+    db.init_app(application)
+    application.app_context().push()
+
+    _create_test_tile(testcase, application)
+
+    return application
+
+
+def setUp(testcase):
+    listen(db.engine, 'connect', load_spatialite)
+    db.drop_all()
+    # create the tables whether the database already exists or not
+    db_setup(True)
+    testcase.db_content = db_test_setup.DatabaseContent()
+    testcase.db_content.setup()
+
+
+def tearDown(testcase):
+    db.session.remove()
+    db.drop_all()
+    shutil.rmtree(testcase.tiles_cache)
+
+
+def _create_test_tile(testcase, application):
+    testcase.tiles_cache = tempfile.mkdtemp(prefix='gnuboat-tests')
+    application.config['TILES_CACHE_PATH'] = testcase.tiles_cache
+
+    tile_path = os.path.join(testcase.tiles_cache, '100_100/256/15/17298/')
+    os.makedirs(tile_path)
+    img = Image.new('RGBA', (100, 100), (255, 0, 0, 0))
+    img.save(os.path.join(tile_path, "21435.png"), "PNG")
Index: c/gnuboat/mapservice_impl/tests/test_config.py
===================================================================
--- src/gnuboat/mapservice_impl/tests/test_config.py	(revision 691c4ca45b0b5da2250afa6dc366401996aef815)
+++ 	(revision )
@@ -1,54 +1,0 @@
-'''
-    Copyright (C) 2020 EngSaS - Langenbach. All rights reserved.
-
-    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/>.
-'''
-
-import unittest
-import tempfile
-import yaml
-import os
-
-from gnuboat.mapservice_impl import Config
-
-
-class TestConfig(unittest.TestCase):
-    def test_config_from_file(self):
-        """Test case load config from file
-        """
-        new_config = {'TESTING': True, 'DOES_NOT_EXISTS': 1234}
-
-        config = Config.Config()
-        assert config.TESTING is False
-
-        config_file = tempfile.NamedTemporaryFile(
-            mode='w', prefix='gnuboat-test-config', delete=False
-        )
-        yaml.dump(
-            new_config,
-            config_file,
-            default_flow_style=False,
-            allow_unicode=True
-        )
-        config_file.close()
-        config_file = os.path.join(tempfile.gettempdir(), config_file.name)
-
-        config = Config.load_from_file(config_file)
-        assert config.TESTING is True
-        assert config.DOES_NOT_EXISTS == 1234
-        os.remove(config_file)
-
-
-if __name__ == '__main__':
-    unittest.main()
