From 59877036318607a1a7c9ae1c52719d7358078174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Fri, 5 Oct 2018 11:51:35 +0300 Subject: [PATCH 1/3] Tavis-ci to upload images to the Docker hub, after succesfull tests. For this to work, the following variables will need to be set at Docker hub: - DOCKER_ORG first part of docker repo name (example: mailu) - DOCKER_UN Docker-hub login username (private) - DOCKER_PW Docker-hub login password (private) Note that also Docker hub autobuilds will have to be disabled. --- .travis.yml | 4 ++++ tests/build.yml | 22 +++++++++++----------- tests/deploy.sh | 4 ++++ 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100755 tests/deploy.sh diff --git a/.travis.yml b/.travis.yml index f1d36f3f..9fc1d02f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,3 +11,7 @@ script: - docker-compose -f tests/build.yml -p Mailu build - tests/compose/test-script.sh +deploy: + provider: script + script: bash tests/deploy.sh + diff --git a/tests/build.yml b/tests/build.yml index 674abf8c..a195fdf7 100644 --- a/tests/build.yml +++ b/tests/build.yml @@ -3,45 +3,45 @@ version: '3' services: front: - image: mailu/nginx:$VERSION + image: $DOCKER_ORG/nginx:$VERSION build: ../core/nginx imap: - image: mailu/dovecot:$VERSION + image: $DOCKER_ORG/dovecot:$VERSION build: ../core/dovecot smtp: - image: mailu/postfix:$VERSION + image: $DOCKER_ORG/postfix:$VERSION build: ../core/postfix antispam: - image: mailu/rspamd:$VERSION + image: $DOCKER_ORG/rspamd:$VERSION build: ../services/rspamd antivirus: - image: mailu/clamav:$VERSION + image: $DOCKER_ORG/clamav:$VERSION build: ../optional/clamav webdav: - image: mailu/radicale:$VERSION + image: $DOCKER_ORG/radicale:$VERSION build: ../optional/radicale admin: - image: mailu/admin:$VERSION + image: $DOCKER_ORG/admin:$VERSION build: ../core/admin roundcube: - image: mailu/roundcube:$VERSION + image: $DOCKER_ORG/roundcube:$VERSION build: ../webmails/roundcube rainloop: - image: mailu/rainloop:$VERSION + image: $DOCKER_ORG/rainloop:$VERSION build: ../webmails/rainloop fetchmail: - image: mailu/fetchmail:$VERSION + image: $DOCKER_ORG/fetchmail:$VERSION build: ../services/fetchmail none: - image: mailu/none:$VERSION + image: $DOCKER_ORG/none:$VERSION build: ../core/none diff --git a/tests/deploy.sh b/tests/deploy.sh new file mode 100755 index 00000000..0526a217 --- /dev/null +++ b/tests/deploy.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker login -u $DOCKER_UN -p $DOCKER_PW +docker-compose -f tests/build.yml push From 3224a8ecad8a5e2af50ab77c513af4040003f08b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Fri, 5 Oct 2018 12:52:19 +0300 Subject: [PATCH 2/3] Further introduction of the DOCKER_ORG variable --- tests/compose/core.env | 2 +- tests/compose/run.yml | 18 +++++++++--------- tests/compose/test-script.sh | 30 +++++++++++++++--------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/compose/core.env b/tests/compose/core.env index 67b746f8..89120d4f 100644 --- a/tests/compose/core.env +++ b/tests/compose/core.env @@ -121,7 +121,7 @@ WEBSITE=https://mailu.io ################################### # Docker-compose project name, this will prepended to containers names. -COMPOSE_PROJECT_NAME=mailu +#COMPOSE_PROJECT_NAME=mailu # Default password scheme used for newly created accounts and changed passwords # (value: SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT) diff --git a/tests/compose/run.yml b/tests/compose/run.yml index 631aaa83..56ea1627 100644 --- a/tests/compose/run.yml +++ b/tests/compose/run.yml @@ -3,7 +3,7 @@ version: '2' services: front: - image: mailu/nginx:$VERSION + image: $DOCKER_ORG/nginx:$VERSION restart: 'no' env_file: $PWD/.env ports: @@ -26,7 +26,7 @@ services: - "$ROOT/redis:/data" imap: - image: mailu/dovecot:$VERSION + image: $DOCKER_ORG/dovecot:$VERSION restart: 'no' env_file: $PWD/.env volumes: @@ -37,7 +37,7 @@ services: - front smtp: - image: mailu/postfix:$VERSION + image: $DOCKER_ORG/postfix:$VERSION restart: 'no' env_file: $PWD/.env volumes: @@ -47,7 +47,7 @@ services: - front antispam: - image: mailu/rspamd:$VERSION + image: $DOCKER_ORG/rspamd:$VERSION restart: 'no' env_file: $PWD/.env volumes: @@ -58,21 +58,21 @@ services: - front antivirus: - image: mailu/$ANTIVIRUS:$VERSION + image: $DOCKER_ORG/$ANTIVIRUS:$VERSION restart: 'no' env_file: $PWD/.env volumes: - "$ROOT/filter:/data" webdav: - image: mailu/$WEBDAV:$VERSION + image: $DOCKER_ORG/$WEBDAV:$VERSION restart: 'no' env_file: $PWD/.env volumes: - "$ROOT/dav:/data" admin: - image: mailu/admin:$VERSION + image: $DOCKER_ORG/admin:$VERSION restart: 'no' env_file: $PWD/.env volumes: @@ -83,7 +83,7 @@ services: - redis webmail: - image: "mailu/$WEBMAIL:$VERSION" + image: "$DOCKER_ORG/$WEBMAIL:$VERSION" restart: 'no' env_file: $PWD/.env volumes: @@ -92,7 +92,7 @@ services: - imap fetchmail: - image: mailu/fetchmail:$VERSION + image: $DOCKER_ORG/fetchmail:$VERSION restart: 'no' env_file: $PWD/.env volumes: diff --git a/tests/compose/test-script.sh b/tests/compose/test-script.sh index 711fd985..d7d5b23c 100755 --- a/tests/compose/test-script.sh +++ b/tests/compose/test-script.sh @@ -1,36 +1,36 @@ #!/bin/bash containers=( - mailu_webmail_1 - mailu_imap_1 - mailu_smtp_1 - mailu_antispam_1 - mailu_admin_1 - mailu_redis_1 - mailu_antivirus_1 - mailu_webdav_1 -# mailu_fetchmail_1 - mailu_front_1 + webmail_1 + imap_1 + smtp_1 + antispam_1 + admin_1 + redis_1 + antivirus_1 + webdav_1 +# fetchmail_1 + front_1 ) containers_check() { STATUS=0 for container in "${containers[@]}"; do - echo "Checking $container" - docker inspect $container | grep '"Status": "running"' || STATUS=1 + echo "Checking ${DOCKER_ORG}_${container}" + docker inspect "${DOCKER_ORG}_${container}" | grep '"Status": "running"' || STATUS=1 done return $STATUS } container_logs() { for container in "${containers[@]}"; do - echo "Showing logs for $container" - docker container logs $container + echo "Showing logs for ${DOCKER_ORG}_${container}" + docker container logs "${DOCKER_ORG}_${container}" done } for file in tests/compose/*.env ; do cp $file .env - docker-compose -f tests/compose/run.yml up -d + docker-compose -f tests/compose/run.yml -p $DOCKER_ORG up -d sleep 1m docker ps container_logs From 0c73be7c6e00ad8561642cff156f3d1157bd1513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Fri, 5 Oct 2018 13:02:10 +0300 Subject: [PATCH 3/3] Deploy on all branches --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9fc1d02f..2baa1183 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,6 @@ script: deploy: provider: script script: bash tests/deploy.sh + on: + all_branches: true