Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Merge branch '2018.11' into 2019.11
Browse files Browse the repository at this point in the history
Change-Id: I03635438aef14a1d57b5d2a5d58dd08826fd0ff8
  • Loading branch information
pschuele committed Mar 4, 2020
2 parents 602580c + 69fafe5 commit 2312065
Show file tree
Hide file tree
Showing 67 changed files with 1,556 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Expand Up @@ -32,3 +32,9 @@ tine20/.htaccess
tine20/install.properties
tine20/Tinebase/js/node_modules*
tine20/vendor*
/ci/dependency/package.json
/ci/dependency/composer.json
/ci/dependency/composer.lock
/ci/dependency/library/
/ci/source/tine20/
/ci/dependency/npm-shrinkwrap.json
130 changes: 130 additions & 0 deletions .gitlab-ci.yml
@@ -0,0 +1,130 @@
# $REG see settings>ci_cd>variables
# $REG_USER see settings>ci_cd>variables
# $REG_PASS see settings>ci_cd>variables
# $CI_PROJECT_DIR set by gitlab
# $REG_PREFIX see settings>ci_cd>variables
# $CI_PIPELINE_ID set by gitlab
# $PHP_IMAGE_TAG default = 7.3-fpm-alpine
# $SKIP_TEST_SOURCE default = false
# $SKIP_TEST_BUILT default = false
# $SKIP_DEPLOY_1 default = false
# $SKIP_DEPLOY_2 default = false

# $PUSH default = true, false -> to skip pushing final images to registry
include:
- local: '/ci/gitlab-ci.yml/abstract_test.yml'

stages:
- build_1
- build_2
- test_source
- build_3
- test_built
- deploy_1
- deploy_2
- cleanup

variables:
PUSH: "true"
REG: "$CI_REGISTRY"
REG_USER: "$CI_REGISTRY_USER"
REG_PASS: "$CI_REGISTRY_PASSWORD"

docker_build_base_and_dependency_images:
image: docker:19.03.1
stage: build_1
before_script:
- sh -e $CI_PROJECT_DIR/ci/build.sh docker_login
script:
- sh -e $CI_PROJECT_DIR/ci/build.sh stage_build_1

docker_build_source_and_source_test_images:
image: docker:19.03.1
stage: build_2
before_script:
- sh -e $CI_PROJECT_DIR/ci/build.sh docker_login
script:
- sh -e $CI_PROJECT_DIR/ci/build.sh stage_build_2
rules:
- when: on_success

php_unit_all_test_source:
extends: .abstract_test.php_unit_test
stage: test_source
image:
name: "$REG/$REG_PREFIX/test-source:$CI_PIPELINE_ID"
rules:
- if: $SKIP_TEST_SOURCE == "true"
when: never
- when: on_success

docker_build_dev_and_built_and_built_test_images:
image: docker:19.03.1
stage: build_3
before_script:
- sh -e $CI_PROJECT_DIR/ci/build.sh docker_login
script:
- sh -e $CI_PROJECT_DIR/ci/build.sh stage_build_3
rules:
- if: &working_branch_condition $CI_COMMIT_REF_NAME =~ /^feat\// # todo match feature branches
when: never
- when: on_success


php_unit_all_tests_built:
extends: .abstract_test.php_unit_test
stage: test_built
image:
name: "$REG/$REG_PREFIX/test-built:$CI_PIPELINE_ID"
rules:
- if: $SKIP_TEST_BUILT == "true"
when: never
- if: *working_branch_condition
when: never
- when: on_success

php_unit_all_tests_built_with_ldap:
extends: .abstract_test.php_unit_test_with_ldap
stage: test_built
image:
name: "$REG/$REG_PREFIX/test-built:$CI_PIPELINE_ID"
rules:
- if: $RUN_LDAP_TESTA == "true"
when: on_success
- when: never

docker_push_base_and_dependency_images:
image: docker:19.03.1
stage: deploy_1
before_script:
- sh -e $CI_PROJECT_DIR/ci/build.sh docker_login
script:
- sh -e $CI_PROJECT_DIR/ci/build.sh stage_deploy_1
rules:
- if: $SKIP_DEPLOY == "true"
when: never
- when: on_success

