Skip to content

Commit f33e1ad

Browse files
authored
[#845] Setup with embedded DJ may crash (#853)
1 parent 9b6b073 commit f33e1ad

File tree

4 files changed

+84
-43
lines changed

4 files changed

+84
-43
lines changed

.github/workflows/build.yml

+48-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,31 @@ jobs:
101101
- name: Docker test
102102
shell: bash
103103
run: |
104-
docker run --rm -it -d --name=test localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}
104+
docker run --rm -it -d --memory="1g" -h openam.example.org --name=test localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}
105105
timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" test | grep -q \"healthy\"; do sleep 10; done'
106+
docker exec -w '/usr/openam/ssoconfiguratortools' test bash -c \
107+
'echo "ACCEPT_LICENSES=true
108+
SERVER_URL=http://openam.example.org:8080
109+
DEPLOYMENT_URI=/$OPENAM_PATH
110+
BASE_DIR=$OPENAM_DATA_DIR
111+
locale=en_US
112+
PLATFORM_LOCALE=en_US
113+
AM_ENC_KEY=
114+
ADMIN_PWD=passw0rd
115+
AMLDAPUSERPASSWD=p@passw0rd
116+
COOKIE_DOMAIN=example.org
117+
ACCEPT_LICENSES=true
118+
DATA_STORE=embedded
119+
DIRECTORY_SSL=SIMPLE
120+
DIRECTORY_SERVER=openam.example.org
121+
DIRECTORY_PORT=50389
122+
DIRECTORY_ADMIN_PORT=4444
123+
DIRECTORY_JMX_PORT=1689
124+
ROOT_SUFFIX=dc=openam,dc=example,dc=org
125+
DS_DIRMGRDN=cn=Directory Manager
126+
DS_DIRMGRPASSWD=passw0rd" > conf.file && java -jar openam-configurator-tool*.jar --file conf.file'
127+
sleep 35
128+
docker inspect --format="{{json .State.Health.Status}}" test | grep -q \"healthy\"
106129
build-docker-alpine:
107130
runs-on: 'ubuntu-latest'
108131
services:
@@ -150,5 +173,28 @@ jobs:
150173
- name: Docker test
151174
shell: bash
152175
run: |
153-
docker run --rm -it -d --name=test localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}-alpine
176+
docker run --rm -it -d --memory="2g" -h openam.example.org --name=test localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}-alpine
154177
timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" test | grep -q \"healthy\"; do sleep 10; done'
178+
docker exec -w '/usr/openam/ssoconfiguratortools' test bash -c \
179+
'echo "ACCEPT_LICENSES=true
180+
SERVER_URL=http://openam.example.org:8080
181+
DEPLOYMENT_URI=/$OPENAM_PATH
182+
BASE_DIR=$OPENAM_DATA_DIR
183+
locale=en_US
184+
PLATFORM_LOCALE=en_US
185+
AM_ENC_KEY=
186+
ADMIN_PWD=passw0rd
187+
AMLDAPUSERPASSWD=p@passw0rd
188+
COOKIE_DOMAIN=example.org
189+
ACCEPT_LICENSES=true
190+
DATA_STORE=embedded
191+
DIRECTORY_SSL=SIMPLE
192+
DIRECTORY_SERVER=openam.example.org
193+
DIRECTORY_PORT=50389
194+
DIRECTORY_ADMIN_PORT=4444
195+
DIRECTORY_JMX_PORT=1689
196+
ROOT_SUFFIX=dc=openam,dc=example,dc=org
197+
DS_DIRMGRDN=cn=Directory Manager
198+
DS_DIRMGRPASSWD=passw0rd" > conf.file && java -jar openam-configurator-tool*.jar --file conf.file'
199+
sleep 35
200+
docker inspect --format="{{json .State.Health.Status}}" test | grep -q \"healthy\"

openam-core/src/main/java/com/sun/identity/setup/EmbeddedOpenDS.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* $Id: EmbeddedOpenDS.java,v 1.27 2010/01/15 01:22:39 goodearth Exp $
2626
*
2727
* Portions Copyrighted 2010-2016 ForgeRock AS.
28+
* Portions Copyrighted 2017-2025 3A Systems, LLC.
2829
*/
2930

