mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Maxim Thomas
13.54.2025 c350e07b30541e430c5acccfcd763fbf0b485cbf
Configure backend type for Docker (#489)

2 files modified
30 ■■■■ changed files
opendj-packages/opendj-docker/README.md 2 ●●●●● patch | view | raw | blame | history
opendj-packages/opendj-docker/bootstrap/setup.sh 28 ●●●● patch | view | raw | blame | history
opendj-packages/opendj-docker/README.md
@@ -28,3 +28,5 @@
| OPENDJ_USER             | -                               | user which runs OpenDJ                                                                                                                                                                                                                                  |
| OPENDJ_REPLICATION_TYPE | -                               | OpenDJ Replication type, valid values are: <ul><li>simple - standart replication</li><li>srs - standalone replication servers</li><li>sdsr - Standalone Directory Server Replicas</li><li>rg - Replication Groups</li></ul>Other values will be ignored |
| OPENDJ_SSL_OPTIONS      | --generateSelfSignedCertificate | you can replace ssl options at here, like : "--usePkcs12keyStore /opt/domain.pfx --keyStorePassword domain"                                                                                                                                             |
| BACKEND_TYPE            | je                              | OpenDJ backend type, see [dsconfig create-backend](https://doc.openidentityplatform.org/opendj/reference/dsconfig-subcommands-ref#dsconfig-create-backend) documentation                                                                                |
| BACKEND_DB_DIRECTORY    | db                              | OpenDJ `db-directory` attribute for backend                                                                                                                                                                                                             |
opendj-packages/opendj-docker/bootstrap/setup.sh
@@ -21,7 +21,6 @@
/opt/opendj/setup \
  --cli \
  -h localhost \
  --baseDN $BASE_DN \
  --ldapPort $PORT \
  --ldapsPort $LDAPS_PORT \
  --enableStartTLS $OPENDJ_SSL_OPTIONS \
@@ -31,10 +30,31 @@
  --acceptLicense \
  --no-prompt \
  --noPropertiesFile \
  --doNotStart \
  $ADD_BASE_ENTRY #--sampleData 1
  $SETUP_ARGS
/opt/opendj/bin/start-ds
BACKEND_TYPE=${BACKEND_TYPE:-je}
BACKEND_DB_DIRECTORY=${BACKEND_DB_DIRECTORY:-db}
echo "creating backend: $BACKEND_TYPE db-directory: ${BACKEND_DB_DIRECTORY}"
/opt/opendj/bin/dsconfig create-backend -h localhost -p $ADMIN_PORT --bindDN "$ROOT_USER_DN" --bindPassword "$ROOT_PASSWORD" \
  --backend-name=userRoot --type $BACKEND_TYPE --set base-dn:$BASE_DN --set "db-directory:$BACKEND_DB_DIRECTORY" \
  --set enabled:true --no-prompt --trustAll
if [ "$ADD_BASE_ENTRY" = "--addBaseEntry" ]; then
  DC=$(echo "$BASE_DN" | awk -F',|=' '{print $2}')
  /opt/opendj/bin/ldapmodify --hostname localhost \
    --port 1636 --bindDN "$ROOT_USER_DN" --bindPassword "$ROOT_PASSWORD" \
    --useSsl --trustAll <<EOF
dn: $BASE_DN
dc: $DC
objectClass: domain
objectClass: top
EOF
fi
# There are multiple types of ldif files.
# The steps below import ldifs via `ldapmodify`.