docker_push_built_and_built_test_and_dev_images:
image: docker:19.03.1
stage: deploy_2
before_script:
- sh -e $CI_PROJECT_DIR/ci/build.sh docker_login
script:
- sh -e $CI_PROJECT_DIR/ci/build.sh stage_deploy_2
rules:
- if: $SKIP_DEPLOY == "true"
when: never
- if: *working_branch_condition
when: never
- when: on_success

docker_untag_build_id_tag_images:
image: docker:19.03.1
stage: cleanup
before_script:
- sh -e $CI_PROJECT_DIR/ci/build.sh docker_login
script:
- sh -e $CI_PROJECT_DIR/ci/build.sh stage_delete_images
rules:
- when: always
95 changes: 95 additions & 0 deletions ci/base/Dockerfile
@@ -0,0 +1,95 @@
# tine20-docker-registry.mws-hosting.net/docker/tine20/base
# base docker file
# software:
# + php
# + php-fpm
# + nginx
# + supervisor -> to run multiple processes
# + confd -> for environment variable to config mapping
# + php modules: bcmath, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, hash, iconv, igbinary, intl, json, libxml, mbstring, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar,
# posix, readline, redis, Reflection, session, SimpleXML, soap, sockets, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, xsl, yaml, Zend OPcache, zip, zlib
#
# configuration
# + metadata ./confd/conf.d
# + templates ./confd/templates
#
# running
# + nginx: port 80
# + nginx & php-fpm user: nginx
# + status: /ADMIN/nginx-status , /ADMIN/fpm-status
# + healthcheck: /ADMIN/fpm-ping
# + container checks every 30s

# tag is replaced by the pipeline
ARG SOURCE_IMAGE_TAG=7.3-fpm-alpine
ARG SOURCE_IMAGE=php


FROM ${SOURCE_IMAGE}:${SOURCE_IMAGE_TAG}

# https://github.com/docker-library/php/issues/240
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv

# install.tmpl webserver and pcs
RUN apk --no-cache add nginx supervisor curl && \
mkdir -p /etc/supervisor.d/ && \
mkdir -p /run/nginx/ && \
# install.tmpl configuration managers working like a charm. Also the changing
# confd enabels configuration with env variables
# there for it creates configuration files from templates
wget https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64 && \
mv ./confd-0.16.0-linux-amd64 /usr/sbin/confd && \
chmod +x /usr/sbin/confd && \
mkdir -p /etc/confd && \
# install.tmpl php build dependencies
apk add --no-cache --virtual .build-deps autoconf gcc musl-dev make g++ && \
docker-php-source extract && \
# install.tmpl php module dependencies
apk add --no-cache libjpeg-turbo-dev libpng-dev icu-dev libxslt-dev zlib-dev libzip-dev yaml-dev freetype-dev gettext libintl gettext-dev bash openldap-dev && \
# install.tmpl php extentions
docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-png-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install bcmath exif mysqli pcntl pdo_mysql soap sockets zip xsl intl gd opcache gettext iconv ldap && \
docker-php-ext-enable ldap && \
pecl install igbinary && echo -e "extension=igbinary.so\nigbinary.compact_strings=On" > /usr/local/etc/php/conf.d/php-ext-igbinary.ini && \
echo "yes" | pecl install redis-4.3.0 && echo "extension=redis.so" > /usr/local/etc/php/conf.d/php-ext-redis.ini && \
echo "" | pecl install yaml && echo "extension=yaml.so" > /usr/local/etc/php/conf.d/php-ext-yaml.ini && \
# remove php build dependencies
apk del --purge .build-deps && \
docker-php-source delete && \
#install.tmpl nodejs and npm
# create tine folders
mkdir /tine && \
mkdir /tine/conf.d && \
mkdir /tine/logs && \
mkdir /tine/files && \
mkdir /tine/tmp && \
mkdir /tine/caching && \
mkdir /tine/sessions && \
mkdir /etc/tine20 && \
mkdir /var/run/tine20 && \
chown nginx:nginx /tine/logs && \
chown nginx:nginx /tine/files && \
chown nginx:nginx /tine/caching && \
chown nginx:nginx /tine/sessions && \
chown nginx:nginx /tine/tmp

