Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure backend type for Docker #489

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions opendj-packages/opendj-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ docker run -d -p 1389:1389 -p 1636:1636 -p 4444:4444 --name opendj openidentityp
| 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 |
28 changes: 24 additions & 4 deletions opendj-packages/opendj-docker/bootstrap/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ fi
/opt/opendj/setup \
--cli \
-h localhost \
--baseDN $BASE_DN \
--ldapPort $PORT \
--ldapsPort $LDAPS_PORT \
--enableStartTLS $OPENDJ_SSL_OPTIONS \
Expand All @@ -31,10 +30,31 @@ fi
--acceptLicense \
--no-prompt \
--noPropertiesFile \
--doNotStart \
$ADD_BASE_ENTRY #--sampleData 1
$SETUP_ARGS

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

/opt/opendj/bin/start-ds

# There are multiple types of ldif files.
# The steps below import ldifs via `ldapmodify`.
Expand Down