From 124eb25513bb36a9b7627187592f2f5812dc2017 Mon Sep 17 00:00:00 2001 From: Felix Bartels Date: Thu, 9 May 2019 09:22:33 +0200 Subject: [PATCH] Add second ldap image without demo data (#150) * have a separate ldap container for demo data * add question to setup.sh about demo users * make ldap container switchable * piggyback small fixup for search failing when starting directly after kopano-server fixes #53 --- Makefile | 10 ++++++++-- core/start-service.sh | 2 ++ docker-compose.yml | 2 +- ldap/Dockerfile | 5 +++++ ldap/README.md | 5 +++++ .../bootstrap/ldif/optimize-index.ldif | 0 .../bootstrap/schema/mmc/kopano.schema | 0 ldap_demo/Dockerfile | 5 ++--- setup.sh | 11 +++++++++++ 9 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 ldap/Dockerfile create mode 100644 ldap/README.md rename {ldap_demo => ldap}/bootstrap/ldif/optimize-index.ldif (100%) rename {ldap_demo => ldap}/bootstrap/schema/mmc/kopano.schema (100%) diff --git a/Makefile b/Makefile index e779e94..56dc68c 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ COMPONENT = $(shell echo $(component) | tr a-z A-Z) .PHONY: all all: build-all -build-all: build-base build-core build-kdav build-konnect build-kwmserver build-ldap-demo build-meet build-php build-playground build-scheduler build-ssl build-utils build-web build-webapp build-zpush +build-all: build-base build-core build-kdav build-konnect build-kwmserver build-ldap build-ldap-demo build-meet build-php build-playground build-scheduler build-ssl build-utils build-web build-webapp build-zpush .PHONY: build build: component ?= base @@ -112,7 +112,10 @@ build-konnect: build-kwmserver: component=kwmserver make build-simple -build-ldap-demo: +build-ldap: + component=ldap make build-simple + +build-ldap-demo: build-ldap component=ldap_demo make build-simple build-meet: build-base @@ -250,6 +253,9 @@ publish-konnect: build-konnect tag-konnect publish-kwmserver: build-kwmserver tag-kwmserver component=kwmserver make publish-container +publish-ldap: build-ldap + docker push $(docker_repo)/kopano_ldap:latest + publish-ldap-demo: build-ldap-demo docker push $(docker_repo)/kopano_ldap_demo:latest diff --git a/core/start-service.sh b/core/start-service.sh index 8ac0f47..7a5d456 100755 --- a/core/start-service.sh +++ b/core/start-service.sh @@ -113,6 +113,8 @@ search) dockerize \ -wait file://var/run/kopano/server.sock \ -timeout 360s + # give kopano-server a moment to settler before starting search + sleep 5 # cleaning up env variables unset "${!KCCONF_@}" exec /usr/bin/python3 /usr/sbin/kopano-search -F diff --git a/docker-compose.yml b/docker-compose.yml index 3af7af8..9c0c290 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: - ${FQDNCLEANED?err} ldap: - image: ${docker_repo:-zokradonh}/kopano_ldap_demo + image: ${docker_repo:-zokradonh}/${LDAP_CONTAINER:-kopano_ldap_demo} restart: unless-stopped container_name: ${COMPOSE_PROJECT_NAME}_ldap ports: diff --git a/ldap/Dockerfile b/ldap/Dockerfile new file mode 100644 index 0000000..add03b8 --- /dev/null +++ b/ldap/Dockerfile @@ -0,0 +1,5 @@ +FROM osixia/openldap:1.2.4 + +COPY bootstrap /container/service/slapd/assets/config/bootstrap +RUN rm /container/service/slapd/assets/config/bootstrap/schema/mmc/mail.schema +RUN touch /etc/ldap/slapd.conf diff --git a/ldap/README.md b/ldap/README.md new file mode 100644 index 0000000..f96be43 --- /dev/null +++ b/ldap/README.md @@ -0,0 +1,5 @@ +# Kopano LDAP image + +[![](https://images.microbadger.com/badges/image/zokradonh/kopano_ldap.svg)](https://microbadger.com/images/zokradonh/kopano_ldap "Microbadger size/labels") [![](https://images.microbadger.com/badges/version/zokradonh/kopano_ldap.svg)](https://microbadger.com/images/zokradonh/kopano_ldap "Microbadger version") + +Image to for an OpenLDAP server that already includes the Kopano LDAP schema. Based on https://github.com/osixia/docker-openldap. \ No newline at end of file diff --git a/ldap_demo/bootstrap/ldif/optimize-index.ldif b/ldap/bootstrap/ldif/optimize-index.ldif similarity index 100% rename from ldap_demo/bootstrap/ldif/optimize-index.ldif rename to ldap/bootstrap/ldif/optimize-index.ldif diff --git a/ldap_demo/bootstrap/schema/mmc/kopano.schema b/ldap/bootstrap/schema/mmc/kopano.schema similarity index 100% rename from ldap_demo/bootstrap/schema/mmc/kopano.schema rename to ldap/bootstrap/schema/mmc/kopano.schema diff --git a/ldap_demo/Dockerfile b/ldap_demo/Dockerfile index add03b8..c064224 100644 --- a/ldap_demo/Dockerfile +++ b/ldap_demo/Dockerfile @@ -1,5 +1,4 @@ -FROM osixia/openldap:1.2.4 +ARG docker_repo=zokradonh +FROM ${docker_repo}/kopano_ldap COPY bootstrap /container/service/slapd/assets/config/bootstrap -RUN rm /container/service/slapd/assets/config/bootstrap/schema/mmc/mail.schema -RUN touch /etc/ldap/slapd.conf diff --git a/setup.sh b/setup.sh index 44f20af..55ee92c 100755 --- a/setup.sh +++ b/setup.sh @@ -164,6 +164,16 @@ if [ ! -e ./.env ]; then PRINT_SETUP_SUCCESS="$PRINT_SETUP_SUCCESS \n!! You have specified the LDAP server '${LDAP_SERVER}', don't forget to remove the bundled ldap and ldap-admin services in docker-compose.yml\n" else + value_default="yes" + read -r -p "Use bundled LDAP with demo users? yes/no [$value_default]: " new_value + LDAP_CONTAINER_QUESTION=${new_value:-$value_default} + + if [ "${LDAP_CONTAINER_QUESTION}" == "yes" ]; then + LDAP_CONTAINER="kopano_ldap_demo" + else + LDAP_CONTAINER="kopano_ldap" + fi + LDAP_ADMIN_PASSWORD=$(random_string) LDAP_SEARCH_BASE="$LDAP_BASE_DN" LDAP_BIND_DN="cn=readonly,$LDAP_BASE_DN" @@ -273,6 +283,7 @@ KWM_VERSION=$KWM_VERSION MEET_VERSION=$MEET_VERSION KDAV_VERSION=$KDAV_VERSION +LDAP_CONTAINER=$LDAP_CONTAINER LDAP_ORGANISATION="$LDAP_ORGANISATION" LDAP_DOMAIN=$FQDN LDAP_BASE_DN=$LDAP_BASE_DN