From 3a3ef627f0d88c58f34b6d2bdf86530092bdbb3c Mon Sep 17 00:00:00 2001 From: BreadSpoon Date: Fri, 6 Mar 2020 20:48:09 +0000 Subject: [PATCH 1/4] make Dockerfiles build ready for easier updates in the future --- ApacheDerby/Dockerfile | 4 +- MariaDB/db/Dockerfile | 136 ++++++++- MariaDB/db/docker-entrypoint.sh | 12 +- MariaDB/klaros/Dockerfile | 2 +- Microsoft SQL Server/klaros/Dockerfile | 2 +- MySQL/db/Dockerfile | 85 +++++- MySQL/db/docker-entrypoint.sh | 12 +- MySQL/klaros/Dockerfile | 4 +- PostgreSQL/db/Dockerfile | 158 ++++++++++- PostgreSQL/db/docker-entrypoint.sh | 378 +++++++++++++++++-------- PostgreSQL/klaros/Dockerfile | 4 +- 11 files changed, 661 insertions(+), 136 deletions(-) diff --git a/ApacheDerby/Dockerfile b/ApacheDerby/Dockerfile index c1eb2af..794fadc 100644 --- a/ApacheDerby/Dockerfile +++ b/ApacheDerby/Dockerfile @@ -38,7 +38,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.5} +ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base @@ -68,4 +68,4 @@ RUN chmod +x /.start.sh VOLUME /data -CMD [ "/.start.sh", "run" ] \ No newline at end of file +CMD [ "/.start.sh", "run" ] diff --git a/MariaDB/db/Dockerfile b/MariaDB/db/Dockerfile index fa22ca8..42308fd 100644 --- a/MariaDB/db/Dockerfile +++ b/MariaDB/db/Dockerfile @@ -1,5 +1,137 @@ -FROM verit/klaros-mariadb_db:4.12.5 +# vim:set ft=dockerfile: +FROM ubuntu:bionic LABEL maintainer "BreadSpoon " +# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added +RUN groupadd -r mysql && useradd -r -g mysql mysql + +# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg) +RUN set -ex; \ + apt-get update; \ + if ! which gpg; then \ + apt-get install -y --no-install-recommends gnupg; \ + fi; \ + if ! gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \ +# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr +# so, if we're not running gnupg 1.x, explicitly install dirmngr too + apt-get install -y --no-install-recommends dirmngr; \ + fi; \ + rm -rf /var/lib/apt/lists/* + +# add gosu for easy step-down from root +ENV GOSU_VERSION 1.10 +RUN set -ex; \ + \ + fetchDeps=' \ + ca-certificates \ + wget \ + '; \ + apt-get update; \ + apt-get install -y --no-install-recommends $fetchDeps; \ + rm -rf /var/lib/apt/lists/*; \ + \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + \ +# verify the signature + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + \ + chmod +x /usr/local/bin/gosu; \ +# verify that the binary works + gosu nobody true; \ + \ + apt-get purge -y --auto-remove $fetchDeps + +RUN mkdir /docker-entrypoint-initdb.d + +# install "pwgen" for randomizing passwords +# install "tzdata" for /usr/share/zoneinfo/ +# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files +RUN set -ex; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + pwgen \ + tzdata \ + xz-utils \ + ; \ + rm -rf /var/lib/apt/lists/* + +ENV GPG_KEYS \ +# pub rsa4096 2016-03-30 [SC] +# 177F 4010 FE56 CA33 3630 0305 F165 6F24 C74C D1D8 +# uid [ unknown] MariaDB Signing Key +# sub rsa4096 2016-03-30 [E] + 177F4010FE56CA3336300305F1656F24C74CD1D8 +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys "$key"; \ + done; \ + gpg --batch --export $GPG_KEYS > /etc/apt/trusted.gpg.d/mariadb.gpg; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -r "$GNUPGHOME"; \ + apt-key list + +# bashbrew-architectures: amd64 arm64v8 ppc64le +ENV MARIADB_MAJOR 10.4 +ENV MARIADB_VERSION 1:10.4.12+maria~bionic +# release-status:Stable +# (https://downloads.mariadb.org/mariadb/+releases/) + +RUN set -e;\ + echo "deb http://ftp.osuosl.org/pub/mariadb/repo/$MARIADB_MAJOR/ubuntu bionic main" > /etc/apt/sources.list.d/mariadb.list; \ + { \ + echo 'Package: *'; \ + echo 'Pin: release o=MariaDB'; \ + echo 'Pin-Priority: 999'; \ + } > /etc/apt/preferences.d/mariadb +# add repository pinning to make sure dependencies from this MariaDB repo are preferred over Debian dependencies +# libmariadbclient18 : Depends: libmysqlclient18 (= 5.5.42+maria-1~wheezy) but 5.5.43-0+deb7u1 is to be installed + +# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) +# also, we set debconf keys to make APT a little quieter +RUN set -ex; \ + { \ + echo "mariadb-server-$MARIADB_MAJOR" mysql-server/root_password password 'unused'; \ + echo "mariadb-server-$MARIADB_MAJOR" mysql-server/root_password_again password 'unused'; \ + } | debconf-set-selections; \ + apt-get update; \ + apt-get install -y \ + "mariadb-server=$MARIADB_VERSION" \ +# mariadb-backup is installed at the same time so that `mysql-common` is only installed once from just mariadb repos + mariadb-backup \ + socat \ + ; \ + rm -rf /var/lib/apt/lists/*; \ +# comment out any "user" entires in the MySQL config ("docker-entrypoint.sh" or "--user" will handle user switching) + sed -ri 's/^user\s/#&/' /etc/mysql/my.cnf /etc/mysql/conf.d/*; \ +# purge and re-create /var/lib/mysql with appropriate ownership + rm -rf /var/lib/mysql; \ + mkdir -p /var/lib/mysql /var/run/mysqld; \ + chown -R mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 777 /var/run/mysqld; \ +# comment out a few problematic configuration values + find /etc/mysql/ -name '*.cnf' -print0 \ + | xargs -0 grep -lZE '^(bind-address|log)' \ + | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \ +# don't reverse lookup hostnames, they are usually another container + echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf + + +COPY docker-entrypoint.sh /usr/local/bin/ + COPY *.cnf /etc/mysql/mariadb.conf.d -RUN chmod 444 /etc/mysql/mariadb.conf.d/mysqld.cnf \ No newline at end of file +RUN chmod 444 /etc/mysql/mariadb.conf.d/mysqld.cnf +RUN chmod 777 /usr/local/bin/docker-entrypoint.sh + +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 3306 +CMD ["mysqld"] \ No newline at end of file diff --git a/MariaDB/db/docker-entrypoint.sh b/MariaDB/db/docker-entrypoint.sh index 62111e1..d633226 100644 --- a/MariaDB/db/docker-entrypoint.sh +++ b/MariaDB/db/docker-entrypoint.sh @@ -61,6 +61,7 @@ docker_process_init_files() { *.sh) mysql_note "$0: running $f"; . "$f" ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *) mysql_warn "$0: ignoring $f" ;; esac echo @@ -126,6 +127,7 @@ docker_verify_minimum_env() { docker_create_db_directories() { local user; user="$(id -u)" + # TODO other directories that are used by default? like /var/lib/mysql-files # see https://github.com/docker-library/mysql/issues/562 mkdir -p "$DATADIR" @@ -186,7 +188,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -221,11 +223,13 @@ docker_setup_db() { -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; + DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; -- 10.1: https://github.com/MariaDB/server/blob/d925aec1c10cebf6c34825a7de50afe4e630aff4/scripts/mysql_secure_installation.sh#L347-L365 -- 10.5: https://github.com/MariaDB/server/blob/00c3a28820c67c37ebbca72691f4897b57f2eed5/scripts/mysql_secure_installation.sh#L351-L369 DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; + GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; FLUSH PRIVILEGES ; ${rootCreate} @@ -254,7 +258,7 @@ docker_setup_db() { _mysql_passfile() { # echo the password to the "file" the client uses # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( _mysql_passfile ) + # ie: --defaults-extra-file=<( _mysql_passfile ) if [ '--dont-use-mysql-root-password' != "$1" ] && [ -n "$MYSQL_ROOT_PASSWORD" ]; then cat <<-EOF [client] @@ -301,6 +305,10 @@ _main() { # there's no database, so it needs to be initialized if [ -z "$DATABASE_ALREADY_EXISTS" ]; then docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + docker_init_database_dir "$@" mysql_note "Starting temporary server" diff --git a/MariaDB/klaros/Dockerfile b/MariaDB/klaros/Dockerfile index 96df453..d0a607a 100644 --- a/MariaDB/klaros/Dockerfile +++ b/MariaDB/klaros/Dockerfile @@ -32,7 +32,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.5} +ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base diff --git a/Microsoft SQL Server/klaros/Dockerfile b/Microsoft SQL Server/klaros/Dockerfile index 96df453..d0a607a 100644 --- a/Microsoft SQL Server/klaros/Dockerfile +++ b/Microsoft SQL Server/klaros/Dockerfile @@ -32,7 +32,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.5} +ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base diff --git a/MySQL/db/Dockerfile b/MySQL/db/Dockerfile index 77ea104..34e9207 100644 --- a/MySQL/db/Dockerfile +++ b/MySQL/db/Dockerfile @@ -1,5 +1,86 @@ -FROM verit/klaros-mysql_db:4.12.5 +FROM debian:buster-slim LABEL maintainer "BreadSpoon " +# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added +RUN groupadd -r mysql && useradd -r -g mysql mysql + +RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* + +# add gosu for easy step-down from root +ENV GOSU_VERSION 1.7 +RUN set -x \ + && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ + && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ + && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ + && export GNUPGHOME="$(mktemp -d)" \ + && gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ + && gpgconf --kill all \ + && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ + && chmod +x /usr/local/bin/gosu \ + && gosu nobody true \ + && apt-get purge -y --auto-remove ca-certificates wget + +RUN mkdir /docker-entrypoint-initdb.d + +RUN apt-get update && apt-get install -y --no-install-recommends \ +# for MYSQL_RANDOM_ROOT_PASSWORD + pwgen \ +# for mysql_ssl_rsa_setup + openssl \ +# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: +# File::Basename +# File::Copy +# Sys::Hostname +# Data::Dumper + perl \ +# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files + xz-utils \ + && rm -rf /var/lib/apt/lists/* + +RUN set -ex; \ +# gpg: key 5072E1F5: public key "MySQL Release Engineering " imported + key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys "$key"; \ + gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + apt-key list > /dev/null + +ENV MYSQL_MAJOR 5.7 +ENV MYSQL_VERSION 5.7.29-1debian10 + +RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list + +# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) +# also, we set debconf keys to make APT a little quieter +RUN { \ + echo mysql-community-server mysql-community-server/data-dir select ''; \ + echo mysql-community-server mysql-community-server/root-pass password ''; \ + echo mysql-community-server mysql-community-server/re-root-pass password ''; \ + echo mysql-community-server mysql-community-server/remove-test-db select false; \ + } | debconf-set-selections \ + && apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \ + && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ + && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + && chmod 777 /var/run/mysqld \ +# comment out a few problematic configuration values + && find /etc/mysql/ -name '*.cnf' -print0 \ + | xargs -0 grep -lZE '^(bind-address|log)' \ + | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ +# don't reverse lookup hostnames, they are usually another container + && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf + +COPY docker-entrypoint.sh /usr/local/bin/ + COPY *.cnf /etc/mysql/mysql.conf.d -RUN chmod 444 /etc/mysql/mysql.conf.d/mysqld.cnf \ No newline at end of file +RUN chmod 444 /etc/mysql/mysql.conf.d/mysqld.cnf +RUN chmod 777 /usr/local/bin/docker-entrypoint.sh + +RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 3306 33060 +CMD ["mysqld"] \ No newline at end of file diff --git a/MySQL/db/docker-entrypoint.sh b/MySQL/db/docker-entrypoint.sh index 6a5c7e8..077a2eb 100644 --- a/MySQL/db/docker-entrypoint.sh +++ b/MySQL/db/docker-entrypoint.sh @@ -61,6 +61,7 @@ docker_process_init_files() { *.sh) mysql_note "$0: running $f"; . "$f" ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *) mysql_warn "$0: ignoring $f" ;; esac echo @@ -133,6 +134,7 @@ docker_verify_minimum_env() { docker_create_db_directories() { local user; user="$(id -u)" + # TODO other directories that are used by default? like /var/lib/mysql-files # see https://github.com/docker-library/mysql/issues/562 mkdir -p "$DATADIR" @@ -196,7 +198,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -282,7 +284,7 @@ docker_setup_db() { _mysql_passfile() { # echo the password to the "file" the client uses # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( _mysql_passfile ) + # ie: --defaults-extra-file=<( _mysql_passfile ) if [ '--dont-use-mysql-root-password' != "$1" ] && [ -n "$MYSQL_ROOT_PASSWORD" ]; then cat <<-EOF [client] @@ -339,6 +341,10 @@ _main() { # there's no database, so it needs to be initialized if [ -z "$DATABASE_ALREADY_EXISTS" ]; then docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + docker_init_database_dir "$@" mysql_note "Starting temporary server" @@ -365,4 +371,4 @@ _main() { # If we are sourced from elsewhere, don't perform any further actions if ! _is_sourced; then _main "$@" -fi +fi \ No newline at end of file diff --git a/MySQL/klaros/Dockerfile b/MySQL/klaros/Dockerfile index 96df453..9fe8774 100644 --- a/MySQL/klaros/Dockerfile +++ b/MySQL/klaros/Dockerfile @@ -32,7 +32,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.5} +ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base @@ -58,4 +58,4 @@ RUN set -ex \ /root/klaros-testmanagement/webapps/ROOT.war \ && chmod +x /root/catalina-wrapper.sh -CMD [ "/root/catalina-wrapper.sh" ] \ No newline at end of file +CMD [ "/root/catalina-wrapper.sh" ] diff --git a/PostgreSQL/db/Dockerfile b/PostgreSQL/db/Dockerfile index b705028..b916600 100644 --- a/PostgreSQL/db/Dockerfile +++ b/PostgreSQL/db/Dockerfile @@ -1,2 +1,156 @@ -FROM verit/klaros-postgresql_db:4.12.5 -LABEL maintainer "BreadSpoon " \ No newline at end of file +# vim:set ft=dockerfile: +FROM alpine:3.11 +LABEL maintainer "BreadSpoon " + +# 70 is the standard uid/gid for "postgres" in Alpine +# https://git.alpinelinux.org/aports/tree/main/postgresql/postgresql.pre-install?h=3.11-stable +RUN set -eux; \ + addgroup -g 70 -S postgres; \ + adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \ + mkdir -p /var/lib/postgresql; \ + chown -R postgres:postgres /var/lib/postgresql + +# su-exec (gosu-compatible) is installed further down + +# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default +# alpine doesn't require explicit locale-file generation +ENV LANG en_US.utf8 + +RUN mkdir /docker-entrypoint-initdb.d + +ENV PG_MAJOR 12 +ENV PG_VERSION 12.2 +ENV PG_SHA256 ad1dcc4c4fc500786b745635a9e1eba950195ce20b8913f50345bb7d5369b5de + +RUN set -ex \ + \ + && apk add --no-cache --virtual .fetch-deps \ + ca-certificates \ + openssl \ + tar \ + \ + && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ + && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ + && mkdir -p /usr/src/postgresql \ + && tar \ + --extract \ + --file postgresql.tar.bz2 \ + --directory /usr/src/postgresql \ + --strip-components 1 \ + && rm postgresql.tar.bz2 \ + \ + && apk add --no-cache --virtual .build-deps \ + bison \ + coreutils \ + dpkg-dev dpkg \ + flex \ + gcc \ +# krb5-dev \ + libc-dev \ + libedit-dev \ + libxml2-dev \ + libxslt-dev \ + linux-headers \ + llvm9-dev clang g++ \ + make \ +# openldap-dev \ + openssl-dev \ +# configure: error: prove not found + perl-utils \ +# configure: error: Perl module IPC::Run is required to run TAP tests + perl-ipc-run \ +# perl-dev \ +# python-dev \ +# python3-dev \ +# tcl-dev \ + util-linux-dev \ + zlib-dev \ + icu-dev \ + \ + && cd /usr/src/postgresql \ +# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian) +# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f + && awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \ + && grep '/var/run/postgresql' src/include/pg_config_manual.h.new \ + && mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ +# explicitly update autoconf config.guess and config.sub so they support more arches/libcs + && wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \ + && wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \ +# configure options taken from: +# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 + && ./configure \ + --build="$gnuArch" \ +# "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" +# --enable-nls \ + --enable-integer-datetimes \ + --enable-thread-safety \ + --enable-tap-tests \ +# skip debugging info -- we want tiny size instead +# --enable-debug \ + --disable-rpath \ + --with-uuid=e2fs \ + --with-gnu-ld \ + --with-pgport=5432 \ + --with-system-tzdata=/usr/share/zoneinfo \ + --prefix=/usr/local \ + --with-includes=/usr/local/include \ + --with-libraries=/usr/local/lib \ + \ +# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :) +# --with-krb5 \ +# --with-gssapi \ +# --with-ldap \ +# --with-tcl \ +# --with-perl \ +# --with-python \ +# --with-pam \ + --with-openssl \ + --with-libxml \ + --with-libxslt \ + --with-icu \ + --with-llvm \ + && make -j "$(nproc)" world \ + && make install-world \ + && make -C contrib install \ + \ + && runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )" \ + && apk add --no-cache --virtual .postgresql-rundeps \ + $runDeps \ + bash \ + su-exec \ +# tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation: +# https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration + tzdata \ + && apk del .fetch-deps .build-deps \ + && cd / \ + && rm -rf \ + /usr/src/postgresql \ + /usr/local/share/doc \ + /usr/local/share/man \ + && find /usr/local -name '*.a' -delete + +# make the sample config easier to munge (and "correct by default") +RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample + +RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql + +ENV PGDATA /data/postgres-data +# this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values) +RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA" + +COPY docker-entrypoint.sh /usr/local/bin/ +COPY ./*.sh /docker-entrypoint-initdb.d/ +COPY ./*.sql /docker-entrypoint-initdb.d/ +RUN chmod a+r /docker-entrypoint-initdb.d/* +RUN chmod 777 /usr/local/bin/docker-entrypoint.sh + +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 5432 +CMD ["postgres"] diff --git a/PostgreSQL/db/docker-entrypoint.sh b/PostgreSQL/db/docker-entrypoint.sh index 3ef2df5..b9576de 100644 --- a/PostgreSQL/db/docker-entrypoint.sh +++ b/PostgreSQL/db/docker-entrypoint.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -Eeo pipefail +# TODO swap to -Eeuo pipefail above (after handling all potentially-unset variables) # usage: file_env VAR [DEFAULT] # ie: file_env 'XYZ_DB_PASSWORD' 'example' @@ -23,154 +24,297 @@ file_env() { unset "$fileVar" } -if [ "${1:0:1}" = '-' ]; then - set -- postgres "$@" -fi +# check to see if this file is being run or sourced from another script +_is_sourced() { + # https://unix.stackexchange.com/a/215279 + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] +} + +# used to create initial postgres directories and if run as root, ensure ownership to the "postgres" user +docker_create_db_directories() { + local user; user="$(id -u)" -# allow the container to be started with `--user` -if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then mkdir -p "$PGDATA" - chown -R postgres "$PGDATA" chmod 700 "$PGDATA" - mkdir -p /var/run/postgresql - chown -R postgres /var/run/postgresql - chmod 775 /var/run/postgresql + # ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289 + mkdir -p /var/run/postgresql || : + chmod 775 /var/run/postgresql || : - # Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user - if [ "$POSTGRES_INITDB_WALDIR" ]; then + # Create the transaction log directory before initdb is run so the directory is owned by the correct user + if [ -n "$POSTGRES_INITDB_WALDIR" ]; then mkdir -p "$POSTGRES_INITDB_WALDIR" - chown -R postgres "$POSTGRES_INITDB_WALDIR" + if [ "$user" = '0' ]; then + find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' + + fi chmod 700 "$POSTGRES_INITDB_WALDIR" fi - exec su-exec postgres "$BASH_SOURCE" "$@" -fi + # allow the container to be started with `--user` + if [ "$user" = '0' ]; then + find "$PGDATA" \! -user postgres -exec chown postgres '{}' + + find /var/run/postgresql \! -user postgres -exec chown postgres '{}' + + fi +} -if [ "$1" = 'postgres' ]; then - mkdir -p "$PGDATA" - chown -R "$(id -u)" "$PGDATA" 2>/dev/null || : - chmod 700 "$PGDATA" 2>/dev/null || : +# initialize empty PGDATA directory with new database via 'initdb' +# arguments to `initdb` can be passed via POSTGRES_INITDB_ARGS or as arguments to this function +# `initdb` automatically creates the "postgres", "template0", and "template1" dbnames +# this is also where the database user is created, specified by `POSTGRES_USER` env +docker_init_database_dir() { + # "initdb" is particular about the current user existing in "/etc/passwd", so we use "nss_wrapper" to fake that if necessary + # see https://github.com/docker-library/postgres/pull/253, https://github.com/docker-library/postgres/issues/359, https://cwrap.org/nss_wrapper.html + if ! getent passwd "$(id -u)" &> /dev/null && [ -e /usr/lib/libnss_wrapper.so ]; then + export LD_PRELOAD='/usr/lib/libnss_wrapper.so' + export NSS_WRAPPER_PASSWD="$(mktemp)" + export NSS_WRAPPER_GROUP="$(mktemp)" + echo "postgres:x:$(id -u):$(id -g):PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD" + echo "postgres:x:$(id -g):" > "$NSS_WRAPPER_GROUP" + fi - # look specifically for PG_VERSION, as it is expected in the DB dir - if [ ! -s "$PGDATA/PG_VERSION" ]; then - # "initdb" is particular about the current user existing in "/etc/passwd", so we use "nss_wrapper" to fake that if necessary - # see https://github.com/docker-library/postgres/pull/253, https://github.com/docker-library/postgres/issues/359, https://cwrap.org/nss_wrapper.html - if ! getent passwd "$(id -u)" &> /dev/null && [ -e /usr/lib/libnss_wrapper.so ]; then - export LD_PRELOAD='/usr/lib/libnss_wrapper.so' - export NSS_WRAPPER_PASSWD="$(mktemp)" - export NSS_WRAPPER_GROUP="$(mktemp)" - echo "postgres:x:$(id -u):$(id -g):PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD" - echo "postgres:x:$(id -g):" > "$NSS_WRAPPER_GROUP" - fi + if [ -n "$POSTGRES_INITDB_WALDIR" ]; then + set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@" + fi - file_env 'POSTGRES_USER' 'postgres' - file_env 'POSTGRES_PASSWORD' + eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"' - file_env 'POSTGRES_INITDB_ARGS' - if [ "$POSTGRES_INITDB_WALDIR" ]; then - export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --waldir $POSTGRES_INITDB_WALDIR" - fi - eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS" + # unset/cleanup "nss_wrapper" bits + if [ "${LD_PRELOAD:-}" = '/usr/lib/libnss_wrapper.so' ]; then + rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP" + unset LD_PRELOAD NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP + fi +} - # unset/cleanup "nss_wrapper" bits - if [ "${LD_PRELOAD:-}" = '/usr/lib/libnss_wrapper.so' ]; then - rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP" - unset LD_PRELOAD NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP - fi +# print large warning if POSTGRES_PASSWORD is long +# error if both POSTGRES_PASSWORD is empty and POSTGRES_HOST_AUTH_METHOD is not 'trust' +# print large warning if POSTGRES_HOST_AUTH_METHOD is set to 'trust' +# assumes database is not set up, ie: [ -z "$DATABASE_ALREADY_EXISTS" ] +docker_verify_minimum_env() { + # check password first so we can output the warning before postgres + # messes it up + if [ "${#POSTGRES_PASSWORD}" -ge 100 ]; then + cat >&2 <<-'EOWARN' - # check password first so we can output the warning before postgres - # messes it up - if [ -n "$POSTGRES_PASSWORD" ]; then - authMethod=md5 + WARNING: The supplied POSTGRES_PASSWORD is 100+ characters. - if [ "${#POSTGRES_PASSWORD}" -ge 100 ]; then - cat >&2 <<-'EOWARN' + This will not work if used via PGPASSWORD with "psql". - WARNING: The supplied POSTGRES_PASSWORD is 100+ characters. + https://www.postgresql.org/message-id/flat/E1Rqxp2-0004Qt-PL%40wrigleys.postgresql.org (BUG #6412) + https://github.com/docker-library/postgres/issues/507 - This will not work if used via PGPASSWORD with "psql". + EOWARN + fi + if [ -z "$POSTGRES_PASSWORD" ] && [ 'trust' != "$POSTGRES_HOST_AUTH_METHOD" ]; then + # The - option suppresses leading tabs but *not* spaces. :) + cat >&2 <<-'EOE' + Error: Database is uninitialized and superuser password is not specified. + You must specify POSTGRES_PASSWORD to a non-empty value for the + superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run". - https://www.postgresql.org/message-id/flat/E1Rqxp2-0004Qt-PL%40wrigleys.postgresql.org (BUG #6412) - https://github.com/docker-library/postgres/issues/507 + You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all + connections without a password. This is *not* recommended. - EOWARN - fi - else - # The - option suppresses leading tabs but *not* spaces. :) - cat >&2 <<-'EOWARN' - **************************************************** - WARNING: No password has been set for the database. - This will allow anyone with access to the - Postgres port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - - Use "-e POSTGRES_PASSWORD=password" to set - it in "docker run". - **************************************************** - EOWARN - - authMethod=trust - fi + See PostgreSQL documentation about "trust": + https://www.postgresql.org/docs/current/auth-trust.html + EOE + exit 1 + fi + if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then + cat >&2 <<-'EOWARN' + ******************************************************************************** + WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow + anyone with access to the Postgres port to access your database without + a password, even if POSTGRES_PASSWORD is set. See PostgreSQL + documentation about "trust": + https://www.postgresql.org/docs/current/auth-trust.html + In Docker's default configuration, this is effectively any other + container on the same system. - { - echo - echo "host all all all $authMethod" - } >> "$PGDATA/pg_hba.conf" + It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace + it with "-e POSTGRES_PASSWORD=password" instead to set a password in + "docker run". + ******************************************************************************** + EOWARN + fi +} - # internal start of server in order to allow set-up using psql-client - # does not listen on external TCP/IP and waits until start finishes - PGUSER="${PGUSER:-$POSTGRES_USER}" \ - pg_ctl -D "$PGDATA" \ - -o "-c listen_addresses=''" \ - -w start +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions and permissions +docker_process_init_files() { + # psql here for backwards compatiblilty "${psql[@]}" + psql=( docker_process_sql ) - file_env 'POSTGRES_DB' "$POSTGRES_USER" + echo + local f + for f; do + case "$f" in + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + echo "$0: running $f" + "$f" + else + echo "$0: sourcing $f" + . "$f" + fi + ;; + *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo + done +} - export PGPASSWORD="${PGPASSWORD:-$POSTGRES_PASSWORD}" - psql=( psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --no-password ) +# Execute sql script, passed via stdin (or -f flag of pqsl) +# usage: docker_process_sql [psql-cli-args] +# ie: docker_process_sql --dbname=mydb <<<'INSERT ...' +# ie: docker_process_sql -f my-file.sql +# ie: docker_process_sql > "$PGDATA/pg_hba.conf" +} + +# start socket-only postgresql server for setting up or running scripts +# all arguments will be passed along as arguments to `postgres` (via pg_ctl) +docker_temp_server_start() { + if [ "$1" = 'postgres' ]; then + shift + fi + + # internal start of server in order to allow setup using psql client + # does not listen on external TCP/IP and waits until start finishes + set -- "$@" -c listen_addresses='' -p "${PGPORT:-5432}" + + PGUSER="${PGUSER:-$POSTGRES_USER}" \ + pg_ctl -D "$PGDATA" \ + -o "$(printf '%q ' "$@")" \ + -w start +} + +# stop postgresql server after done setting up user and running scripts +docker_temp_server_stop() { + PGUSER="${PGUSER:-postgres}" \ + pg_ctl -D "$PGDATA" -m fast -w stop +} + +# check arguments for an option that would cause postgres to stop +# return true if there is one +_pg_want_help() { + local arg + for arg; do + case "$arg" in + # postgres --help | grep 'then exit' + # leaving out -C on purpose since it always fails and is unhelpful: + # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory + -'?'|--help|--describe-config|-V|--version) + return 0 + ;; + esac + done + return 1 +} + +_main() { + # if first arg looks like a flag, assume we want to run postgres server + if [ "${1:0:1}" = '-' ]; then + set -- postgres "$@" + fi + + if [ "$1" = 'postgres' ] && ! _pg_want_help "$@"; then + docker_setup_env + # setup data directories and permissions (when run as root) + docker_create_db_directories + if [ "$(id -u)" = '0' ]; then + # then restart script as postgres user + exec su-exec postgres "$BASH_SOURCE" "$@" + fi + + # only run initialization on an empty data directory + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + + docker_init_database_dir + pg_setup_hba_conf + + # PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless + # e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS + export PGPASSWORD="${PGPASSWORD:-$POSTGRES_PASSWORD}" + docker_temp_server_start "$@" + + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + docker_temp_server_stop + unset PGPASSWORD + + echo + echo 'PostgreSQL init process complete; ready for start up.' + echo + else + echo + echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization' + echo + fi fi -fi -exec "$@" + exec "$@" +} +if ! _is_sourced; then + _main "$@" +fi \ No newline at end of file diff --git a/PostgreSQL/klaros/Dockerfile b/PostgreSQL/klaros/Dockerfile index 96df453..9fe8774 100644 --- a/PostgreSQL/klaros/Dockerfile +++ b/PostgreSQL/klaros/Dockerfile @@ -32,7 +32,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.5} +ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base @@ -58,4 +58,4 @@ RUN set -ex \ /root/klaros-testmanagement/webapps/ROOT.war \ && chmod +x /root/catalina-wrapper.sh -CMD [ "/root/catalina-wrapper.sh" ] \ No newline at end of file +CMD [ "/root/catalina-wrapper.sh" ] From e5f49a126cab256169075c30fd760ccc2b987380 Mon Sep 17 00:00:00 2001 From: Torsten Stolpmann Date: Sun, 10 May 2020 23:05:29 +0200 Subject: [PATCH 2/4] Update Images to 4.12.7 --- .gitignore | 4 +++- MySQL/db/Dockerfile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 082397c..57e8e0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.jar -.test/ \ No newline at end of file +.test/ +/.settings/ +/.project diff --git a/MySQL/db/Dockerfile b/MySQL/db/Dockerfile index 34e9207..f810f38 100644 --- a/MySQL/db/Dockerfile +++ b/MySQL/db/Dockerfile @@ -49,7 +49,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.29-1debian10 +ENV MYSQL_VERSION 5.7.30-1debian10 RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 1d30b17fbc9b41aa222dc5ab6246698da0f74ac5 Mon Sep 17 00:00:00 2001 From: Torsten Stolpmann Date: Sun, 18 Oct 2020 23:16:34 +0200 Subject: [PATCH 3/4] Updated to Klaros 5.0.3. Script cleanups and minor database upgrades. --- .html/Documentation-German.html | 2 +- .html/Documentation.html | 2 +- .html/README-German.html | 2 +- .html/README.html | 2 +- ApacheDerby/.start.sh | 4 +-- ApacheDerby/Dockerfile | 14 +++++------ MariaDB/.env | 4 +-- MariaDB/db/Dockerfile | 2 +- MariaDB/klaros/Dockerfile | 12 ++++----- MariaDB/klaros/files/catalina-wrapper.sh | 8 +++--- Microsoft SQL Server/.env | 4 +-- Microsoft SQL Server/klaros/Dockerfile | 12 ++++----- .../klaros/files/catalina-wrapper.sh | 18 ++----------- MySQL/.env | 4 +-- MySQL/db/Dockerfile | 2 +- MySQL/klaros/Dockerfile | 12 ++++----- MySQL/klaros/files/catalina-wrapper.sh | 25 +++++++------------ PostgreSQL/.env | 4 +-- PostgreSQL/db/Dockerfile | 4 +-- PostgreSQL/klaros/Dockerfile | 12 ++++----- PostgreSQL/klaros/files/catalina-wrapper.sh | 6 ++--- 21 files changed, 62 insertions(+), 93 deletions(-) diff --git a/.html/Documentation-German.html b/.html/Documentation-German.html index 8f1c5ba..2563663 100644 --- a/.html/Documentation-German.html +++ b/.html/Documentation-German.html @@ -444,7 +444,7 @@

