Commit 4d47ba0d authored by Daniel Seybold's avatar Daniel Seybold

inital version of Docker container

parents
Pipeline #9732 passed with stage
in 7 minutes and 34 seconds
# Base runtime
image: docker:latest
# Docker as a service
services:
- docker:dind
# Stages declaration (add names as required)
stages:
- pack
# Pack stage (docker build)
pack:
stage: pack
script:
# Login to the registry. the variable is automatically set, build and push
- TS=$(date +%Y%m%d%H%M)
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build --no-cache -t $CI_REGISTRY_IMAGE:$TS .
- docker push $CI_REGISTRY_IMAGE:$TS
- docker tag $CI_REGISTRY_IMAGE:$TS $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
# select operating system
FROM ubuntu:16.04
# install operating system packages
RUN apt-get update -y && apt-get install git curl gettext unzip wget software-properties-common python-software-properties dnsutils make -y && \
apt-get upgrade -y
## add more packages, if necessary
# install Java8
RUN add-apt-repository ppa:webupd8team/java -y && apt-get update && apt-get -y install openjdk-8-jdk
# install apache2 and UI
#RUN add-apt-repository ppa:ondrej/php -y && apt-get update && apt-get install -y apache2
# Causes issues as tzdata is not installed and requires manual interaction!
#RUN apt-get install -y php5.6 --allow-unauthenticated
#RUN apt-get install -y php5.6-curl php5.6-xml && a2enmod rewrite
#RUN git clone https://github.com/cloudiator/ui.git && rm -f /etc/apache2/sites-enabled/* && cp /opt/docker-init/ui.conf /etc/apache2/sites-enabled/
#RUN rm -rf /var/www/html/ui && mv ui /var/www/html/ && chown www-data:www-data /var/www/html/ui
# use bpkg to handle complex bash entrypoints
RUN curl -Lo- "https://raw.githubusercontent.com/bpkg/bpkg/master/setup.sh" | bash
RUN bpkg install cha87de/bashutil -g
## add more bash dependencies, if necessary
# add config and init files
ADD config /etc/docker-config
ADD init /opt/docker-init
# install colosseum
RUN mkdir -p /opt/cloudiator && cp /opt/docker-init/colosseum-0.2.0-SNAPSHOT.zip /opt/cloudiator/colosseum-0.2.0-SNAPSHOT.zip
WORKDIR /opt/cloudiator
RUN unzip colosseum-0.2.0-SNAPSHOT.zip
RUN mkdir /opt/cloudiator/colosseum-0.2.0-SNAPSHOT/conf
# start from init folder
WORKDIR /opt/docker-init
ENTRYPOINT ["./entrypoint"]
\ No newline at end of file
### Docker-based deployment of the Db-Evaluator
------
Creates a docker container of the DBBench branch for colosseum 0.2.0
TODO: create docker compose file for additonal services mariaDB
------
#### Acknowledgements
The Docker container is build based on the best practice guidelines of the the [docker-skeleton](https://github.com/cha87de/docker-skeleton).
\ No newline at end of file
# This is the main configuration file for the application.
# ~~~~~
# The application languages
# ~~~~~
application.langs = "en"
# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# application.global=Global
# Router
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point.
# Furthermore, it's assumed your route file is named properly.
# So for an application router like `conf/my.application.Router`,
# you may need to define a router file `my.application.routes`.
# Default to Routes in the root package (and `conf/routes`)
# application.router=my.application.Routes
# Hibernate configuration
# ~~~~
jpa.default = defaultPersistenceUnit
db.default.jndiName = DefaultDS
play.db.prototype.hikaricp.connectionTimeout = 60 s
play.db.prototype.hikaricp.maximumPoolSize = 50
# Modules
play.modules.enabled += "InitModule"
play.modules.enabled += "models.service.JPAModule"
play.modules.enabled += "models.service.DatabaseServiceModule"
play.modules.enabled += "dtos.conversion.ConverterModule"
play.modules.enabled += "cloud.config.CloudModule"
play.modules.enabled += "cloud.sync.config.SolutionModule"
play.modules.enabled += "components.job.config.JobModule"
play.modules.enabled += "components.execution.ExecutionModule"
play.modules.enabled += "components.scalability.ScalingEngineModule"
play.modules.enabled += "components.scalability.AggregationModule"
play.modules.enabled += "components.log.LogCollectorModule"
play.modules.enabled += "components.model.config.ModelValidationModule"
play.modules.enabled += "components.auth.config.DatabaseTokenStoreModule"
# Colosseum node group
# All virtual machines user by colosseum will be prefixed with
# this String, allowing colosseum to identify machines managed
# by it.
# Please note: changing this during runtime, will cause
# serious problems :)
colosseum.nodegroup = "colosseum"
# ExecutionService Thread
# defaults to 10
colosseum.execution.thread = 20
# Loads the converters used for converting the data transfer objects (dto) to model objects.
colosseum.conversion.package = "dtos.conversion"
colosseum.conversion.converters = "dtos.conversion.converters"
# API token validity in milliseconds.
colosseum.auth.token.validity = 30000
# Enables model validation
colosseum.model.validation = true
## Sync ##
# Enables the virtual machine not in database detector. May lead to deletion of virtual machines!
# For debugging purposes, this should be disabled.
colosseum.sync.virtualMachineNotInDatabase.detector = false
# Enables detection of virtual machines that are in error state.
colosseum.sync.virtualMachineError.detector = false
# Enables detection of instance that are in error state.
colosseum.sync.instanceError.detector = false
# Directly deletes failed instances. Needs to be enabled if instances should be restarted as
# otherwise port conflicts are likely.
colosseum.deleteFailedInstances = false
# Will detect if a virtual machine is not bound to any instance. If yes, this virtual
# machine will be deleted.
colosseum.sync.virtualMachineIsEmpty.detector = false
# RMI
colosseum.rmi.timeout = 180000
## Installers ##
# Number of parallel downloads on the remote machine
# Multiple threads (multiple commands via one ssh connection) may cause problems on some operating systems (e.g. CENTOS)
colosseum.installer.download.threads = 1
# Java download path
colosseum.installer.linux.java.download = "http://javadl.sun.com/webapps/download/AutoDL?BundleId=106240"
colosseum.installer.windows.java.download = "http://javadl.sun.com/webapps/download/AutoDL?BundleId=107100"
# 7ZIP download path, used for extracting binary zip distribution on windows.
colosseum.installer.windows.7zip.download = "http://7-zip.org/a/7za920.zip"
# KairosDB download path
colosseum.installer.abstract.kairosdb.download = "https://github.com/kairosdb/kairosdb/releases/download/v0.9.4/kairosdb-0.9.4-6.tar.gz"
# KairosDB installation flag. If set to false, KairosDB will not be installed
colosseum.installer.linux.kairosdb.install.flag = false
colosseum.installer.windows.kairosdb.install.flag = true
# Visor download path
colosseum.installer.abstract.visor.download = "https://oss.sonatype.org/content/repositories/snapshots/io/github/cloudiator/visor/visor-service/0.3.0-SNAPSHOT/visor-service-0.3.0-20180219.105415-1.jar"
colosseum.installer.linux.visor.install.flag = false
# Visor configuration options
colosseum.installer.abstract.visor.config.executionThreads = "20"
colosseum.installer.abstract.visor.config.reportingInterval = "10"
colosseum.installer.abstract.visor.config.telnetPort = "9001"
colosseum.installer.abstract.visor.config.restHost = "http://0.0.0.0"
colosseum.installer.abstract.visor.config.restPort = "31415"
colosseum.installer.abstract.visor.config.kairosServer = "localhost"
colosseum.installer.abstract.visor.config.kairosPort = "8080"
colosseum.installer.abstract.visor.config.reportingModule = "de.uniulm.omi.cloudiator.visor.reporting.kairos.KairosReportingModule"
colosseum.installer.abstract.visor.config.chukwaUrl = "http://localhost:8080/chukwa"
colosseum.installer.abstract.visor.init = ""
# Lance download path
colosseum.installer.abstract.lance.download = "https://oss.sonatype.org/content/repositories/snapshots/io/github/cloudiator/lance/server/0.2.0-SNAPSHOT/server-0.2.0-20171122.122528-54-jar-with-dependencies.jar"
# Lance configuration options
colosseum.installer.abstract.lance.rmiPort = "1099"
colosseum.installer.abstract.lance.serverPort = "33033"
colosseum.installer.linux.lance.docker.install.flag = false
# hotfix for lance being not compatible with the latest docker version
colosseum.installer.linux.lance.docker_retry.download = "https://raw.githubusercontent.com/cloudiator/lance/master/install/docker_retry_fix_version.sh"
# colosseum.installer.linux.lance.docker_retry.download = "https://raw.githubusercontent.com/cloudiator/lance/master/install/docker_retry.sh"
colosseum.installer.linux.lance.docker.mtu.download = "https://raw.githubusercontent.com/cloudiator/colosseum/master/resources/fix_mtu.sh"
# Axe
# address of the TSDB to report to
colosseum.scalability.tsdb.host.default = "127.0.0.1"
# config of Visor that is used by axe to access:
colosseum.scalability.visor.port = 31415
colosseum.scalability.visor.telnet.port = 9001
colosseum.scalability.visor.mca.telnet.port = 27182
# rmi configuration that is also used by axe
colosseum.scalability.aggregator.rmi.host = "127.0.0.1"
colosseum.scalability.aggregator.rmi.key = "Aggregator"
colosseum.scalability.aggregator.rmi.port = 33039
# colosseum details that are used from axe to access colosseum
colosseum.scalability.aggregator.agent.local.protocol = "http"
colosseum.scalability.aggregator.agent.local.ip = "localhost"
colosseum.scalability.aggregator.agent.local.port = 9000
colosseum.scalability.aggregator.agent.local.username = "john.doe@example.com"
colosseum.scalability.aggregator.agent.local.tenant = "admin"
colosseum.scalability.aggregator.agent.local.password = "admin"
# colosseum details that are used from scaling actions remotely to access colosseum
colosseum.scalability.aggregator.scalingaction.protocol = "http"
colosseum.scalability.aggregator.scalingaction.ip = "localhost"
colosseum.scalability.aggregator.scalingaction.port = 9000
colosseum.scalability.aggregator.scalingaction.username = "john.doe@example.com"
colosseum.scalability.aggregator.scalingaction.tenant = "admin"
colosseum.scalability.aggregator.scalingaction.password = "admin"
# Log Collection
colosseum.log.colosseumLogPath = "logs/application.log"
colosseum.log.lanceFileName = "lance.out"
include application.conf
play.crypto.secret="fQpv4t89xfsMASn1QHXOv66FSqTH9R"
db.default.driver=org.mariadb.jdbc.Driver
db.default.url="mysql://$MYSQLUSER:$MYSQLPW@localhost/$MYSQLSB"
colosseum.nodegroup="db-evaluator"
\ No newline at end of file
<!--
~ Copyright (c) 2014-2016 University of Ulm
~
~ See the NOTICE file distributed with this work for additional information
~ regarding copyright ownership. 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.
-->
<configuration>
<appender name="APPFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/application.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- Daily rollover with compression -->
<fileNamePattern>logs/application-log-%d{yyyy-MM-dd}.gz</fileNamePattern>
<!-- keep 30 days worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss ZZZZ} [%level] from %logger in %thread -
%message%n%xException
</pattern>
</encoder>
</appender>
<appender name="JCLOUDS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/jclouds.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 50MB -->
<maxFileSize>50MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- Daily rollover with compression -->
<fileNamePattern>logs/jclouds-log-%d{yyyy-MM-dd}.gz</fileNamePattern>
<!-- keep 30 days worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss ZZZZ} [%level] from %logger in %thread -
%message%n%xException
</pattern>
</encoder>
</appender>
<appender name="PLAY" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/play.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- Daily rollover with compression -->
<fileNamePattern>logs/play-log-%d{yyyy-MM-dd}.gz</fileNamePattern>
<!-- keep 30 days worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss ZZZZ} [%level] from %logger in %thread -
%message%n%xException
</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss ZZZZ} [%level] from %logger in %thread -
%message%n%xException
</pattern>
</encoder>
</appender>
<logger name="root" level="WARN"/>
<logger name="application" level="DEBUG"/>
<logger name="colosseum.execution" level="ERROR"/>
<logger name="colosseum.cloud.sync" level="ERROR"/>
<logger name="colosseum.cloud.remote" level="DEBUG"/>
<logger name="colosseum.cloud.job" level="DEBUG"/>
<logger name="colosseum.cloud.installation" level="DEBUG"/>
<logger name="colosseum.database" level="DEBUG"/>
<logger name="colosseum.api" level="DEBUG"/>
<logger name="colosseum.model" level="DEBUG"/>
<logger name="colosseum.system" level="DEBUG"/>
<logger name="colosseum.auth" level="ERROR"/>
<logger name="jclouds.wire" level="TRACE" additivity="false">
<appender-ref ref="JCLOUDS"/>
</logger>
<logger name="play" level="DEBUG" additivity="false">
<appender-ref ref="PLAY"/>
</logger>
<root level="ERROR">
<appender-ref ref="STDOUT"/>
<appender-ref ref="APPFILE"/>
</root>
</configuration>
#!/bin/bash
# include bpkg dependencies
source /usr/local/bin/retry
source /usr/local/bin/bgo
source /usr/local/bin/bgowait
# global variables
GLOBAL_VAR="xyz"
##############################################################################
# validate if all container variables are set
##############################################################################
function validate(){
vars="MYSQLPW MYSQLUSER MYSQLDB"
for var in $vars; do
if [[ $(env | awk -F "=" '{print $1}' | grep "^$var$") != "$var" ]]; then
echo "$var not set but required."
return 1
fi
done
if [[ -z ${GLOBAL_VAR+x} ]]; then
echo "GLOBAL_VAR variable cannot be looked up."
return 1
fi
}
##############################################################################
# write config vars with configfile template
##############################################################################
function writeConfigOptions(){
echo "write config options"
export MYSQLPW=$MYSQLPW
export MYSQLUSER=$MYSQLUSER
export MYSQLDB=$MYSQLDB
#cat /etc/docker-conf/configfile.conf.tmpl | envsubst > /etc/docker-conf/configfile.conf
cat /etc/docker-config/colosseum.conf | envsubst > /opt/cloudiator/colosseum-0.2.0-SNAPSHOT/conf/conf.conf
cp /etc/docker-config/application.conf /opt/cloudiator/colosseum-0.2.0-SNAPSHOT/conf/
cp /etc/docker-config/logback.xml /opt/cloudiator/colosseum-0.2.0-SNAPSHOT/conf/
}
function init(){
## pre-config initialization
# write file based config options
writeConfigOptions
## post-config initialization
}
##############################################################################
function start_ui(){
echo "UI currently not activated!"
#service apache2 restart
}
function start_colosseum(){
# resolve public IP
PUBLIC_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
echo "starting colosseum..."
/opt/cloudiator/colosseum-0.2.0-SNAPSHOT/bin/colosseum -Dconfig.file=/opt/cloudiator/colosseum-0.2.0-SNAPSHOT/conf/config.conf -Dlca.client.config.registry=etcdregistry -Dlca.client.config.registry.etcd.hosts=${PUBLIC_IP} 2>&1 >> /var/log/colosseum.log
}
function colosseum_service(){
echo "starting colosseum..."
start_colosseum
echo "starting ui"
start_ui
# whatever blocking call
tail -f /dev/null
}
function start(){
echo "starting applications..."
bgo colosseum_service
if [[ $? != 0 ]]; then
echo "start failed. exiting now." >&2
exit 1
fi
}
##############################################################################
function configure(){
echo "configure: ..."
## post-start configuration via service
}
##############################################################################
function main(){
# validate env vars
validate
if [[ $? != 0 ]]; then
echo "validation failed. exiting now." >&2
exit 1
fi
# initialize
init
if [[ $? != 0 ]]; then
echo "init failed. exiting now." >&2
exit 1
fi
# start
start
if [[ $? != 0 ]]; then
echo "start failed. exiting now." >&2
exit 1
fi
# configure
retry 5 5 "configure failed." configure
if [[ $? != 0 ]]; then
echo "cannot run configure." >&2
exit 1
fi
# wait
echo "done. now waiting for services."
#freq=5; waitForN=-1; killTasks=0 # fail one, ignore (development mode)
freq=5; waitForN=1; killTasks=1 #fail one, fail all (production mode)
bgowait $freq $waitForN $killTasks
}
if [[ "$1" == "" ]]; then
main
else
exec "$@"
fi
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/ui>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
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