# start up script
COPY install_tine.sh /install_tine.sh
COPY wait_for_db.php /wait_for_db.php

# copy config templates to confd dir
COPY confd /etc/confd
COPY supervisor/* /etc/supervisor.d/

# set workdir
WORKDIR /tine

# setup entrypoint
# + first runs confd to create configs
# + then start supervisor
COPY entrypoint.sh /entrypoint.sh
CMD ["/entrypoint.sh"]

# checks if php-fpm an nginx are working
HEALTHCHECK --timeout=30s CMD curl --silent --fail http://127.0.0.1:80/ADMIN/fpm-ping
11 changes: 11 additions & 0 deletions ci/base/confd/conf.d/nginx-vhost.toml
@@ -0,0 +1,11 @@
[template]
prefix = "/nginxv"
src = "nginx-vhost.conf.tmpl"
dest = "/etc/nginx/conf.d/default.conf"
owner = "root"
mode = "0644"
keys = [
"/server/name",
"/client/max/body/size",

]
14 changes: 14 additions & 0 deletions ci/base/confd/conf.d/nginx.toml
@@ -0,0 +1,14 @@
[template]
prefix = "/nginx"
src = "nginx.conf.tmpl"
dest = "/etc/nginx/nginx.conf"
owner = "root"
mode = "0644"
keys = [
"/client/max/body/size",
"/keepalive/timeout",
"/tcp/nopush",
"/gzip",
"/gzip/static"
]
check_cmd = "/usr/sbin/nginx -t -c {{.src}}"
15 changes: 15 additions & 0 deletions ci/base/confd/conf.d/php-fpm.toml
@@ -0,0 +1,15 @@
[template]
prefix = "/phpfpm"
src = "php-fpm.conf.tmpl"
dest = "/usr/local/etc/php-fpm.d/www.conf"
owner = "root"
mode = "0644"
keys = [
"/dynamic",
"/pm/max/children",
"/pm/start/server",
"/pm/min/spare/servers",
"/pm/max/spare/servers",
"/pm/max/requests",
"healthcheck"
]
23 changes: 23 additions & 0 deletions ci/base/confd/conf.d/php.toml
@@ -0,0 +1,23 @@
[template]
prefix = "/php"
src = "php.ini.tmpl"
dest = "/usr/local/etc/php/conf.d/php.ini"
owner = "root"
mode = "0644"
keys = [
"/percision",
"/output/buffering",
"/implicit/flush",
"/expose/php",
"/max/execution/time",
"/max/input/time",
"/max/input/nesting/level",
"/max/input/vars",
"/memory/limit",
"/display/errors",
"/variables/order",
"/post/max/size",
"/upload/max/filesize",
"/max/file/uploads",
"/default/socket/timeout"
]
11 changes: 11 additions & 0 deletions ci/base/confd/conf.d/tine-install.toml
@@ -0,0 +1,11 @@
[template]
prefix = "/install"
src = "install.tmpl"
dest = "/etc/tine20/install.properties"
owner = "root"
mode = "0644"
keys = [
"/login/username",
"/login/password",
"/admin/email"
]
34 changes: 34 additions & 0 deletions ci/base/confd/conf.d/tine.toml
@@ -0,0 +1,34 @@
[template]
prefix = "/tine20"
src = "config.inc.php.tmpl"
dest = "/etc/tine20/config.inc.php"
owner = "root"
mode = "0644"
keys = [
"/buildtype",
"/logger/priority",
"/filesdir",
"/tmpdir",
"/database/host",
"/database/dbname",
"/database/username",
"/database/password",
"/database/tableprefix",
"/database/adapter",
"/setupuser/username",
"/setupuser/password",
"/login/username",
"/login/password",
"/caching/active",
"/caching/lifetime",
"/caching/backend",
"/caching/redis/host",
"/caching/redis/port",
"/caching/redis/prefix",
"/caching/path",
"/session/lifetime",
"/session/backend",
"/session/host",
"/session/port",
"/session/path"
]

0 comments on commit 2312065

Please sign in to comment.