diff --git a/bin/configure.sh b/bin/configure.sh index 2818be61..c5ecadf4 100755 --- a/bin/configure.sh +++ b/bin/configure.sh @@ -1,108 +1,106 @@ #!/bin/bash # Uninstall the old config if [ -d config ]; then echo "Uninstalling the old config." find -L config/ -type f | while read file; do file=$(echo $file | sed -e 's|^config||g') file="./$file" rm -v $file done fi if [ "$1" == "" ]; then echo "Failed to find the configuration folder, please pass one as argument (e.g. config.demo)." exit 1 fi if [ ! -d $1 ]; then echo "Failed to find the configuration folder, please pass one as argument (e.g. config.demo)." exit 1 fi echo "Installing $1." # Link new config rm config ln -s $1 config # Install new config find -L config/ -type f | while read file; do dir=$(dirname $file | sed -e 's|^config||g') dir="./$dir" if [ ! -d $dir ]; then mkdir -p $dir fi cp -v $file $dir/ done if [ -f config.secrets ]; then # Add local secrets echo "" >> src/.env cat config.secrets >> src/.env fi # Generate random secrets if ! grep -q "COTURN_STATIC_SECRET" .env; then COTURN_STATIC_SECRET=$(openssl rand -hex 32); echo "COTURN_STATIC_SECRET=${COTURN_STATIC_SECRET}" >> src/.env fi if ! grep -q "MEET_WEBHOOK_TOKEN" .env; then MEET_WEBHOOK_TOKEN=$(openssl rand -hex 32); echo "MEET_WEBHOOK_TOKEN=${MEET_WEBHOOK_TOKEN}" >> src/.env fi if ! grep -q "MEET_SERVER_TOKEN" .env; then MEET_SERVER_TOKEN=$(openssl rand -hex 32); echo "MEET_SERVER_TOKEN=${MEET_SERVER_TOKEN}" >> src/.env fi if ! grep -q "APP_KEY=base64:" .env; then APP_KEY=$(openssl rand -base64 32); echo "APP_KEY=base64:${APP_KEY}" >> src/.env fi if ! grep -q "PASSPORT_PROXY_OAUTH_CLIENT_ID=" .env; then PASSPORT_PROXY_OAUTH_CLIENT_ID=$(uuidgen); echo "PASSPORT_PROXY_OAUTH_CLIENT_ID=${PASSPORT_PROXY_OAUTH_CLIENT_ID}" >> src/.env fi if ! grep -q "PASSPORT_PROXY_OAUTH_CLIENT_SECRET=" .env; then PASSPORT_PROXY_OAUTH_CLIENT_SECRET=$(openssl rand -base64 32); echo "PASSPORT_PROXY_OAUTH_CLIENT_SECRET=${PASSPORT_PROXY_OAUTH_CLIENT_SECRET}" >> src/.env fi if ! grep -q "PASSPORT_PUBLIC_KEY=|PASSPORT_PRIVATE_KEY=" .env; then PASSPORT_PRIVATE_KEY=$(openssl genrsa 4096); echo "PASSPORT_PRIVATE_KEY=\"${PASSPORT_PRIVATE_KEY}\"" >> src/.env PASSPORT_PUBLIC_KEY=$(echo "$PASSPORT_PRIVATE_KEY" | openssl rsa -pubout 2>/dev/null) echo "PASSPORT_PUBLIC_KEY=\"${PASSPORT_PUBLIC_KEY}\"" >> src/.env fi -if ! grep -q "KOLAB_GIT_REF=" .env; then - echo "KOLAB_GIT_REF=${KOLAB_GIT_REF:-master}" >> src/.env -fi +bin/update-git-refs.sh # Customize configuration sed -i \ -e "s/{{ host }}/${HOST:-kolab.local}/g" \ -e "s/{{ openexchangerates_api_key }}/${OPENEXCHANGERATES_API_KEY}/g" \ -e "s/{{ firebase_api_key }}/${FIREBASE_API_KEY}/g" \ -e "s/{{ public_ip }}/${PUBLIC_IP:-172.18.0.1}/g" \ -e "s/{{ admin_password }}/${ADMIN_PASSWORD}/g" \ src/.env if [ -f /etc/letsencrypt/live/${HOST}/cert.pem ]; then echo "Using the available letsencrypt certificate for ${HOST}" cat >> .env << EOF KOLAB_SSL_CERTIFICATE=/etc/letsencrypt/live/${HOST}/cert.pem KOLAB_SSL_CERTIFICATE_FULLCHAIN=/etc/letsencrypt/live/${HOST}/fullchain.pem KOLAB_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/${HOST}/privkey.pem PROXY_SSL_CERTIFICATE=/etc/letsencrypt/live/${HOST}/fullchain.pem PROXY_SSL_CERTIFICATE_KEY=/etc/letsencrypt/live/${HOST}/privkey.pem EOF fi diff --git a/bin/update-git-refs.sh b/bin/update-git-refs.sh new file mode 100755 index 00000000..4666decd --- /dev/null +++ b/bin/update-git-refs.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +updateVar() { + NAME=$1 + #TODO pin option that translates to a commit hash via + # git ls-remote --exit-code -h "https://git.kolab.org/source/kolab" refs/heads/master + REF=$2 + if ! grep -q "$NAME=" src/.env; then + echo "$1=$REF" >> src/.env + else + echo "s/$NAME=.*/$NAME=$REF/" + sed -i "s|$NAME=.*|$NAME=$REF|" src/.env + fi +} + +updateVar KOLAB_GIT_REF "${KOLAB_GIT_REF:-master}" +updateVar KOLAB_GIT_REMOTE "${KOLAB_GIT_REMOTE:-https://git.kolab.org/source/kolab}" +updateVar GIT_REF_ROUNDCUBEMAIL "${GIT_REF_ROUNDCUBEMAIL:-dev/kolab-1.5}" +updateVar GIT_REMOTE_ROUNDCUBEMAIL "${GIT_REMOTE_ROUNDCUBEMAIL:-https://git.kolab.org/source/roundcubemail.git}" +updateVar GIT_REF_ROUNDCUBEMAIL_PLUGINS "${GIT_REF_ROUNDCUBEMAIL_PLUGINS:-master}" +updateVar GIT_REMOTE_ROUNDCUBEMAIL_PLUGINS "${GIT_REMOTE_ROUNDCUBEMAIL_PLUGINS:-https://git.kolab.org/diffusion/RPK/roundcubemail-plugins-kolab.git}" +updateVar GIT_REF_CHWALA "${GIT_REF_CHWALA:-master}" +updateVar GIT_REMOTE_CHWALA "${GIT_REMOTE_CHWALA:-https://git.kolab.org/diffusion/C/chwala.git}" +updateVar GIT_REF_SYNCROTON "${GIT_REF_SYNCROTON:-master}" +updateVar GIT_REMOTE_SYNCROTON "${GIT_REMOTE_SYNCROTON:-https://git.kolab.org/diffusion/S/syncroton.git}" +updateVar GIT_REF_AUTOCONF "${GIT_REF_SYNCROTON:-master}" +updateVar GIT_REMOTE_AUTOCONF "${GIT_REMOTE_AUTOCONF:-https://git.kolab.org/diffusion/AC/autoconf.git}" +updateVar GIT_REF_IRONY "${GIT_REF_IRONY:-master}" +updateVar GIT_REMOTE_IRONY "${GIT_REMOTE_IRONY:-https://git.kolab.org/source/iRony.git}" +updateVar GIT_REF_FREEBUSY "${GIT_REF_FREEBUSY:-master}" +updateVar GIT_REMOTE_FREEBUSY "${GIT_REMOTE_FREEBUSY:-https://git.kolab.org/diffusion/F/freebusy.git}" diff --git a/docker-compose.yml b/docker-compose.yml index 2c7f14b7..788e3edb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,229 +1,246 @@ version: '3' services: coturn: build: context: ./docker/coturn/ container_name: kolab-coturn healthcheck: interval: 10s test: "kill -0 $$(cat /tmp/turnserver.pid)" timeout: 5s retries: 30 environment: - TURN_PUBLIC_IP=${COTURN_PUBLIC_IP} - TURN_LISTEN_PORT=3478 - TURN_STATIC_SECRET=${COTURN_STATIC_SECRET} hostname: sturn.mgmt.com image: kolab-coturn network_mode: host restart: on-failure roundcube: build: context: ./docker/roundcube/ + args: + GIT_REF_ROUNDCUBEMAIL: ${GIT_REF_ROUNDCUBEMAIL} + GIT_REMOTE_ROUNDCUBEMAIL: ${GIT_REMOTE_ROUNDCUBEMAIL} + GIT_REF_ROUNDCUBEMAIL_PLUGINS: ${GIT_REF_ROUNDCUBEMAIL_PLUGINS} + GIT_REMOTE_ROUNDCUBEMAIL_PLUGINS: ${GIT_REMOTE_ROUNDCUBEMAIL_PLUGINS} + GIT_REF_CHWALA: ${GIT_REF_CHWALA} + GIT_REMOTE_CHWALA: ${GIT_REMOTE_CHWALA} + GIT_REF_SYNCROTON: ${GIT_REF_SYNCROTON} + GIT_REMOTE_SYNCROTON: ${GIT_REMOTE_SYNCROTON} + GIT_REF_AUTOCONF: ${GIT_REF_AUTOCONF} + GIT_REMOTE_AUTOCONF: ${GIT_REMOTE_AUTOCONF} + GIT_REF_IRONY: ${GIT_REF_IRONY} + GIT_REMOTE_IRONY: ${GIT_REMOTE_IRONY} + GIT_REF_FREEBUSY: ${GIT_REF_FREEBUSY} + GIT_REMOTE_FREEBUSY: ${GIT_REMOTE_FREEBUSY} container_name: kolab-roundcube hostname: roundcube.hosted.com restart: on-failure depends_on: mariadb: condition: service_healthy pdns: condition: service_healthy environment: - APP_DOMAIN=${APP_DOMAIN} - DB_HOST=mariadb - DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} - DB_RC_DATABASE=roundcube - DB_RC_USERNAME=roundcube - DB_RC_PASSWORD=${DB_PASSWORD:?"DB_PASSWORD is missing"} - IMAP_HOST=imap - IMAP_PORT=11143 - IMAP_ADMIN_LOGIN=${IMAP_ADMIN_LOGIN} - IMAP_ADMIN_PASSWORD=${IMAP_ADMIN_PASSWORD} - MAIL_HOST=postfix - MAIL_PORT=10587 healthcheck: interval: 10s test: "kill -0 $$(cat /run/httpd/httpd.pid)" timeout: 5s retries: 30 # This makes docker's dns, resolve via pdns for this container. # Please note it does not affect /etc/resolv.conf dns: 172.18.0.11 image: roundcube extra_hosts: - "${APP_DOMAIN}:172.18.0.7" networks: kolab: ipv4_address: 172.18.0.9 ports: - "8080:8080" tmpfs: - /tmp - /var/tmp volumes: - ./ext/:/src.orig/:ro - roundcube:/data mariadb: build: context: ./docker/mariadb/ container_name: kolab-mariadb restart: on-failure environment: - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} - TZ="+02:00" - DB_HKCCP_DATABASE=${DB_DATABASE} - DB_HKCCP_USERNAME=${DB_USERNAME} - DB_HKCCP_PASSWORD=${DB_PASSWORD} - DB_KOLAB_DATABASE=kolab - DB_KOLAB_USERNAME=kolab - DB_KOLAB_PASSWORD=${DB_PASSWORD:?"DB_PASSWORD is missing"} - DB_RC_DATABASE=roundcube - DB_RC_USERNAME=roundcube - DB_RC_PASSWORD=${DB_PASSWORD:?"DB_PASSWORD is missing"} healthcheck: interval: 10s test: "test -e /var/run/mysqld/mysqld.sock && test -e /tmp/initialized" timeout: 5s retries: 30 image: mariadb networks: kolab: ipv4_address: 172.18.0.3 volumes: - mariadb:/var/lib/mysql pdns: build: context: ./docker/pdns/ container_name: kolab-pdns restart: on-failure tty: true hostname: pdns depends_on: mariadb: condition: service_healthy healthcheck: interval: 10s test: "pdns_control rping || exit 1" timeout: 5s retries: 30 image: kolab-pdns environment: - ROLE=both - DB_HOST=mariadb - DB_DATABASE=${DB_DATABASE:?DB_DATABASE} - DB_USERNAME=${DB_USERNAME:?DB_USERNAME} - DB_PASSWORD=${DB_PASSWORD:?DB_PASSWORD} networks: kolab: ipv4_address: 172.18.0.11 tmpfs: - /run - /tmp - /var/run - /var/tmp volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro redis: build: context: ./docker/redis/ healthcheck: interval: 10s test: "redis-cli ping || exit 1" timeout: 5s retries: 30 container_name: kolab-redis restart: on-failure hostname: redis image: redis networks: - kolab volumes: - ./docker/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro webapp: build: context: ./docker/webapp/ args: - GIT_REF: ${KOLAB_GIT_REF:-master} + GIT_REF: ${KOLAB_GIT_REF} + GIT_REMOTE: ${KOLAB_GIT_REMOTE} container_name: kolab-webapp restart: on-failure image: kolab-webapp healthcheck: interval: 10s test: "./artisan octane:status || exit 1" timeout: 5s retries: 30 start_period: 5m depends_on: redis: condition: service_healthy networks: kolab: ipv4_address: 172.18.0.4 volumes: - ./src:/src/kolabsrc.orig:ro ports: - "8000:8000" meet: build: context: ./docker/meet/ args: - GIT_REF: ${KOLAB_GIT_REF:-master} + GIT_REF: ${KOLAB_GIT_REF} + GIT_REMOTE: ${KOLAB_GIT_REMOTE} container_name: kolab-meet restart: on-failure healthcheck: interval: 10s test: "curl --insecure -H 'X-AUTH-TOKEN: ${MEET_SERVER_TOKEN}' --fail https://${MEET_LISTENING_HOST}:12443/meetmedia/api/health || exit 1" timeout: 5s retries: 30 start_period: 5m environment: - WEBRTC_LISTEN_IP=${MEET_WEBRTC_LISTEN_IP:?err} - PUBLIC_DOMAIN=${MEET_PUBLIC_DOMAIN:?err} - LISTENING_HOST=${MEET_LISTENING_HOST:?err} - LISTENING_PORT=12443 - TURN_SERVER=${MEET_TURN_SERVER} - TURN_STATIC_SECRET=${COTURN_STATIC_SECRET} - AUTH_TOKEN=${MEET_SERVER_TOKEN:?err} - WEBHOOK_TOKEN=${MEET_WEBHOOK_TOKEN:?err} - WEBHOOK_URL=${APP_PUBLIC_URL:?err}/api/webhooks/meet - SSL_CERT=/etc/pki/tls/certs/meet.${APP_WEBSITE_DOMAIN:?err}.cert - SSL_KEY=/etc/pki/tls/private/meet.${APP_WEBSITE_DOMAIN:?err}.key network_mode: host image: kolab-meet volumes: - ./meet/server:/src/meet/:ro - ./docker/certs/meet.${APP_WEBSITE_DOMAIN}.cert:/etc/pki/tls/certs/meet.${APP_WEBSITE_DOMAIN}.cert - ./docker/certs/meet.${APP_WEBSITE_DOMAIN}.key:/etc/pki/tls/private/meet.${APP_WEBSITE_DOMAIN}.key minio: container_name: kolab-minio restart: on-failure healthcheck: interval: 10s test: "mc ready local || exit 1" timeout: 5s retries: 30 start_period: 5m environment: - MINIO_ROOT_USER=${MINIO_USER} - MINIO_ROOT_PASSWORD=${MINIO_PASSWORD} image: minio/minio networks: kolab: ipv4_address: 172.18.0.14 ports: - "9000:9000" - "9001:9001" entrypoint: sh command: -c 'mkdir -p /data/${MINIO_BUCKET} && minio server /data --console-address ":9001"' volumes: - minio:/data networks: kolab: driver: bridge ipam: config: - subnet: "172.18.0.0/24" volumes: mariadb: minio: roundcube: diff --git a/docker/meet/Dockerfile b/docker/meet/Dockerfile index 0b1e40eb..dd1a029c 100644 --- a/docker/meet/Dockerfile +++ b/docker/meet/Dockerfile @@ -1,15 +1,16 @@ FROM fedora:37 MAINTAINER Jeroen van Meeuwen RUN dnf -y install \ --setopt 'tsflags=nodocs' \ npm nodejs python3 python3-pip meson ninja-build make gcc g++ git && \ dnf clean all -ARG GIT_REF=master +ARG GIT_REF=dev/mollekopf +ARG GIT_REMOTE=https://git.kolab.org/source/kolab.git ENV DEBUG="kolabmeet-server* mediasoup*" COPY build.sh /build.sh RUN /build.sh COPY init.sh /init.sh CMD [ "/init.sh" ] diff --git a/docker/meet/build.sh b/docker/meet/build.sh index a42aa6d0..5c02be37 100755 --- a/docker/meet/build.sh +++ b/docker/meet/build.sh @@ -1,13 +1,13 @@ #!/bin/bash set -e mkdir /src/ cd /src/ -git clone --branch $GIT_REF https://git.kolab.org/source/kolab.git kolab +git clone --branch $GIT_REF $GIT_REMOTE kolab pushd kolab git reset --hard $GIT_REF popd cp -R kolab/meet/server /src/meetsrc rm -Rf /src/meetsrc/node_modules cd /src/meetsrc npm install npm install -g nodemon diff --git a/docker/roundcube/Dockerfile b/docker/roundcube/Dockerfile index e794f935..d4ae8d79 100644 --- a/docker/roundcube/Dockerfile +++ b/docker/roundcube/Dockerfile @@ -1,105 +1,110 @@ FROM almalinux:9 MAINTAINER Christian Mollekopf ENV HOME=/opt/app-root/src LABEL io.k8s.description="Platform for serving PHP roundcube applications" \ io.k8s.display-name="Roundcube" \ io.openshift.expose-services="80:http" \ io.openshift.tags="builder,php,apache" RUN dnf -y update # Add EPEL. RUN dnf -y install 'dnf-command(config-manager)' && \ dnf config-manager --set-enabled crb && \ dnf -y install epel-release && \ dnf -y install epel-next-release && \ dnf clean all # Add the EPEL key. RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 # Add kolab RUN rpm --import https://mirror.apheleia-it.ch/repos/Kolab:/16/key.asc && \ rpm -Uvh https://mirror.apheleia-it.ch/repos/Kolab:/16/kolab-16-for-el9.rpm # Install php modules RUN sed -i -e '/^ssl/d' /etc/yum.repos.d/kolab*.repo && \ dnf config-manager --enable kolab-16 &&\ dnf -y --setopt tsflags= install php-kolab php-kolabformat &&\ dnf clean all RUN dnf -y install \ composer \ diffutils \ file \ git \ make \ unzip \ curl-minimal \ mariadb \ which \ rsync \ openssl-devel \ httpd \ patch \ php-cli \ php-common \ php-devel \ php-ldap \ php-opcache \ php-pecl-apcu \ php-mysqlnd \ php-gd \ php-fpm \ php-pear \ # ImageMagick \ re2c \ npm \ wget && \ dnf -y install procps-ng iputils bind-utils sudo telnet mc && \ dnf clean all RUN dnf -y install --disablerepo epel-next ImageMagick RUN npm install -g less less-plugin-clean-css WORKDIR ${HOME} COPY /rootfs / ARG GIT_REF_ROUNDCUBEMAIL=dev/kolab-1.5 +ARG GIT_REMOTE_ROUNDCUBEMAIL=https://git.kolab.org/source/roundcubemail.git ARG GIT_REF_ROUNDCUBEMAIL_PLUGINS=master +ARG GIT_REMOTE_ROUNDCUBEMAIL_PLUGINS=https://git.kolab.org/diffusion/RPK/roundcubemail-plugins-kolab.git ARG GIT_REF_CHWALA=master +ARG GIT_REMOTE_CHWALA=https://git.kolab.org/diffusion/C/chwala.git ARG GIT_REF_SYNCROTON=master +ARG GIT_REMOTE_SYNCROTON=https://git.kolab.org/diffusion/S/syncroton.git ARG GIT_REF_AUTOCONF=master +ARG GIT_REMOTE_AUTOCONF=https://git.kolab.org/diffusion/AC/autoconf.git ARG GIT_REF_IRONY=master +ARG GIT_REMOTE_IRONY=https://git.kolab.org/source/iRony.git ARG GIT_REF_FREEBUSY=master - -RUN /opt/app-root/src/build.sh +ARG GIT_REMOTE_FREEBUSY=https://git.kolab.org/diffusion/F/freebusy.git VOLUME /data -RUN chgrp -R 0 /opt/app-root/src && \ - chmod -R g=u /opt/app-root/src - -RUN mkdir -p /run/php-fpm && \ +RUN /opt/app-root/src/build.sh && \ + chgrp -R 0 /opt/app-root/src && \ + chmod -R g=u /opt/app-root/src && \ + mkdir -p /run/php-fpm && \ chmod 777 /run/php-fpm && \ mkdir -p /run/httpd && \ chmod 777 /run/httpd && \ mkdir -p /data && \ chmod 777 /data && \ - chmod -R 777 /etc/httpd /var/log/httpd /var/lib/httpd /data + chmod -R 777 /etc/httpd /var/log/httpd /var/lib/httpd /data && \ + chown -R 1001:0 /opt/app-root/src /data -RUN chown -R 1001:0 /opt/app-root/src /data USER 1001 EXPOSE 8080 # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop STOPSIGNAL SIGWINCH CMD [ "/opt/app-root/src/init.sh" ] diff --git a/docker/roundcube/rootfs/opt/app-root/src/build.sh b/docker/roundcube/rootfs/opt/app-root/src/build.sh index bd6d73b5..540f2f27 100755 --- a/docker/roundcube/rootfs/opt/app-root/src/build.sh +++ b/docker/roundcube/rootfs/opt/app-root/src/build.sh @@ -1,56 +1,56 @@ #!/bin/bash set -e set -x pushd /opt/app-root/src/ # Clone what we don't find (roundcubemail-skin-elastic is not publicly available, so can't be included this way) if [ ! -d roundcubemail ]; then - git clone --branch $GIT_REF_ROUNDCUBEMAIL https://git.kolab.org/source/roundcubemail.git roundcubemail + git clone --branch $GIT_REF_ROUNDCUBEMAIL $GIT_REMOTE_ROUNDCUBEMAIL roundcubemail fi if [ ! -d roundcubemail-plugins-kolab ]; then - git clone --branch $GIT_REF_ROUNDCUBEMAIL_PLUGINS https://git.kolab.org/diffusion/RPK/roundcubemail-plugins-kolab.git roundcubemail-plugins-kolab + git clone --branch $GIT_REF_ROUNDCUBEMAIL_PLUGINS $GIT_REMOTE_ROUNDCUBEMAIL_PLUGINS roundcubemail-plugins-kolab fi if [ ! -d syncroton ]; then - git clone --branch $GIT_REF_SYNCROTON https://git.kolab.org/diffusion/S/syncroton.git syncroton + git clone --branch $GIT_REF_SYNCROTON $GIT_REMOTE_SYNCROTON syncroton fi if [ ! -d iRony ]; then - git clone --branch $GIT_REF_IRONY https://git.kolab.org/source/iRony.git iRony + git clone --branch $GIT_REF_IRONY $GIT_REMOTE_IRONY iRony fi if [ ! -d chwala ]; then - git clone --branch $GIT_REF_CHWALA https://git.kolab.org/diffusion/C/chwala.git chwala + git clone --branch $GIT_REF_CHWALA $GIT_REMOTE_CHWALA chwala fi if [ ! -d autoconf ]; then - git clone --branch $GIT_REF_AUTOCONF https://git.kolab.org/diffusion/AC/autoconf.git autoconf + git clone --branch $GIT_REF_AUTOCONF $GIT_REMOTE_AUTOCONF autoconf fi if [ ! -d freebusy ]; then - git clone --branch $GIT_REF_FREEBUSY https://git.kolab.org/diffusion/F/freebusy.git freebusy + git clone --branch $GIT_REF_FREEBUSY $GIT_REMOTE_FREEBUSY freebusy fi pushd roundcubemail cp /opt/app-root/src/composer.json composer.json rm -rf vendor/ composer.lock php -dmemory_limit=-1 $(command -v composer) install cd /opt/app-root/src/ ./update.sh cd /opt/app-root/src/roundcubemail # Adjust the configs sed -i -r \ -e "s/'vlv'(\s+)=> false,/'vlv'\1=> true,/g" \ -e "s/'vlv_search'(\s+)=> false,/'vlv_search'\1=> true,/g" \ -e "s/inetOrgPerson/inetorgperson/g" \ -e "s/kolabInetOrgPerson/inetorgperson/g" \ config/*.inc.php sed -i -r -e "s|\$config\['managesieve_host'\] = .*$|\$config['managesieve_host'] = 'kolab';|g" config/managesieve.inc.php popd # Set the php timezone sed -i -r -e 's|^(;*)date\.timezone.*$|date.timezone = Europe/Zurich|g' /etc/php.ini # Allow environment variables from fpm sed -i -e "s/;clear_env/clear_env/" /etc/php-fpm.d/www.conf diff --git a/docker/webapp/Dockerfile b/docker/webapp/Dockerfile index 5daa33b7..2dfcd5ef 100755 --- a/docker/webapp/Dockerfile +++ b/docker/webapp/Dockerfile @@ -1,20 +1,21 @@ FROM apheleia/swoole:latest MAINTAINER Jeroen van Meeuwen USER root RUN dnf -y install findutils gnupg2 git rsync procps-ng php-sodium EXPOSE 8000 ARG GIT_REF=master +ARG GIT_REMOTE=https://git.kolab.org/source/kolab.git ARG CONFIG=config.prod COPY build.sh /build.sh RUN /build.sh COPY init.sh /init.sh COPY update.sh /update.sh ENV KOLAB_ROLE=combined CMD [ "/init.sh" ] diff --git a/docker/webapp/build.sh b/docker/webapp/build.sh index b4880a2a..bcbb7c5f 100755 --- a/docker/webapp/build.sh +++ b/docker/webapp/build.sh @@ -1,35 +1,35 @@ #!/bin/bash set -e set -x echo -e "Building with the following ulimit: limit: $(ulimit -n)\n" echo -e "If you run into EMFILE errors, this is the reason" mkdir /src cd /src -git clone --branch $GIT_REF https://git.kolab.org/source/kolab.git kolab +git clone --branch $GIT_REF $GIT_REMOTE kolab pushd kolab git reset --hard $GIT_REF #TODO support injecting a custom overlay into the build process here bin/configure.sh $CONFIG popd rmdir /opt/app-root/src cp -a kolab/src /opt/app-root/src cd /opt/app-root/src/ mkdir -p storage/framework/{sessions,views,cache} mkdir -p database/seeds php -dmemory_limit=-1 $(command -v composer) install npm -g install npm /usr/local/bin/npm install ./artisan storage:link ./artisan clear-compiled ./artisan horizon:install if [ ! -f 'resources/countries.php' ]; then ./artisan data:countries fi /usr/local/bin/npm run dev