{
    "captainVersion": "2",
    "documentation": "https://github.com/osixia/docker-openldap",
    "description": "OpenLDAP with administration interface",
    "displayName": "OpenLDAP + phpLDAPadmin",
    "dockerCompose": {
        "version": "3.8",
        "services": {
            "$$cap_appname": {
                "image": "osixia/openldap:$$cap_openldap_version",
                "restart": "always",
                "volumes": ["$$cap_appname-db:/var/lib/ldap"],
                "notExposeAsWebApp": "true",
                "environment": {
                    "LDAP_ORGANISATION": "$$cap_openldap_ldap-organisation",
                    "LDAP_DOMAIN": "$$cap_root_domain",
                    "LDAP_ADMIN_PASSWORD": "$$cap_openldap_ldap-admin-password"
                }
            },
            "$$cap_appname-admin": {
                "image": "osixia/phpldapadmin:$$cap_phpldapadmin_version",
                "containerHttpPort": "80",
                "restart": "always",
                "depends_on": ["$$cap_appname"],
                "environment": {
                    "PHPLDAPADMIN_TRUST_PROXY_SSL": true,
                    "PHPLDAPADMIN_LDAP_HOSTS": "srv-captain--$$cap_appname",
                    "PHPLDAPADMIN_SERVER_ADMIN": "$$cap_phpldapadmin_admin-email",
                    "PHPLDAPADMIN_SERVER_PATH": "https://$$cap_appname-admin.$$cap_root_domain",
                    "PHPLDAPADMIN_HTTPS": false
                }
            }
        },
        "volumes": {
            "$$cap_appname-db": {}
        }
    },
    "instructions": {
        "start": "OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol.",
        "end": "OpenLDAP is deployed and the admin interface is available on http://$$cap_appname-admin.$$cap_root_domain. You can connect by adapting cn=admin,dc=my-company,dc=com. If you want to access to your ldap server from outside, do not forget to add port mapping (389 for ldap with starttls, 636 for ldaps)."
    },
    "variables": [
        {
            "id": "$$cap_openldap_version",
            "label": "Openldap Version",
            "defaultValue": "1.4.0",
            "description": "Checkout their docker page for the valid tags https://hub.docker.com/r/osixia/openldap/tags",
            "validRegex": "/^([^\\s^\\/])+$/"
        },
        {
            "id": "$$cap_openldap_ldap-organisation",
            "label": "Ldap Organisation",
            "description": "The Organization name",
            "validRegex": "/.{1,}/"
        },
        {
            "id": "$$cap_openldap_ldap-admin-password",
            "label": "The admin Password",
            "description": "The admin password of the Openldap",
            "validRegex": "/.{1,}/"
        },
        {
            "id": "$$cap_phpldapadmin_version",
            "label": "PHPLadapAdmin Version",
            "defaultValue": "0.9.0",
            "description": "Checkout their docker page for the valid tags https://hub.docker.com/r/osixia/phpldapadmin/tags",
            "validRegex": "/^([^\\s^\\/])+$/"
        },
        {
            "id": "$$cap_phpldapadmin_admin-email",
            "label": "The admin email",
            "description": "The admin email of the Openldap administration interface",
            "validRegex": "/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/"
        }
    ]
}
