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

Allow overrides of server.xml and web.xml #118

Merged
merged 1 commit into from
Mar 16, 2021
Merged
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
23 changes: 22 additions & 1 deletion scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ mkdir -p $secret_root
prlog4j2="${config_root}/prlog4j2.xml"
prconfig="${config_root}/prconfig.xml"
context_xml="${config_root}/context.xml"
server_xml="${config_root}/server.xml"
web_xml="${config_root}/web.xml"
tomcatusers_xml="${config_root}/tomcat-users.xml"

db_username_file="${secret_root}/DB_USERNAME"
Expand Down Expand Up @@ -178,7 +180,6 @@ fi

/bin/dockerize -template ${CATALINA_HOME}/conf/Catalina/localhost/${appContextFileName}.xml:${CATALINA_HOME}/conf/Catalina/localhost/${appContextFileName}.xml


#
# Copying mounted prlog4j2 file to webapps/prweb/WEB-INF/classes
#
Expand All @@ -199,6 +200,26 @@ else
echo "No prconfig was specified in ${prconfig}. Using defaults."
fi

#
# Copying mounted server.xml file to conf
#
if [ -e "${server_xml}" ]; then
echo "Loading server.xml from ${server_xml}...";
cp "${server_xml}" "${CATALINA_HOME}/conf/"
else
echo "No server.xml was specified in ${server_xml}. Using defaults."
fi

#
# Copying mounted web.xml file to conf
#
if [ -e "${web_xml}" ]; then
echo "Loading web.xml from ${web_xml}...";
cp "${web_xml}" "${PEGA_DEPLOYMENT_DIR}/WEB-INF/"
else
echo "No web.xml was specified in ${web_xml}. Using defaults."
fi

#
# Write config files from templates using dockerize ...
#
Expand Down
50 changes: 49 additions & 1 deletion tests/pega-web-ready-testcases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,54 @@ commandTests:
exitCode: 0
expectedOutput: ["Loading prlog4j2 from /opt/pega/config/prlog4j2.xml"]

# Verify test case for mounted server.xml
- name: "Mounted server.xml"
envVars:
- key: "JDBC_URL"
value: "jdbc:postgresql://localhost:5432/pegadb"
- key: "JDBC_CLASS"
value: "org.postgresql.Driver"
- key: "DB_USERNAME"
value: "postgres"
- key: "DB_PASSWORD"
value: "postgres"
- key: "RULES_SCHEMA"
value: "rules"
- key: "DATA_SCHEMA"
value: "data"
command: "bash"
args:
- -c
- |
mv /tests/test-artifacts/server.xml /opt/pega/config/server.xml &&
bash -c './scripts/docker-entrypoint.sh'
exitCode: 0
expectedOutput: ["Loading server.xml from /opt/pega/config/server.xml"]

# Verify test case for mounted web.xml
- name: "Mounted web.xml"
envVars:
- key: "JDBC_URL"
value: "jdbc:postgresql://localhost:5432/pegadb"
- key: "JDBC_CLASS"
value: "org.postgresql.Driver"
- key: "DB_USERNAME"
value: "postgres"
- key: "DB_PASSWORD"
value: "postgres"
- key: "RULES_SCHEMA"
value: "rules"
- key: "DATA_SCHEMA"
value: "data"
command: "bash"
args:
- -c
- |
mv /tests/test-artifacts/web.xml /opt/pega/config/web.xml &&
bash -c './scripts/docker-entrypoint.sh'
exitCode: 0
expectedOutput: ["Loading web.xml from /opt/pega/config/web.xml"]

# Hazelcast Username as file input
- name: "Hazelcast Username as file input"
envVars:
Expand Down Expand Up @@ -1048,4 +1096,4 @@ commandTests:
- -c
- |
bash -c './scripts/docker-entrypoint.sh'
expectedOutput: ["No context.xml was specified"]
expectedOutput: ["No context.xml was specified"]
1 change: 1 addition & 0 deletions tests/test-artifacts/server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mounted server.xml
1 change: 1 addition & 0 deletions tests/test-artifacts/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mounted web.xml