Klaros-Testmanagement Docker-Integration

-

Version 4.12.4 green +

Version 5.0.3 green License MIT green Community%20Edition FREE green Klaros TM?style=social

diff --git a/.html/Documentation.html b/.html/Documentation.html index 2bc97f0..7cbe3c0 100644 --- a/.html/Documentation.html +++ b/.html/Documentation.html @@ -444,7 +444,7 @@

Klaros Test Management Docker-Integration

-

Version 4.12.4 green +

Version 5.0.3 green License MIT green Community%20Edition FREE green Klaros TM?style=social

diff --git a/.html/README-German.html b/.html/README-German.html index a2cd938..9af5458 100644 --- a/.html/README-German.html +++ b/.html/README-German.html @@ -444,7 +444,7 @@

Klaros-Testmanagement Docker-Integration

-

Version 4.12.4 green +

Version 5.0.3 green License MIT green Community%20Edition FREE green Klaros TM?style=social

diff --git a/.html/README.html b/.html/README.html index c4ec139..36b041f 100644 --- a/.html/README.html +++ b/.html/README.html @@ -444,7 +444,7 @@

Klaros Test Management Docker-Integration

-

Version 4.12.4 green +

Version 5.0.3 green License MIT green Community%20Edition FREE green Klaros TM?style=social

