Skip to content

Commit

Permalink
Set JVM DNS cache TTL to 60
Browse files Browse the repository at this point in the history
  • Loading branch information
kerny3d committed Jan 10, 2024
1 parent dc7c404 commit 5e52171
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Knowage-Server-Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,19 @@ COPY CHANGELOG.md LICENSE README.md entrypoint.sh ./
COPY scripts/ ./scripts/

# Install required packages and clean up to save space
RUN apt-get update \
RUN apt-get update \
&& apt-get install -q --no-install-recommends -y wget coreutils unzip mariadb-client-10.3 xmlstarlet libtcnative-1 libapr1 vim \
&& rm -rf /var/lib/apt/lists/*

# In Java, DNS resolutions are cached indefinitely. This is a problem in environment like AWS where IP could
# occasionally change, for example, when you use a service served by a load balancer.
#
# Watch out that per Oracle documentation, this could be a security flaw.
#
# See:
# - https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/jvm-ttl-dns.html
RUN sed -i 's/#networkaddress.cache.ttl=-1/networkaddress.cache.ttl=60/' $JAVA_HOME/jre/lib/security/java.security

COPY --from=init ${KNOWAGE_DIRECTORY}/db/ ${KNOWAGE_DIRECTORY}/db/

ENV MYSQL_SCRIPT_DIRECTORY ${KNOWAGE_DIRECTORY}/db/mysql
Expand Down
2 changes: 2 additions & 0 deletions Knowage-Server-Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ version: "3.1"
services:
knowage:
image: knowagelabs/knowage-server-docker:8.2-SNAPSHOT
hostname: knowage
ports:
- "8080:8080"
environment:
Expand Down Expand Up @@ -154,6 +155,7 @@ version: "3.1"
services:
knowage:
image: knowagelabs/knowage-server-docker:8.2-SNAPSHOT
hostname: knowage
ports:
- "127.0.0.1:8080:8080"
...
Expand Down
1 change: 1 addition & 0 deletions Knowage-Server-Docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: "3.8"
services:
knowage:
image: knowagelabs/knowage-server-docker:8.2-SNAPSHOT
hostname: knowage
depends_on:
- knowagedb
- knowagecache
Expand Down
1 change: 1 addition & 0 deletions Knowage-Server-Docker/docker-swarm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: "3.1"
services:
knowage:
image: knowagelabs/knowage-server-docker:8.2-SNAPSHOT
hotsname: knowage
depends_on:
- knowagedb
- knowagecache
Expand Down

0 comments on commit 5e52171

Please sign in to comment.