3031
package com.sun.identity.setup;
@@ -468,7 +469,7 @@ public static void startServer(String odsRoot) throws Exception {
468469
debug.message("...EmbeddedOpenDS.startServer:DS Server started.");
469470

470471
int sleepcount = 0;
471-
while (!EmbeddedUtils.isRunning() && (sleepcount < 60)) {
472+
while ((!EmbeddedUtils.isRunning() || !com.sun.identity.setup.AMSetupDSConfig.getInstance().isDServerUp()) && (sleepcount < 60)) {
472473
sleepcount++;
473474
SetupProgress.reportStart("emb.waitingforstarted", null);
474475
Thread.sleep(1000);

openam-distribution/openam-distribution-docker/Dockerfile

+19-22
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
FROM tomcat:9-jre21
22

3-
MAINTAINER Open Identity Platform Community <[email protected]>
4-
5-
ENV CATALINA_HOME=/usr/local/tomcat \
6-
OPENAM_PATH="openam" \
7-
OPENAM_USER="openam" \
8-
OPENAM_DATA_DIR="/usr/openam/config"
9-
ENV PATH=$CATALINA_HOME/bin:$PATH \
10-
JAVA_OPTS="--add-exports java.base/sun.security.util=ALL-UNNAMED --add-exports java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-exports java.base/sun.security.x509=ALL-UNNAMED --add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED" \
11-
MEMORY="-server -XX:+UseG1GC -XX:+UseContainerSupport" \
12-
CATALINA_OPTS="$MEMORY -Dcom.iplanet.services.configpath=$OPENAM_DATA_DIR -Dcom.sun.identity.configuration.directory=$OPENAM_DATA_DIR"
13-
14-
WORKDIR $CATALINA_HOME
15-
16-
ARG VERSION @project_version@
17-
18-
RUN apt-get update && apt-get install -y curl unzip
19-
20-
RUN rm -rf $CATALINA_HOME/webapps/* \
3+
LABEL org.opencontainers.image.authors="Open Identity Platform Community"
4+
5+
ENV CATALINA_HOME=/usr/local/tomcat
6+
ENV OPENAM_PATH="openam"
7+
ENV OPENAM_USER="openam"
8+
ENV OPENAM_DATA_DIR="/usr/openam/config"
9+
ENV PATH="$CATALINA_HOME/bin:$PATH"
10+
ENV JAVA_OPTS="--add-exports java.base/sun.security.util=ALL-UNNAMED --add-exports java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-exports java.base/sun.security.x509=ALL-UNNAMED --add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED"
11+
ENV MEMORY="-server"
12+
ENV CATALINA_OPTS="$MEMORY -Dcom.iplanet.services.configpath=$OPENAM_DATA_DIR -Dcom.sun.identity.configuration.directory=$OPENAM_DATA_DIR"
13+
14+
ARG VERSION
15+
16+
RUN apt-get update && apt-get install -y curl unzip \
17+
&& rm -rf $CATALINA_HOME/webapps/* \
18+
&& if [ -z "$VERSION" ] ; then VERSION="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenAM/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)"; fi \
2119
&& curl -L https://github.com/OpenIdentityPlatform/OpenAM/releases/download/$VERSION/OpenAM-$VERSION.war --output $CATALINA_HOME/webapps/$OPENAM_PATH.war \
2220
&& mkdir /usr/openam \
2321
&& curl -L https://github.com/OpenIdentityPlatform/OpenAM/releases/download/$VERSION/SSOConfiguratorTools-$VERSION.zip --output /usr/openam/ssoconfiguratortools.zip \
@@ -29,14 +27,13 @@ RUN rm -rf $CATALINA_HOME/webapps/* \
2927
&& useradd -m -r -u 1001 -g root $OPENAM_USER \
3028
&& install -d -o $OPENAM_USER $OPENAM_DATA_DIR \
3129
&& chown -R $OPENAM_USER:root $CATALINA_HOME \
30+
&& apt-get remove -y --purge unzip \
31+
&& rm -rf /var/lib/apt/lists/* \
3232
&& sed -i '/<\/Host>/i \ \ \ \ <Valve className=\"org.apache.catalina.valves.RemoteIpValve\" httpServerPort=\"8080\" httpsServerPort=\"443\" />' $CATALINA_HOME/conf/server.xml
3333

34-
RUN apt-get remove -y --purge unzip \
35-
&& rm -rf /var/lib/apt/lists/*
36-
3734
USER $OPENAM_USER
3835

39-
EXPOSE 8080
36+
EXPOSE 8080/tcp
4037

4138
HEALTHCHECK --interval=30s --timeout=30s --start-period=1s --retries=3 CMD curl -v -L --fail http://localhost:8080/$OPENAM_PATH/isAlive.jsp || exit 1
4239

openam-distribution/openam-distribution-docker/Dockerfile-alpine

+15-18
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
FROM tomcat:9-jre8-alpine
22

3-
MAINTAINER Open Identity Platform Community <[email protected]>
3+
LABEL org.opencontainers.image.authors="Open Identity Platform Community"
44

5-
ENV CATALINA_HOME=/usr/local/tomcat \
6-
OPENAM_PATH="openam" \
7-
OPENAM_USER="openam" \
8-
OPENAM_DATA_DIR="/usr/openam/config"
9-
ENV PATH=$CATALINA_HOME/bin:$PATH \
10-
MEMORY="-server -XX:+UseG1GC -XX:+UseContainerSupport" \
11-
CATALINA_OPTS="$MEMORY -Dcom.iplanet.services.configpath=$OPENAM_DATA_DIR -Dcom.sun.identity.configuration.directory=$OPENAM_DATA_DIR"
5+
ENV CATALINA_HOME=/usr/local/tomcat
6+
ENV OPENAM_PATH="openam"
7+
ENV OPENAM_USER="openam"
8+
ENV OPENAM_DATA_DIR="/usr/openam/config"
9+
ENV PATH="$CATALINA_HOME/bin:$PATH"
10+
ENV MEMORY="-server -XX:+UseG1GC -XX:+UseContainerSupport"
11+
ENV CATALINA_OPTS="$MEMORY -Dcom.iplanet.services.configpath=$OPENAM_DATA_DIR -Dcom.sun.identity.configuration.directory=$OPENAM_DATA_DIR"
1212

13-
WORKDIR $CATALINA_HOME
13+
ARG VERSION
1414

15-
ARG VERSION @project_version@
16-
17-
RUN apk add --update --no-cache --virtual curl builddeps unzip bash && apk upgrade --update --no-cache
18-
19-
RUN rm -rf $CATALINA_HOME/webapps/* \
15+
RUN apk add --update --no-cache --virtual curl builddeps unzip bash && apk upgrade --update --no-cache \
16+
&& rm -rf $CATALINA_HOME/webapps/* \
17+
&& if [ -z "$VERSION" ] ; then VERSION="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenAM/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)"; fi \
2018
&& curl -L https://github.com/OpenIdentityPlatform/OpenAM/releases/download/$VERSION/OpenAM-$VERSION.war --output $CATALINA_HOME/webapps/$OPENAM_PATH.war \
2119
&& mkdir /usr/openam \
2220
&& curl -L https://github.com/OpenIdentityPlatform/OpenAM/releases/download/$VERSION/SSOConfiguratorTools-$VERSION.zip --output /usr/openam/ssoconfiguratortools.zip \
@@ -27,14 +25,13 @@ RUN rm -rf $CATALINA_HOME/webapps/* \
2725
&& chmod -R g=u /usr/openam/ \
2826
&& adduser -S -u 1001 -G root $OPENAM_USER \
2927
&& install -d -o $OPENAM_USER $OPENAM_DATA_DIR \
30-
&& chown -R $OPENAM_USER:root $CATALINA_HOME/webapps \
28+
&& chown -R $OPENAM_USER:root $CATALINA_HOME \
29+
&& apk del unzip && rm -rf /var/cache/apk/* \
3130
&& sed -i '/<\/Host>/i \ \ \ \ <Valve className=\"org.apache.catalina.valves.RemoteIpValve\" httpServerPort=\"8080\" httpsServerPort=\"443\" />' $CATALINA_HOME/conf/server.xml
3231

33-
RUN apk del unzip && rm -rf /var/cache/apk/*
34-
3532
USER $OPENAM_USER
3633

37-
EXPOSE 8080
34+
EXPOSE 8080/tcp
3835

3936
HEALTHCHECK --interval=30s --timeout=30s --start-period=1s --retries=3 CMD curl -v -L --fail http://localhost:8080/$OPENAM_PATH/isAlive.jsp || exit 1
4037

0 commit comments

Comments
 (0)