LDAP integration for gerrit

Change-Id: I34d0e83223223f1b95bab8eb808026e2123701da
diff --git a/docker/swarm/service/gerrit.yml b/docker/swarm/service/gerrit.yml
index d33bdbb..36e4faa 100644
--- a/docker/swarm/service/gerrit.yml
+++ b/docker/swarm/service/gerrit.yml
@@ -1,6 +1,12 @@
 parameters:
   _param:
     docker_image_gerrit: tcpcloud/gerrit:2.12.7
+    gerrit_ldap_server: ""
+    gerrit_ldap_bind_user: ""
+    gerrit_ldap_bind_password: ""
+    gerrit_ldap_account_base: ""
+    gerrit_ldap_group_base: ""
+
   docker:
     client:
       service:
@@ -13,6 +19,13 @@
             DB_ENV_MYSQL_PASSWORD: ${_param:mysql_gerrit_password}
             DB_ENV_MYSQL_DB: gerrit
             AUTH_TYPE: ${_param:gerrit_auth_type}
+            LDAP_SERVER: ${_param:gerrit_ldap_server}
+            LDAP_ACCOUNTPATTERN: '(|(uid={username})(cn={username}))'
+            LDAP_ACCOUNTBASE: ${_param:gerrit_ldap_account_base}
+            LDAP_GROUPBASE: ${_param:gerrit_ldap_group_base}
+            LDAP_USERNAME: ${_param:gerrit_ldap_bind_user}
+            LDAP_PASSWORD: ${_param:gerrit_ldap_bind_password}
+            CAPABILITY_ADMINISTRATESERVER: admin
             WEBURL: ${_param:gerrit_public_host}
             GERRIT_ADMIN_SSH_PUBLIC: ${_param:gerrit_admin_public_key}
             GERRIT_ADMIN_PWD: ${_param:gerrit_admin_password}
diff --git a/docker/swarm/service/openldap.yml b/docker/swarm/service/openldap.yml
index 863144c..f7f12e2 100644
--- a/docker/swarm/service/openldap.yml
+++ b/docker/swarm/service/openldap.yml
@@ -5,8 +5,6 @@
     client:
       service:
         openldap:
-          # XXX: docker service is not able to set hostname
-          # https://github.com/docker/docker/issues/24877
           restart:
             condition: any
           image: ${_param:docker_image_openldap}
@@ -21,9 +19,6 @@
             LDAP_DOMAIN: "${_param:openldap_domain}"
             LDAP_ADMIN_PASSWORD: ${_param:openldap_admin_password}
             LDAP_CONFIG_PASSWORD: ${_param:openldap_config_password}
-            LDAP_READONLY_USER: "true"
-            LDAP_READONLY_USER_USERNAME: readonly
-            LDAP_READONLY_USER_PASSWORD: ${_param:openldap_readonly_password}
             LDAP_TLS: "false"
           ports:
             - 1389:389