diff --git a/ci/testctl b/ci/testctl index aead0cf4..751fa818 100755 --- a/ci/testctl +++ b/ci/testctl @@ -1,104 +1,111 @@ #!/bin/bash base_dir="$(dirname $(realpath "$0"))" pushd "${base_dir}" set -e +# Teardown the currently running environment kolab__teardown() { docker kill kolab-tests || : docker rm kolab-tests || : pushd .. docker compose down docker volume rm kolab_mariadb || : docker volume rm kolab_imap || : popd } +# Build all containers required for testing kolab__build() { pushd .. docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.build.yml build mariadb redis swoole webapp imap tests roundcube minio popd } +# Setup the test environment kolab__setup() { kolab__teardown pushd .. bin/configure.sh config.demo popd echo "Build" kolab__build echo "Setup" # Starting the webapp container will trigger a migration # Maybe just delete the mariadb contianer # We need webapp for the services backend, minio for files, roundcube to initialize the roundcube db pushd .. - docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.build.yml up -d --wait mariadb redis imap minio roundcube webapp + docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.build.yml up -d --wait mariadb redis imap minio roundcube webapp proxy popd } # "testsuite" # "quicktest" # "tests/Feature/Jobs/WalletCheckTest.php" kolab__test() { docker kill kolab-tests || : docker rm kolab-tests || : docker run --network=kolab_kolab -v ${PWD}/../src:/src/kolabsrc.orig --name kolab-tests -t kolab-tests /init.sh $@ } +# Setup the test environment and run a complete testsuite kolab__testrun() { echo "Setup" kolab__setup echo "Test" kolab__test testsuite } +# Get a shell inside the test container to run/debug tests kolab__shell() { docker kill kolab-tests || : ; \ docker rm kolab-tests || : ; \ docker run --network=kolab_kolab -v ${PWD}/../src:/src/kolabsrc.orig --name kolab-tests -ti kolab-tests /init.sh shell } +# Run the roundcube testsuite kolab__rctest() { docker kill roundcube-tests || : docker rm roundcube-tests || : pushd .. docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.test.yml run --name roundcube-tests -ti roundcube ./init.sh $@ popd } +# Get a shell inside the roundcube test container to run/debug tests kolab__rcshell() { docker kill roundcube-tests || : docker rm roundcube-tests || : pushd .. docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.test.yml run --name roundcube-tests -ti roundcube ./init.sh shell popd } kolab__help() { cat </dev/null 2>&1; then "kolab__$cmdname" "${@:1}" else echo "Function $cmdname not recognized" >&2 kolab__help exit 1 fi diff --git a/config.demo/src/.env b/config.demo/src/.env index 0dd58e77..3c6b47d2 100644 --- a/config.demo/src/.env +++ b/config.demo/src/.env @@ -1,185 +1,188 @@ APP_NAME=Kolab APP_ENV=local APP_KEY= APP_DEBUG=true APP_URL=https://{{ host }} APP_PASSPHRASE=simple123 APP_PUBLIC_URL=https://{{ host }} APP_DOMAIN={{ host }} APP_WEBSITE_DOMAIN={{ host }} APP_THEME=default APP_TENANT_ID=5 APP_LOCALE=en APP_LOCALES= APP_WITH_ADMIN=1 APP_WITH_RESELLER=1 APP_WITH_SERVICES=1 APP_WITH_FILES=1 APP_LDAP=0 APP_IMAP=1 APP_HEADER_CSP="connect-src 'self'; child-src 'self'; font-src 'self'; form-action 'self' data:; frame-ancestors 'self'; img-src blob: data: 'self' *; media-src 'self'; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-eval' 'unsafe-inline'; default-src 'self';" APP_HEADER_XFO=sameorigin SIGNUP_LIMIT_EMAIL=0 SIGNUP_LIMIT_IP=0 ASSET_URL=https://{{ host }} WEBMAIL_URL=/roundcubemail/ SUPPORT_URL=/support SUPPORT_EMAIL=support@example.com LOG_CHANNEL=stdout LOG_SLOW_REQUESTS=5 LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=mysql DB_DATABASE=kolabdev DB_HOST=mariadb DB_PASSWORD=kolab DB_ROOT_PASSWORD=Welcome2KolabSystems DB_PORT=3306 DB_USERNAME=kolabdev BROADCAST_DRIVER=redis CACHE_DRIVER=redis QUEUE_CONNECTION=redis SESSION_DRIVER=file SESSION_LIFETIME=120 OPENEXCHANGERATES_API_KEY="from openexchangerates.org" MFA_DSN=mysql://roundcube:kolab@mariadb/roundcube MFA_TOTP_DIGITS=6 MFA_TOTP_INTERVAL=30 MFA_TOTP_DIGEST=sha1 IMAP_URI=imap:11143 IMAP_HOST=172.18.0.12 IMAP_PORT=11143 IMAP_ADMIN_LOGIN=cyrus-admin IMAP_ADMIN_PASSWORD=Welcome2KolabSystems IMAP_VERIFY_HOST=false IMAP_VERIFY_PEER=false SMTP_PORT=10587 SMTP_HOST=172.18.0.13 COTURN_PUBLIC_IP='{{ public_ip }}' COTURN_STATIC_SECRET="Welcome2KolabSystems" MEET_WEBHOOK_TOKEN=Welcome2KolabSystems MEET_SERVER_TOKEN=Welcome2KolabSystems MEET_SERVER_URLS=https://{{ host }}/meetmedia/api/ MEET_SERVER_VERIFY_TLS=false MEET_WEBRTC_LISTEN_IP='172.18.0.1' MEET_PUBLIC_DOMAIN={{ host }} MEET_TURN_SERVER='turn:172.18.0.1:3478' MEET_LISTENING_HOST=172.18.0.1 PGP_ENABLE=true PGP_BINARY=/usr/bin/gpg PGP_AGENT=/usr/bin/gpg-agent PGP_GPGCONF=/usr/bin/gpgconf PGP_LENGTH= # Set these to IP addresses you serve WOAT with. # Have the domain owner point _woat. NS RRs refer to ns0{1,2}. WOAT_NS1=ns01.domain.tld WOAT_NS2=ns02.domain.tld REDIS_HOST=redis REDIS_PASSWORD=null REDIS_PORT=6379 OCTANE_HTTP_HOST=0.0.0.0 SWOOLE_PACKAGE_MAX_LENGTH=10485760 PAYMENT_PROVIDER= MOLLIE_KEY= STRIPE_KEY= STRIPE_PUBLIC_KEY= STRIPE_WEBHOOK_SECRET= MAIL_DRIVER=log MAIL_MAILER=smtp MAIL_HOST=172.18.0.13 MAIL_PORT=10587 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="noreply@example.com" MAIL_FROM_NAME="Example.com" MAIL_REPLYTO_ADDRESS="replyto@example.com" MAIL_REPLYTO_NAME=null DNS_TTL=3600 DNS_SPF="v=spf1 mx -all" DNS_STATIC="%s. MX 10 ext-mx01.mykolab.com." DNS_COPY_FROM=null AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 MIX_ASSET_PATH='/' MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" PASSWORD_POLICY= COMPANY_NAME=kolab.org COMPANY_ADDRESS= COMPANY_DETAILS= COMPANY_EMAIL= COMPANY_LOGO= COMPANY_FOOTER= VAT_COUNTRIES=CH,LI VAT_RATE=7.7 KB_ACCOUNT_DELETE= KB_ACCOUNT_SUSPENDED= KB_PAYMENT_SYSTEM= KOLAB_SSL_CERTIFICATE=/etc/certs/kolab.hosted.com.cert KOLAB_SSL_CERTIFICATE_FULLCHAIN=/etc/certs/kolab.hosted.com.chain.pem KOLAB_SSL_CERTIFICATE_KEY=/etc/certs/kolab.hosted.com.key PROXY_SSL_CERTIFICATE=/etc/certs/imap.hosted.com.cert PROXY_SSL_CERTIFICATE_KEY=/etc/certs/imap.hosted.com.key APP_KEY=base64:FG6ECzyAMSmyX+eYwO/FW3bwnarbKkBhqtO65vlMb1E= COTURN_STATIC_SECRET=uzYguvIl9tpZFMuQOE78DpOi6Jc7VFSD0UAnvgMsg5n4e74MgIf6vQvbc6LWzZjz MOLLIE_KEY="from mollie" STRIPE_KEY="from stripe" STRIPE_PUBLIC_KEY="from stripe" STRIPE_WEBHOOK_SECRET="from stripe" OX_API_KEY="from openexchange" FIREBASE_API_KEY="from firebase" #Generated by php artisan passport:client --password, but can be left hardcoded (the seeder will pick it up) PASSPORT_PROXY_OAUTH_CLIENT_ID=942edef5-3dbd-4a14-8e3e-d5d59b727bee PASSPORT_PROXY_OAUTH_CLIENT_SECRET=L6L0n56ecvjjK0cJMjeeV1pPAeffUBO0YSSH63wf MINIO_USER=minio MINIO_PASSWORD=W3lcom32@ph3lia MINIO_BUCKET=kolab FILESYSTEM_DISK=minio + +ACTIVESYNC_URI=https://proxy:6443/Microsoft-Server-ActiveSync +DAV_URI=https://proxy:6443/ diff --git a/docker/roundcube/rootfs/opt/app-root/src/init.sh b/docker/roundcube/rootfs/opt/app-root/src/init.sh index 2a458dae..2530b024 100755 --- a/docker/roundcube/rootfs/opt/app-root/src/init.sh +++ b/docker/roundcube/rootfs/opt/app-root/src/init.sh @@ -1,100 +1,102 @@ #!/bin/bash echo "Starting" set -e set -x mkdir -p /data/pgp-home chmod 777 /data/pgp-home pushd /opt/app-root/src/ pushd roundcubemail ## Copy our configs over the default ones cp /opt/app-root/src/roundcubemail-config-templates/* config/ DES_KEY=$(openssl rand -base64 24); sed -i -r -e "s|config\['des_key'\] = .*$|config['des_key'] = \"$DES_KEY\";|g" config/config.inc.php # Initialize the db cat > /tmp/kolab-setup-my.cnf << EOF [client] host=${DB_HOST} user=root password=${DB_ROOT_PASSWORD} EOF mysql --defaults-file=/tmp/kolab-setup-my.cnf </dev/null 2>&1 || : done fi done popd roundcubemail/bin/initdb.sh --dir syncroton/docs/SQL/ || : roundcubemail/bin/initdb.sh --dir chwala/doc/SQL/ || : echo "Updating tables..." roundcubemail/bin/updatedb.sh --dir syncroton/docs/SQL/ --package syncroton || : roundcubemail/bin/updatedb.sh --dir roundcubemail/SQL/ --package roundcube || : roundcubemail/bin/updatedb.sh --dir roundcubemail/plugins/libkolab/SQL/ --package libkolab || : roundcubemail/bin/updatedb.sh --dir roundcubemail/plugins/kolab-calendar/SQL/ --package calendar-kolab || : echo "" echo "Done, starting httpd..." if [ "$1" == "testsuite" ]; then + ./update-from-source.sh || : + sed -i "s/?>/\$config['activesync_test_username'] = 'john@kolab.org';\n?>/" roundcubemail/config/config.inc.php sed -i "s/?>/\$config['activesync_test_password'] = 'simple123';\n?>/" roundcubemail/config/config.inc.php sed -i -r -e "s/config\['activesync_init_subscriptions'\] =.*$/config['activesync_init_subscriptions'] = 0;/g" roundcubemail/config/kolab_syncroton.inc.php sed -i -r -e "s/config\['activesync_multifolder_blacklist_event'\] =.*$/config['activesync_multifolder_blacklist_event'] = array('windowsoutlook');/g" roundcubemail/config/kolab_syncroton.inc.php sed -i -r -e "s/config\['activesync_multifolder_blacklist_task'\] =.*$/config['activesync_multifolder_blacklist_task'] = array('windowsoutlook');/g" roundcubemail/config/kolab_syncroton.inc.php sed -i -r -e "s/config\['activesync_multifolder_blacklist_contact'\] =.*$/config['activesync_multifolder_blacklist_contact'] = array('windowsoutlook');/g" roundcubemail/config/kolab_syncroton.inc.php pushd syncroton php -S localhost:8000 & pushd tests php \ -dmemory_limit=-1 \ ../vendor/bin/phpunit \ --verbose \ --testsuite Sync elif [ "$1" == "quicktest" ]; then pushd syncroton/tests php \ -dmemory_limit=-1 \ ../vendor/bin/phpunit \ --verbose \ --testsuite Unit elif [ "$1" == "shell" ]; then exec /bin/bash else /usr/sbin/php-fpm exec httpd -DFOREGROUND fi diff --git a/docker/roundcube/rootfs/opt/app-root/src/update-from-source.sh b/docker/roundcube/rootfs/opt/app-root/src/update-from-source.sh index 803ce7a6..f123a41a 100755 --- a/docker/roundcube/rootfs/opt/app-root/src/update-from-source.sh +++ b/docker/roundcube/rootfs/opt/app-root/src/update-from-source.sh @@ -1,36 +1,35 @@ #!/bin/bash #Update from source (rather than via composer which updates to the latest commit) for repo in roundcubemail syncroton iRony chwala autoconf freebusy do if [ -d /src.orig/$directory ]; then rsync -av \ --no-links \ --exclude=vendor \ --exclude=temp \ --exclude=config \ --exclude=logs \ --exclude=.git \ --exclude=config.inc.php \ --exclude=composer.json \ --exclude=composer.lock \ /src.orig/$directory/ /opt/app-root/src/$directory fi done pushd /src.orig/roundcubemail-plugins-kolab/plugins for plugin in $(ls -1d) do if [ -d /opt/app-root/src/roundcubemail/plugins/${plugin}/ ]; then rsync -av \ --exclude=vendor \ --exclude=composer.json \ --exclude=config.inc.php \ $plugin/ /opt/app-root/src/roundcubemail/plugins/$plugin fi done popd - -./reload.sh +# ./reload.sh