Skip to content

Commit

Permalink
Update Dockerfile to specify restricted Java temp directory (#1499)
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 authored Apr 17, 2024
1 parent 9f82d91 commit d8e2929
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ ENV REAPER_SEGMENT_COUNT_PER_NODE=64 \
REAPER_MGMT_API_METRICS_PORT=9000 \
REAPER_HTTP_MANAGEMENT_ENABLE="false" \
REAPER_HTTP_MANAGEMENT_KEYSTORE_PATH="" \
REAPER_HTTP_MANAGEMENT_TRUSTSTORE_PATH=""
REAPER_HTTP_MANAGEMENT_TRUSTSTORE_PATH="" \
REAPER_TMP_DIRECTORY="/var/tmp/cassandra-reaper" \
REAPER_MEMORY_STORAGE_DIRECTORY="/var/lib/cassandra-reaper/storage"

# used to run spreaper cli
RUN apk add --update \
Expand Down Expand Up @@ -114,6 +116,7 @@ RUN addgroup -g 1001 -S reaper && adduser -G reaper -S -u 1001 reaper && \
mkdir -p /var/lib/cassandra-reaper && \
mkdir -p /etc/cassandra-reaper/shiro && \
mkdir -p /var/log/cassandra-reaper && \
mkdir -p ${REAPER_TMP_DIRECTORY} && \
chown reaper:reaper \
/etc/cassandra-reaper/cassandra-reaper.yml \
/usr/local/lib/cassandra-reaper.jar \
Expand All @@ -123,7 +126,8 @@ RUN addgroup -g 1001 -S reaper && adduser -G reaper -S -u 1001 reaper && \
/usr/local/bin/configure-metrics.sh \
/usr/local/bin/configure-jmx-credentials.sh \
/usr/local/bin/spreaper \
/etc/cassandra-reaper/shiro.ini && \
/etc/cassandra-reaper/shiro.ini \
${REAPER_TMP_DIRECTORY} && \
chown -R reaper:reaper \
/var/lib/cassandra-reaper \
/etc/cassandra-reaper/shiro \
Expand Down
7 changes: 7 additions & 0 deletions src/server/src/main/docker/configure-persistence.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,11 @@ fi
# END cassandra persistence options

;;
"memory")
# BEGIN cassandra persistence options
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
persistenceStoragePath: ${REAPER_MEMORY_STORAGE_DIRECTORY}
EOT
;;
esac
2 changes: 2 additions & 0 deletions src/server/src/main/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if [ "$1" = 'cassandra-reaper' ]; then
${JAVA_OPTS} \
-Xms${REAPER_HEAP_SIZE} \
-Xmx${REAPER_HEAP_SIZE} \
-Djava.io.tmpdir=${REAPER_TMP_DIRECTORY} \
-cp "/usr/local/lib/*" io.cassandrareaper.ReaperApplication server \
/etc/cassandra-reaper/cassandra-reaper.yml
fi
Expand All @@ -62,6 +63,7 @@ if [ "$1" = 'schema-migration' ]; then
/usr/local/bin/configure-jmx-credentials.sh
exec java \
${JAVA_OPTS} \
-Djava.io.tmpdir=${REAPER_TMP_DIRECTORY} \
-cp "/usr/local/lib/*" io.cassandrareaper.ReaperApplication schema-migration \
/etc/cassandra-reaper/cassandra-reaper.yml
fi
Expand Down

0 comments on commit d8e2929

Please sign in to comment.