diff --git a/ApacheDerby/.start.sh b/ApacheDerby/.start.sh index bd0df4a..71b75ac 100644 --- a/ApacheDerby/.start.sh +++ b/ApacheDerby/.start.sh @@ -9,7 +9,7 @@ KT_DIR_WEB=/root/klaros-testmanagement/webapps KT_DIR_CONF=/root/klaros-testmanagement/conf counter=0 -function ctrl_c() { +ctrl_c() { echo "" counter=$((counter + 1)) if [ "$counter" = 1 ]; then @@ -66,7 +66,7 @@ else ln -s $KT_DIR_WEB $CA_DIR_WEB fi -trap "ctrl_c" SIGTERM 2 +trap "ctrl_c" TERM 2 ./root/klaros-testmanagement/bin/catalina.sh run & diff --git a/ApacheDerby/Dockerfile b/ApacheDerby/Dockerfile index 794fadc..c8e9a2b 100644 --- a/ApacheDerby/Dockerfile +++ b/ApacheDerby/Dockerfile @@ -12,7 +12,7 @@ # Do not use it for production systems. Please take a look at the documentation. # -FROM openjdk:8u212-alpine +FROM adoptopenjdk:11-jre-hotspot LABEL maintainer "BreadSpoon " # Set Klaros language. Use 'deu' for german and 'eng' for english. @@ -27,10 +27,10 @@ ENV TOMCAT_ADMIN_PASSWORD P@ssw0rd ENV TOMCAT_SESSION_TIMEOUT 60 # Minimum available RAM in MB -ENV TOMCAT_MEMORY_MIN 128 +ENV TOMCAT_MEMORY_MIN 256 # Maximum available RAM in MB -ENV TOMCAT_MEMORY_MAX 768 +ENV TOMCAT_MEMORY_MAX 1024 # You can set the port by creating a container: docker create --name Klaros -p 18080:18080 klaros ENV TOMCAT_HTTP_PORT ${TOMCAT_HTTP_PORT:-18080} @@ -38,7 +38,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} +ENV KLAROS_VERSION ${KLAROS_VERSION:-5.0.3} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base @@ -50,10 +50,8 @@ ADD https://www.klaros-testmanagement.com/files/${KLAROS_VERSION}/Klaros-${KLARO ADD .start.sh / RUN set -xe \ - && apk update \ - && apk add --no-cache \ - fontconfig \ - ghostscript-fonts \ + && apt-get -y update \ + && apt-get install -y fontconfig gsfonts \ && sed -i "s/@@TOMCAT_ADMIN_PASSWORD@@/${TOMCAT_ADMIN_PASSWORD}/g;s/@@TOMCAT_HTTP_PORT@@/${TOMCAT_HTTP_PORT}/g;s/@@TOMCAT_SERVER_PORT@@/${TOMCAT_SERVER_PORT}/g;s/@@TOMCAT_AJP_PORT@@/${TOMCAT_AJP_PORT}/g;s/@@TOMCAT_SESSION_TIMEOUT@@/${TOMCAT_SESSION_TIMEOUT}/g;s/@@TOMCAT_MEMORY_MAX@@/${TOMCAT_MEMORY_MAX}/g;s/@@TOMCAT_MEMORY_MIN@@/${TOMCAT_MEMORY_MIN}/g;s/@@KLAROS_LANG@@/${KLAROS_LANG}/g" /tmp/auto-install.xml \ && echo "~~~~~" && cat /tmp/auto-install.xml && echo "~~~~~" diff --git a/MariaDB/.env b/MariaDB/.env index 6903911..99e7d60 100644 --- a/MariaDB/.env +++ b/MariaDB/.env @@ -33,10 +33,10 @@ KLAROS_CONTAINER_NAME=klaros_mariadb TIMEZONE= # Minimum available RAM in MB -MEMORY_MIN=128 +MEMORY_MIN=256 # Maximum available RAM in MB -MEMORY_MAX=786 +MEMORY_MAX=1024 # Name of the volume. It contains all your stored data. VOLUME_NAME=klaros-data \ No newline at end of file diff --git a/MariaDB/db/Dockerfile b/MariaDB/db/Dockerfile index 42308fd..cb082a0 100644 --- a/MariaDB/db/Dockerfile +++ b/MariaDB/db/Dockerfile @@ -79,7 +79,7 @@ RUN set -ex; \ # bashbrew-architectures: amd64 arm64v8 ppc64le ENV MARIADB_MAJOR 10.4 -ENV MARIADB_VERSION 1:10.4.12+maria~bionic +ENV MARIADB_VERSION 1:10.4.15+maria~bionic # release-status:Stable # (https://downloads.mariadb.org/mariadb/+releases/) diff --git a/MariaDB/klaros/Dockerfile b/MariaDB/klaros/Dockerfile index d0a607a..7993676 100644 --- a/MariaDB/klaros/Dockerfile +++ b/MariaDB/klaros/Dockerfile @@ -11,7 +11,7 @@ # The .env file contains all possible configuration options. Further information can be found in the documentation. # -FROM openjdk:8u212-alpine +FROM adoptopenjdk:11-jre-hotspot LABEL maintainer "BreadSpoon " # Set Klaros language. Use 'deu' for german and 'eng' for english. @@ -32,7 +32,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} +ENV KLAROS_VERSION ${KLAROS_VERSION:-5.0.3} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base @@ -42,11 +42,9 @@ ADD files/auto-install.xml /tmp/auto-install.xml ADD files/catalina-wrapper.sh /root/catalina-wrapper.sh ADD https://www.klaros-testmanagement.com/files/${KLAROS_VERSION}/Klaros-${KLAROS_VERSION}-Setup.jar /tmp/Klaros-Setup.jar -RUN set -ex \ - && apk update \ - && apk add --no-cache \ - fontconfig \ - ghostscript-fonts \ +RUN set -xe \ + && apt-get -y update \ + && apt-get install -y fontconfig gsfonts \ && sed -i "s/@@TOMCAT_ADMIN_PASSWORD@@/${TOMCAT_ADMIN_PASSWORD}/g;s/@@TOMCAT_HTTP_PORT@@/${TOMCAT_HTTP_PORT}/g;s/@@TOMCAT_SERVER_PORT@@/${TOMCAT_SERVER_PORT}/g;s/@@TOMCAT_AJP_PORT@@/${TOMCAT_AJP_PORT}/g;s/@@TOMCAT_SESSION_TIMEOUT@@/${TOMCAT_SESSION_TIMEOUT}/g;s/@@TOMCAT_MEMORY_MAX@@/${TOMCAT_MEMORY_MAX}/g;s/@@TOMCAT_MEMORY_MIN@@/${TOMCAT_MEMORY_MIN}/g;s/@@KLAROS_LANG@@/${KLAROS_LANG}/g" /tmp/auto-install.xml \ && echo "~~~~~" && cat /tmp/auto-install.xml && echo "~~~~~" diff --git a/MariaDB/klaros/files/catalina-wrapper.sh b/MariaDB/klaros/files/catalina-wrapper.sh index 3a786ad..01fabce 100644 --- a/MariaDB/klaros/files/catalina-wrapper.sh +++ b/MariaDB/klaros/files/catalina-wrapper.sh @@ -10,7 +10,7 @@ KT_DIR_CONF=/root/klaros-testmanagement/conf KT_DIR_HOME=/data/klaros-home counter=0 -function ctrl_c() { +ctrl_c() { echo "" counter=$((counter + 1)) if [ "$counter" = 1 ]; then @@ -82,8 +82,8 @@ else fi ( - echo "hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect" - echo "hibernate.connection.driver_class=com.mysql.jdbc.Driver" + echo "hibernate.dialect=org.hibernate.dialect.MariaDB10Dialect" + echo "hibernate.connection.driver_class=org.mariadb.jdbc.Driver" echo "hibernate.connection.url = jdbc:mysql://db/${DATABASE_NAME}?autoReconnect=true&useSSL=false" echo "hibernate.connection.username=${DATABASE_USER}" echo "hibernate.connection.password=${DATABASE_PASSWORD}" @@ -92,7 +92,7 @@ fi # Wait for SQL Server sleep 60 -trap "ctrl_c" SIGTERM 2 +trap "ctrl_c" TERM 2 ./root/klaros-testmanagement/bin/catalina.sh run & diff --git a/Microsoft SQL Server/.env b/Microsoft SQL Server/.env index 6a91e79..1461a76 100644 --- a/Microsoft SQL Server/.env +++ b/Microsoft SQL Server/.env @@ -30,10 +30,10 @@ KLAROS_CONTAINER_NAME=klaros_mssql2017 TIMEZONE= # Minimum available RAM in MB -MEMORY_MIN=128 +MEMORY_MIN=256 # Maximum available RAM in MB -MEMORY_MAX=786 +MEMORY_MAX=1024 # Name of the volume. It contains all your stored data. VOLUME_NAME=klaros-data \ No newline at end of file diff --git a/Microsoft SQL Server/klaros/Dockerfile b/Microsoft SQL Server/klaros/Dockerfile index d0a607a..7993676 100644 --- a/Microsoft SQL Server/klaros/Dockerfile +++ b/Microsoft SQL Server/klaros/Dockerfile @@ -11,7 +11,7 @@ # The .env file contains all possible configuration options. Further information can be found in the documentation. # -FROM openjdk:8u212-alpine +FROM adoptopenjdk:11-jre-hotspot LABEL maintainer "BreadSpoon " # Set Klaros language. Use 'deu' for german and 'eng' for english. @@ -32,7 +32,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} +ENV KLAROS_VERSION ${KLAROS_VERSION:-5.0.3} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base @@ -42,11 +42,9 @@ ADD files/auto-install.xml /tmp/auto-install.xml ADD files/catalina-wrapper.sh /root/catalina-wrapper.sh ADD https://www.klaros-testmanagement.com/files/${KLAROS_VERSION}/Klaros-${KLAROS_VERSION}-Setup.jar /tmp/Klaros-Setup.jar -RUN set -ex \ - && apk update \ - && apk add --no-cache \ - fontconfig \ - ghostscript-fonts \ +RUN set -xe \ + && apt-get -y update \ + && apt-get install -y fontconfig gsfonts \ && sed -i "s/@@TOMCAT_ADMIN_PASSWORD@@/${TOMCAT_ADMIN_PASSWORD}/g;s/@@TOMCAT_HTTP_PORT@@/${TOMCAT_HTTP_PORT}/g;s/@@TOMCAT_SERVER_PORT@@/${TOMCAT_SERVER_PORT}/g;s/@@TOMCAT_AJP_PORT@@/${TOMCAT_AJP_PORT}/g;s/@@TOMCAT_SESSION_TIMEOUT@@/${TOMCAT_SESSION_TIMEOUT}/g;s/@@TOMCAT_MEMORY_MAX@@/${TOMCAT_MEMORY_MAX}/g;s/@@TOMCAT_MEMORY_MIN@@/${TOMCAT_MEMORY_MIN}/g;s/@@KLAROS_LANG@@/${KLAROS_LANG}/g" /tmp/auto-install.xml \ && echo "~~~~~" && cat /tmp/auto-install.xml && echo "~~~~~" diff --git a/Microsoft SQL Server/klaros/files/catalina-wrapper.sh b/Microsoft SQL Server/klaros/files/catalina-wrapper.sh index e971269..8e7104d 100644 --- a/Microsoft SQL Server/klaros/files/catalina-wrapper.sh +++ b/Microsoft SQL Server/klaros/files/catalina-wrapper.sh @@ -10,7 +10,7 @@ KT_DIR_CONF=/root/klaros-testmanagement/conf KT_DIR_HOME=/data/klaros-home counter=0 -function ctrl_c() { +ctrl_c() { echo "" counter=$((counter + 1)) if [ "$counter" = 1 ]; then @@ -25,20 +25,6 @@ function ctrl_c() { exit 2 } -if [ -d "$CA_DIR_DATA" ]; then - echo "$CA_DIR_DATA exists" -else - echo "creating $CA_DIR_DATA" - mkdir -p $CA_DIR_DATA -fi - -if [ -d "$MSQL_DIR_DATA" ]; then - echo "$MSQL_DIR_DATA exists" -else - echo "creating $MSQL_DIR_DATA" - mkdir -p $MSQL_DIR_DATA -fi - if [ -d "$KT_DIR_HOME" ]; then echo "$KT_DIR_HOME exists" else @@ -92,7 +78,7 @@ fi # Wait for SQL Server sleep 60 -trap "ctrl_c" SIGTERM 2 +trap "ctrl_c" TERM 2 ./root/klaros-testmanagement/bin/catalina.sh run & diff --git a/MySQL/.env b/MySQL/.env index 9f3ac8f..a23ce21 100644 --- a/MySQL/.env +++ b/MySQL/.env @@ -33,10 +33,10 @@ KLAROS_CONTAINER_NAME=klaros_mysql TIMEZONE= # Minimum available RAM in MB -MEMORY_MIN=128 +MEMORY_MIN=256 # Maximum available RAM in MB -MEMORY_MAX=786 +MEMORY_MAX=1024 # Name of the volume. It contains all your stored data. VOLUME_NAME=klaros-data \ No newline at end of file diff --git a/MySQL/db/Dockerfile b/MySQL/db/Dockerfile index f810f38..a4e2955 100644 --- a/MySQL/db/Dockerfile +++ b/MySQL/db/Dockerfile @@ -49,7 +49,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.30-1debian10 +ENV MYSQL_VERSION 5.7.32-1debian10 RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list diff --git a/MySQL/klaros/Dockerfile b/MySQL/klaros/Dockerfile index 9fe8774..2346b69 100644 --- a/MySQL/klaros/Dockerfile +++ b/MySQL/klaros/Dockerfile @@ -11,7 +11,7 @@ # The .env file contains all possible configuration options. Further information can be found in the documentation. # -FROM openjdk:8u212-alpine +FROM adoptopenjdk:11-jre-hotspot LABEL maintainer "BreadSpoon " # Set Klaros language. Use 'deu' for german and 'eng' for english. @@ -32,7 +32,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} +ENV KLAROS_VERSION ${KLAROS_VERSION:-5.0.3} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base @@ -42,11 +42,9 @@ ADD files/auto-install.xml /tmp/auto-install.xml ADD files/catalina-wrapper.sh /root/catalina-wrapper.sh ADD https://www.klaros-testmanagement.com/files/${KLAROS_VERSION}/Klaros-${KLAROS_VERSION}-Setup.jar /tmp/Klaros-Setup.jar -RUN set -ex \ - && apk update \ - && apk add --no-cache \ - fontconfig \ - ghostscript-fonts \ +RUN set -xe \ + && apt-get -y update \ + && apt-get install -y fontconfig gsfonts \ && sed -i "s/@@TOMCAT_ADMIN_PASSWORD@@/${TOMCAT_ADMIN_PASSWORD}/g;s/@@TOMCAT_HTTP_PORT@@/${TOMCAT_HTTP_PORT}/g;s/@@TOMCAT_SERVER_PORT@@/${TOMCAT_SERVER_PORT}/g;s/@@TOMCAT_AJP_PORT@@/${TOMCAT_AJP_PORT}/g;s/@@TOMCAT_SESSION_TIMEOUT@@/${TOMCAT_SESSION_TIMEOUT}/g;s/@@TOMCAT_MEMORY_MAX@@/${TOMCAT_MEMORY_MAX}/g;s/@@TOMCAT_MEMORY_MIN@@/${TOMCAT_MEMORY_MIN}/g;s/@@KLAROS_LANG@@/${KLAROS_LANG}/g" /tmp/auto-install.xml \ && echo "~~~~~" && cat /tmp/auto-install.xml && echo "~~~~~" diff --git a/MySQL/klaros/files/catalina-wrapper.sh b/MySQL/klaros/files/catalina-wrapper.sh index 34eff0b..37ae929 100644 --- a/MySQL/klaros/files/catalina-wrapper.sh +++ b/MySQL/klaros/files/catalina-wrapper.sh @@ -8,11 +8,11 @@ CA_DIR_WEB=$CA_DIR_BASE/webapps KT_DIR_WEB=/root/klaros-testmanagement/webapps KT_DIR_CONF=/root/klaros-testmanagement/conf KT_DIR_HOME=/data/klaros-home -MSQL_DIR_DATA=/data/mysql-data -MSQL_FILE_ERRORLOG=/var/log/mysql/error.log +MYSQL_DIR_DATA=/data/mysql-data +MYSQL_FILE_ERRORLOG=/var/log/mysql/error.log counter=0 -function ctrl_c() { +ctrl_c() { echo "" counter=$((counter + 1)) if [ "$counter" = 1 ]; then @@ -27,13 +27,6 @@ function ctrl_c() { exit 2 } -if [ -d "$CA_DIR_DATA" ]; then - echo "$CA_DIR_DATA exists" -else - echo "creating $CA_DIR_DATA" - mkdir -p $CA_DIR_DATA -fi - if [ -d "$MSQL_DIR_DATA" ]; then echo "$MSQL_DIR_DATA exists" else @@ -83,15 +76,15 @@ else ln -s $KT_DIR_WEB $CA_DIR_WEB fi -if [ -f "$MSQL_DIR_DATA/error.log" ]; then - echo "$MSQL_DIR_DATA/error.log is linked" +if [ -f "$MYSQL_DIR_DATA/error.log" ]; then + echo "$MYSQL_DIR_DATA/error.log is linked" else - echo "creating link $MSQL_DIR_DATA/error.log" - ln -s $MSQL_FILE_ERRORLOG $MSQL_DIR_DATA + echo "creating link $MYSQL_DIR_DATA/error.log" + ln -s $MSQL_DIR_DATA/error.log $MYSQL_FILE_ERRORLOG fi ( - echo "hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect" + echo "hibernate.dialect=org.hibernate.dialect.MySQL57Dialect" echo "hibernate.connection.driver_class=com.mysql.jdbc.Driver" echo "hibernate.connection.url = jdbc:mysql://db/${DATABASE_NAME}?autoReconnect=true&useSSL=false" echo "hibernate.connection.username=${DATABASE_USER}" @@ -101,7 +94,7 @@ fi # Wait for SQL Server sleep 60 -trap "ctrl_c" SIGTERM 2 +trap "ctrl_c" TERM 2 ./root/klaros-testmanagement/bin/catalina.sh run & diff --git a/PostgreSQL/.env b/PostgreSQL/.env index 6c545ed..47cc260 100644 --- a/PostgreSQL/.env +++ b/PostgreSQL/.env @@ -30,10 +30,10 @@ KLAROS_CONTAINER_NAME=klaros_postgresql TIMEZONE= # Minimum available RAM in MB -MEMORY_MIN=128 +MEMORY_MIN=256 # Maximum available RAM in MB -MEMORY_MAX=786 +MEMORY_MAX=1024 # Name of the volume. It contains all your stored data. VOLUME_NAME=klaros-data \ No newline at end of file diff --git a/PostgreSQL/db/Dockerfile b/PostgreSQL/db/Dockerfile index b916600..c2fad93 100644 --- a/PostgreSQL/db/Dockerfile +++ b/PostgreSQL/db/Dockerfile @@ -19,8 +19,8 @@ ENV LANG en_US.utf8 RUN mkdir /docker-entrypoint-initdb.d ENV PG_MAJOR 12 -ENV PG_VERSION 12.2 -ENV PG_SHA256 ad1dcc4c4fc500786b745635a9e1eba950195ce20b8913f50345bb7d5369b5de +ENV PG_VERSION 12.4 +ENV PG_SHA256 bee93fbe2c32f59419cb162bcc0145c58da9a8644ee154a30b9a5ce47de606cc RUN set -ex \ \ diff --git a/PostgreSQL/klaros/Dockerfile b/PostgreSQL/klaros/Dockerfile index 9fe8774..2346b69 100644 --- a/PostgreSQL/klaros/Dockerfile +++ b/PostgreSQL/klaros/Dockerfile @@ -11,7 +11,7 @@ # The .env file contains all possible configuration options. Further information can be found in the documentation. # -FROM openjdk:8u212-alpine +FROM adoptopenjdk:11-jre-hotspot LABEL maintainer "BreadSpoon " # Set Klaros language. Use 'deu' for german and 'eng' for english. @@ -32,7 +32,7 @@ ENV TOMCAT_SERVER_PORT ${TOMCAT_SERVER_PORT:-18005} ENV TOMCAT_AJP_PORT ${TOMCAT_AJP_PORT:-18009} # Klaros release version, which is used during installation. A list of available releases can be found on the official Klaros Test Management website or on GitHub. -ENV KLAROS_VERSION ${KLAROS_VERSION:-4.12.6} +ENV KLAROS_VERSION ${KLAROS_VERSION:-5.0.3} ENV KLAROS_HOME /data/klaros-home ENV CATALINA_BASE /data/catalina-base @@ -42,11 +42,9 @@ ADD files/auto-install.xml /tmp/auto-install.xml ADD files/catalina-wrapper.sh /root/catalina-wrapper.sh ADD https://www.klaros-testmanagement.com/files/${KLAROS_VERSION}/Klaros-${KLAROS_VERSION}-Setup.jar /tmp/Klaros-Setup.jar -RUN set -ex \ - && apk update \ - && apk add --no-cache \ - fontconfig \ - ghostscript-fonts \ +RUN set -xe \ + && apt-get -y update \ + && apt-get install -y fontconfig gsfonts \ && sed -i "s/@@TOMCAT_ADMIN_PASSWORD@@/${TOMCAT_ADMIN_PASSWORD}/g;s/@@TOMCAT_HTTP_PORT@@/${TOMCAT_HTTP_PORT}/g;s/@@TOMCAT_SERVER_PORT@@/${TOMCAT_SERVER_PORT}/g;s/@@TOMCAT_AJP_PORT@@/${TOMCAT_AJP_PORT}/g;s/@@TOMCAT_SESSION_TIMEOUT@@/${TOMCAT_SESSION_TIMEOUT}/g;s/@@TOMCAT_MEMORY_MAX@@/${TOMCAT_MEMORY_MAX}/g;s/@@TOMCAT_MEMORY_MIN@@/${TOMCAT_MEMORY_MIN}/g;s/@@KLAROS_LANG@@/${KLAROS_LANG}/g" /tmp/auto-install.xml \ && echo "~~~~~" && cat /tmp/auto-install.xml && echo "~~~~~" diff --git a/PostgreSQL/klaros/files/catalina-wrapper.sh b/PostgreSQL/klaros/files/catalina-wrapper.sh index 891b78c..b373836 100644 --- a/PostgreSQL/klaros/files/catalina-wrapper.sh +++ b/PostgreSQL/klaros/files/catalina-wrapper.sh @@ -10,7 +10,7 @@ KT_DIR_CONF=/root/klaros-testmanagement/conf KT_DIR_HOME=/data/klaros-home counter=0 -function ctrl_c() { +ctrl_c() { echo "" counter=$((counter + 1)) if [ "$counter" = 1 ]; then @@ -68,7 +68,7 @@ else fi ( - echo "hibernate.dialect=org.hibernate.dialect.PostgreSQL9Dialect" + echo "hibernate.dialect=org.hibernate.dialect.PostgreSQL10Dialect" echo "hibernate.connection.driver_class=org.postgresql.Driver" echo "hibernate.connection.url = jdbc:postgresql://db/${DATABASE_NAME}" echo "hibernate.connection.username=${DATABASE_USER}" @@ -78,7 +78,7 @@ fi # Wait for SQL Server sleep 60 -trap "ctrl_c" SIGTERM 2 +trap "ctrl_c" TERM 2 ./root/klaros-testmanagement/bin/catalina.sh run & From d027911d646dd7af8ac43ad4b7008525e123a8a4 Mon Sep 17 00:00:00 2001 From: Torsten Stolpmann Date: Mon, 19 Oct 2020 14:34:59 +0200 Subject: [PATCH 4/4] Restored files. --- PostgreSQL/db/000_init_user_db.sh | 22 ++++++++++++++++++++++ PostgreSQL/db/001_print_version.sql | 1 + PostgreSQL/db/002_tune_database.sql | 12 ++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 PostgreSQL/db/000_init_user_db.sh create mode 100644 PostgreSQL/db/001_print_version.sql create mode 100644 PostgreSQL/db/002_tune_database.sql diff --git a/PostgreSQL/db/000_init_user_db.sh b/PostgreSQL/db/000_init_user_db.sh new file mode 100644 index 0000000..b277511 --- /dev/null +++ b/PostgreSQL/db/000_init_user_db.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +echo "Start Init_Database" + +#mkdir -p /data/klaros-home/postgressql +#chmod 700 /data/klaros-home/postgressql +#chown postgres /data/klaros-home/postgressql + +echo "host $POSTGRES_DB $POSTGRES_USER 127.0.0.1/32 md5" >>/data/postgres-data/pg_hba.conf + +set -e + +psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL + CREATE TABLESPACE klarosspace LOCATION '/data/postgres-data'; + CREATE role $POSTGRES_USER LOGIN PASSWORD '$POSTGRES_PASSWORD'; + CREATE DATABASE $POSTGRES_DB OWNER $POSTGRES_USER TABLESPACE klarosspace; + GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB TO $POSTGRES_USER; +\q +EOSQL + +echo "End of Init_Database" + diff --git a/PostgreSQL/db/001_print_version.sql b/PostgreSQL/db/001_print_version.sql new file mode 100644 index 0000000..1c6c88d --- /dev/null +++ b/PostgreSQL/db/001_print_version.sql @@ -0,0 +1 @@ +select @@version \ No newline at end of file diff --git a/PostgreSQL/db/002_tune_database.sql b/PostgreSQL/db/002_tune_database.sql new file mode 100644 index 0000000..12eca70 --- /dev/null +++ b/PostgreSQL/db/002_tune_database.sql @@ -0,0 +1,12 @@ +EXEC sys.sp_configure N'show advanced options', N'1' RECONFIGURE WITH OVERRIDE +GO +EXEC sys.sp_configure N'cost threshold for parallelism', N'60' +GO +EXEC sys.sp_configure N'max degree of parallelism', N'3' +GO +EXEC sys.sp_configure N'optimize for ad hoc workloads', N'1' +GO +RECONFIGURE WITH OVERRIDE +GO +EXEC sys.sp_configure N'show advanced options', N'0' RECONFIGURE WITH OVERRIDE +GO