Skip to content

Commit

Permalink
Merge branch 'thelastpickle:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bschoening authored Sep 4, 2024
2 parents d50ba58 + 92ddde6 commit 4952ea5
Show file tree
Hide file tree
Showing 78 changed files with 1,499 additions and 629 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Change Log

### 3.6.1 (2024/06/11 07:14 +00:00)
- [#1507](https://github.com/thelastpickle/cassandra-reaper/pull/1507) Allow mounting a volume to host the config and enable read only root FS (#1507) (@adejanovski)

### 3.6.0 (2024/04/18 08:53 +00:00)
- [#1500](https://github.com/thelastpickle/cassandra-reaper/pull/1500) Upgrade snakeyaml (#1500) (@emerkle826)
- [#1499](https://github.com/thelastpickle/cassandra-reaper/pull/1499) Update Dockerfile to specify restricted Java temp directory (#1499) (@emerkle826)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.19</version>
<version>10.17.0</version>
</dependency>
</dependencies>
</plugin>
Expand Down
3 changes: 2 additions & 1 deletion src/docs/content/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ Returns OK if all goes well NOT_MODIFIED if new state is the same as the old one
* *segmentCountPerNode*: Defines the amount of segments per node to create for scheduled repair runs. (Optional)
* *repairParallelism*: Defines the used repair parallelism for scheduled repair runs. (Optional)
* *intensity*: Defines the repair intensity for scheduled repair runs. (Optional)
* *incrementalRepair*: Defines if incremental repair should be done. [true/false] (Optional)
* *incrementalRepair*: Defines if incremental repair should be done on all tokens of each node at once. [true/false] (Optional)
* *subrangeIncrementalRepair*: Defines if incremental repair should be done in subrange mode, against discrete token ranges. [true/false] (Optional)
* *scheduleDaysBetween*: Defines the amount of days to wait between scheduling new repairs.
For example, use value 7 for weekly schedule, and 0 for continuous.
* *scheduleTriggerTime*: Defines the time for first scheduled trigger for the run.
Expand Down
1 change: 1 addition & 0 deletions src/docs/content/docs/configuration/docker_vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The Docker environment variables listed in this section map directly to Reaper s
<code class="codeLarge">REAPER_ENABLE_DYNAMIC_SEED_LIST</code> | [enableDynamicSeedList]({{< relref "reaper_specific.md#enabledynamicseedlist" >}}) | true
<code class="codeLarge">REAPER_HANGING_REPAIR_TIMEOUT_MINS</code> | [hangingRepairTimeoutMins]({{< relref "reaper_specific.md#hangingrepairtimeoutmins" >}}) | 30
<code class="codeLarge">REAPER_INCREMENTAL_REPAIR</code> | [incrementalRepair]({{< relref "reaper_specific.md#incrementalrepair" >}}) | false
<code class="codeLarge">REAPER_SUBRANGE_INCREMENTAL</code> | [subrangeIncrementalRepair]({{< relref "reaper_specific.md#subrangeincremental" >}}) | false
<code class="codeLarge">REAPER_JMX_AUTH_PASSWORD</code> | [password]({{< relref "reaper_specific.md#password" >}}) |
<code class="codeLarge">REAPER_JMX_AUTH_USERNAME</code> | [username]({{< relref "reaper_specific.md#username" >}}) |
<code class="codeLarge">REAPER_JMX_CREDENTIALS</code> | [jmxCredentials]({{< relref "reaper_specific.md#jmxcredentials" >}}) |
Expand Down
15 changes: 15 additions & 0 deletions src/docs/content/docs/configuration/reaper_specific.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@ Sets the default repair type unless specifically defined for each run. Note that

<br/>

### `subrangeIncrementalRepair`

Type: *Boolean*

Default: *false*

Sets the default repair type unless specifically defined for each run. Note that this is only supported with the PARALLEL repairParallelism setting. For more details in incremental repair, please refer to the following article.http://www.datastax.com/dev/blog/more-efficient-repairs.
This mode will split the repair jobs into sets of token ranges using the incremental mode.
This will prevail over the `incrementalRepair` setting.


*Note*: Subrange incremental repair is only available since Cassandra 4.0.

<br/>

### `blacklistTwcsTables`

Type: *Boolean*
Expand Down
7 changes: 7 additions & 0 deletions src/packaging/bin/spreaper
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ def _arguments_for_repair_and_schedule(parser):
parser.add_argument("--incremental", default="false",
help=("Incremental repair (true or false), "
"or use the configured default if not given (false)"))
parser.add_argument("--subrange-incremental", default="false",
help=("Subrange incremental repair (true or false), "
"or use the configured default if not given (false)"))
parser.add_argument("--datacenters", default=None,
help=("a comma separated list of datacenters to repair (do not use spaces after commas). "
"Cannot be used in conjunction with --nodes."))
Expand Down Expand Up @@ -734,6 +737,7 @@ class ReaperCLI(object):
repairParallelism=args.repair_parallelism,
intensity=args.intensity,
incrementalRepair=args.incremental,
subrangeIncrementalRepair=args.subrange_incremental,
nodes=args.nodes,
datacenters=args.datacenters,
blacklistedTables=args.blacklisted_tables,
Expand All @@ -755,6 +759,7 @@ class ReaperCLI(object):
repairParallelism=args.repair_parallelism,
intensity=args.intensity,
incrementalRepair=args.incremental,
subrangeIncrementalRepair=args.subrange_incremental,
nodes=args.nodes,
datacenters=args.datacenters,
blacklistedTables=args.blacklisted_tables,
Expand Down Expand Up @@ -797,6 +802,7 @@ class ReaperCLI(object):
scheduleDaysBetween=args.schedule_days_between,
scheduleTriggerTime=args.schedule_trigger_time,
incrementalRepair=args.incremental,
subrangeIncrementalRepair=args.subrange_incremental,
nodes=args.nodes,
datacenters=args.datacenters,
blacklistedTables=args.blacklisted_tables,
Expand All @@ -818,6 +824,7 @@ class ReaperCLI(object):
scheduleDaysBetween=args.schedule_days_between,
scheduleTriggerTime=args.schedule_trigger_time,
incrementalRepair=args.incremental,
subrangeIncrementalRepair=args.subrange_incremental,
nodes=args.nodes,
datacenters=args.datacenters,
blacklistedTables=args.blacklisted_tables,
Expand Down
1 change: 1 addition & 0 deletions src/packaging/docker-services/reaper/reaper.env
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ REAPER_REPAIR_RUN_THREADS=32
REAPER_HANGING_REPAIR_TIMEOUT_MINS=90
REAPER_ENABLE_CROSS_ORIGIN=true
REAPER_INCREMENTAL_REPAIR=true
REAPER_SUBRANGE_INCREMENTAL=false
REAPER_BLACKLIST_TWCS=true
REAPER_ENABLE_DYNAMIC_SEED_LIST=false
REAPER_REPAIR_MANAGER_SCHEDULING_INTERVAL_SECONDS=10
Expand Down
38 changes: 9 additions & 29 deletions src/server/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,11 @@
limitations under the License.
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!--
- Modified from Google Java Style
https://google-styleguide.googlecode.com/svn-history/r130/trunk/javaguide.html
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
Most Checks are configurable, be sure to consult the documentation.
To completely disable a check, just comment it out or delete it from the file.
-->

<module name = "Checker">
<module name="SuppressWarningsFilter"/>
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name = "RootModule">
<property name="charset" value="UTF-8"/>

<property name="fileExtensions" value="java, properties, xml"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
Expand All @@ -48,9 +29,12 @@
<property name="multiLines" value="2"/>
</module>

<module name="TreeWalker">
<module name="SuppressWarningsHolder"/>
<module name="LineLength">
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>

<module name="TreeWalker">
<module name="SuppressWarnings">
<property name="id" value="checkstyle:suppresswarnings"/>
</module>
Expand All @@ -70,10 +54,6 @@
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="Regexp">
<property name="format" value="[ \t]+$"/>
<property name="illegalPattern" value="true"/>
Expand Down Expand Up @@ -234,6 +214,6 @@
<module name="FinalClass"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${checkstyle.suppressions.file}"/>
<property name="file" value="${checkstyle.suppressions.file}"/>
</module>
</module>
10 changes: 4 additions & 6 deletions src/server/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ENV REAPER_SEGMENT_COUNT_PER_NODE=64 \
REAPER_STORAGE_TYPE=memory \
REAPER_ENABLE_CROSS_ORIGIN=true \
REAPER_INCREMENTAL_REPAIR=false \
REAPER_SUBRANGE_INCREMENTAL=false \
REAPER_BLACKLIST_TWCS=false \
REAPER_ENABLE_DYNAMIC_SEED_LIST=true \
REAPER_REPAIR_MANAGER_SCHEDULING_INTERVAL_SECONDS=30 \
Expand Down Expand Up @@ -106,15 +107,10 @@ ADD ${SHADED_JAR} /usr/local/lib/cassandra-reaper.jar
ADD src/packaging/bin/spreaper /usr/local/bin/spreaper


# get around `/usr/local/bin/configure-persistence.sh: line 65: can't create /etc/cassandra-reaper/cassandra-reaper.yml: Interrupted system call` unknown error
RUN touch /etc/cassandra-reaper/cassandra-reaper.yml
# get around `/usr/local/bin/configure-webui-authentication.sh: line 44: can't `create` /etc/cassandra-reaper/shiro.ini: Interrupted system call` unknown error
RUN touch /etc/cassandra-reaper/shiro.ini


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 /etc/cassandra-reaper/config && \
mkdir -p /var/log/cassandra-reaper && \
mkdir -p ${REAPER_TMP_DIRECTORY} && \
chown reaper:reaper \
Expand All @@ -131,6 +127,7 @@ RUN addgroup -g 1001 -S reaper && adduser -G reaper -S -u 1001 reaper && \
chown -R reaper:reaper \
/var/lib/cassandra-reaper \
/etc/cassandra-reaper/shiro \
/etc/cassandra-reaper/config \
/var/log/cassandra-reaper && \
chmod +x \
/usr/local/bin/entrypoint.sh \
Expand All @@ -142,6 +139,7 @@ RUN addgroup -g 1001 -S reaper && adduser -G reaper -S -u 1001 reaper && \

VOLUME /var/lib/cassandra-reaper
VOLUME /etc/cassandra-reaper/shiro
VOLUME /etc/cassandra-reaper/config

USER reaper

Expand Down
1 change: 1 addition & 0 deletions src/server/src/main/docker/cassandra-reaper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ hangingRepairTimeoutMins: ${REAPER_HANGING_REPAIR_TIMEOUT_MINS}
storageType: ${REAPER_STORAGE_TYPE}
enableCrossOrigin: ${REAPER_ENABLE_CROSS_ORIGIN}
incrementalRepair: ${REAPER_INCREMENTAL_REPAIR}
subrangeIncrementalRepair: ${REAPER_SUBRANGE_INCREMENTAL}
blacklistTwcsTables: ${REAPER_BLACKLIST_TWCS}
enableDynamicSeedList: ${REAPER_ENABLE_DYNAMIC_SEED_LIST}
repairManagerSchedulingIntervalSeconds: ${REAPER_REPAIR_MANAGER_SCHEDULING_INTERVAL_SECONDS}
Expand Down
8 changes: 4 additions & 4 deletions src/server/src/main/docker/configure-jmx-credentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# we expect the jmx credentials to be a comma-separated list of 'user:password@cluster' entries
if [ ! -z "${REAPER_JMX_CREDENTIALS}" ]; then

cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
jmxCredentials:
EOT

Expand All @@ -29,7 +29,7 @@ EOT
PASSWORD=$(echo "${ENTRY}" | cut -d'@' -f1 | cut -d':' -f2 | sed 's/"/\\"/g')

# finally, write out the YAML entries
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
${CLUSTER}:
username: "${USERNAME}"
password: "${PASSWORD}"
Expand All @@ -41,7 +41,7 @@ fi


if [ ! -z "${REAPER_JMX_AUTH_USERNAME}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
jmxAuth:
username: "$(echo "${REAPER_JMX_AUTH_USERNAME}" | sed 's/"/\\"/g')"
password: "$(echo "${REAPER_JMX_AUTH_PASSWORD}" | sed 's/"/\\"/g')"
Expand All @@ -50,7 +50,7 @@ EOT
fi

if [ ! -z "${CRYPTO_SYSTEM_PROPERTY_SECRET}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
cryptograph:
type: symmetric
systemPropertySecret: ${CRYPTO_SYSTEM_PROPERTY_SECRET}
Expand Down
2 changes: 1 addition & 1 deletion src/server/src/main/docker/configure-metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.

if [ "true" = "${REAPER_METRICS_ENABLED}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
metrics:
frequency: ${REAPER_METRICS_FREQUENCY}
reporters: ${REAPER_METRICS_REPORTERS}
Expand Down
20 changes: 10 additions & 10 deletions src/server/src/main/docker/configure-persistence.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@

# Add specific jmxAddressTranslator
if [ ! -z "${JMX_ADDRESS_TRANSLATOR_TYPE}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
jmxAddressTranslator:
type: ${JMX_ADDRESS_TRANSLATOR_TYPE}
EOT
fi

if [ "multiIpPerNode" = "${JMX_ADDRESS_TRANSLATOR_TYPE}" ] && [ -n "$JMX_ADDRESS_TRANSLATOR_MAPPING" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
ipTranslations:
EOT
IFS=',' read -ra mappings <<< "$JMX_ADDRESS_TRANSLATOR_MAPPING"
for mapping in "${mappings[@]}"; do
IFS=':' read -ra mapping <<< "$mapping"
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
- from: "${mapping[0]}"
to: "${mapping[1]}"
EOT
Expand All @@ -40,7 +40,7 @@ case ${REAPER_STORAGE_TYPE} in
"cassandra")

# BEGIN cassandra persistence options
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
activateQueryLogger: ${REAPER_CASS_ACTIVATE_QUERY_LOGGER}
cassandra:
Expand All @@ -59,7 +59,7 @@ cassandra:
EOT

if [ "true" = "${REAPER_CASS_AUTH_ENABLED}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
authProvider:
type: plainText
username: "$(echo "${REAPER_CASS_AUTH_USERNAME}" | sed 's/"/\\"/g')"
Expand All @@ -68,27 +68,27 @@ EOT
fi

if [ "true" = "${REAPER_CASS_NATIVE_PROTOCOL_SSL_ENCRYPTION_ENABLED}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
ssl:
type: jdk
EOT
fi

if [ "true" = "${REAPER_CASS_ADDRESS_TRANSLATOR_ENABLED}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
addressTranslator:
type: ${REAPER_CASS_ADDRESS_TRANSLATOR_TYPE}
EOT
fi

if [ "multiIpPerNode" = "${REAPER_CASS_ADDRESS_TRANSLATOR_TYPE}" ] && [ -n "$REAPER_CASS_ADDRESS_TRANSLATOR_MAPPING" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
ipTranslations:
EOT
IFS=',' read -ra mappings <<< "$REAPER_CASS_ADDRESS_TRANSLATOR_MAPPING"
for mapping in "${mappings[@]}"; do
IFS=':' read -ra mapping <<< "$mapping"
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
- from: "${mapping[0]}"
to: "${mapping[1]}"
EOT
Expand All @@ -100,7 +100,7 @@ fi
;;
"memory")
# BEGIN cassandra persistence options
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
persistenceStoragePath: ${REAPER_MEMORY_STORAGE_DIRECTORY}
EOT
Expand Down
10 changes: 5 additions & 5 deletions src/server/src/main/docker/configure-webui-authentication.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ if [ "false" = "${REAPER_AUTH_ENABLED}" ]; then
fi

if [ ! -z "${REAPER_SHIRO_INI}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
accessControl:
sessionTimeout: PT10M
shiro:
iniConfigs: ["file:${REAPER_SHIRO_INI}"]
EOT
elif [ ! -z "${REAPER_AUTH_USER}" ]; then
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
accessControl:
sessionTimeout: PT10M
shiro:
iniConfigs: ["file:/etc/cassandra-reaper/shiro.ini"]
iniConfigs: ["file:/etc/cassandra-reaper/config/shiro.ini"]
EOT
else
cat <<EOT >> /etc/cassandra-reaper/cassandra-reaper.yml
cat <<EOT >> /etc/cassandra-reaper/config/cassandra-reaper.yml
accessControl:
sessionTimeout: PT10M
shiro:
Expand All @@ -41,7 +41,7 @@ EOT
fi

if [ ! -z "${REAPER_AUTH_USER}" ]; then
cat <<EOT2 >> /etc/cassandra-reaper/shiro.ini
cat <<EOT2 >> /etc/cassandra-reaper/config/shiro.ini
${REAPER_AUTH_USER} = ${REAPER_AUTH_PASSWORD}, operator
EOT2
fi
Loading

0 comments on commit 4952ea5

Please sign in to comment.