-
Notifications
You must be signed in to change notification settings - Fork 218
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
Adding support to build cassandra-reaper docker images #76
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
FROM openjdk:8-jre-alpine | ||
|
||
ARG SHADED_JAR | ||
|
||
ENV REAPER_SEGMENT_COUNT=200 \ | ||
REAPER_REPAIR_PARALELLISM=DATACENTER_AWARE \ | ||
REAPER_REPAIR_INTENSITY=0.9 \ | ||
REAPER_SCHEDULE_DAYS_BETWEEN=7 \ | ||
REAPER_REPAIR_RUN_THREADS=15 \ | ||
REAPER_HANING_REPAIR_TIMEOUT_MINS=30 \ | ||
REAPER_STORAGE_TYPE=memory \ | ||
REAPER_ENABLE_CORS=true \ | ||
REAPER_INCREMENTAL_REPAIR=false \ | ||
REAPER_ALLOW_UNREACHABLE_NODES=false \ | ||
REAPER_ENABLE_DYNAMIC_SEEDS=true \ | ||
REAPER_AUTO_SCHEDULE_ENABLED=false \ | ||
REAPER_AUTO_SCHEDULE_INITIAL_DELAY_PERIOD=PT15S \ | ||
REAPER_AUTO_SCHEDULE_PERIOD_BETWEEN_POLLS=PT10M \ | ||
REAPER_AUTO_SCHEDULE_TIME_BETWEEN_FIRST_SCHEDULE=PT5M \ | ||
REAPER_AUTO_SCHEDULE_TIME_BETWEEN_FIRST_SCHEDULE=PT6H \ | ||
REAPER_AUTO_SCHEDULE_EXCLUDED_KEYSPACES="[]" \ | ||
REAPER_JMX_PORTS="{}" \ | ||
REAPER_LOGGING_ROOT_LEVEL=INFO \ | ||
REAPER_LOGGERS="{}" \ | ||
REAPER_LOGGING_FORMAT='"%-6level [%d] [%t] %logger{5} - %msg %n"' \ | ||
REAPER_APP_PORT=8080 \ | ||
REAPER_APP_BIND_HOST="0.0.0.0" \ | ||
REAPER_ADMIN_PORT=8081 \ | ||
REAPER_ADMIN_BIND_HOST="0.0.0.0" \ | ||
REAPER_CASS_CLUSTER_NAME="clutername" \ | ||
REAPER_CASS_CONTACT_POINTS="[]" \ | ||
REAPER_CASS_KEYSPACE="cassandra-reaper" \ | ||
REAPER_CASS_AUTH_ENABLED="false" \ | ||
REAPER_CASS_AUTH_USERNAME="cassandra" \ | ||
REAPER_CASS_AUTH_PASSWORD="cassandra" \ | ||
REAPER_DB_DRIVER_CLASS="org.h2.Driver" \ | ||
REAPER_DB_URL="jdbc:h2:/var/lib/cassandra-reaper/db;MODE=PostgreSQL" \ | ||
DB_REAPER_DB_USERNAME="" \ | ||
DB_REAPER_DB_PASSWORD="" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two envars were left as |
||
JAVA_OPTS="" | ||
|
||
ADD cassandra-reaper.yml /etc/cassandra-reaper.yml | ||
ADD entrypoint.sh /usr/local/bin/entrypoint.sh | ||
ADD append-persistence.sh /usr/local/bin/append-persistence.sh | ||
RUN addgroup -S reaper && \ | ||
adduser -S reaper reaper && \ | ||
apk add --no-cache 'su-exec>=0.2' && \ | ||
mkdir -p /var/lib/cassandra-reaper && \ | ||
chown reaper:reaper /etc/cassandra-reaper.yml && \ | ||
chown reaper:reaper /var/lib/cassandra-reaper && \ | ||
chown reaper:reaper /usr/local/bin/entrypoint.sh && \ | ||
chown reaper:reaper /usr/local/bin/append-persistence.sh && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could combine the above |
||
chmod u+x /usr/local/bin/entrypoint.sh && \ | ||
chmod u+x /usr/local/bin/append-persistence.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could combine the above |
||
|
||
VOLUME /var/lib/cassandra-reaper | ||
|
||
ADD ${SHADED_JAR} /usr/local/lib/cassandra-reaper.jar | ||
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
CMD ["cassandra-reaper"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
case ${REAPER_STORAGE_TYPE} in | ||
"cassandra") | ||
cat <<EOT >> /etc/cassandra-reaper.yml | ||
cassandra: | ||
clusterName: ${REAPER_CASS_CLUSTER_NAME} | ||
contactPoints: ${REAPER_CASS_CONTACT_POINTS} | ||
keyspace: ${REAPER_CASS_KEYSPACE} | ||
EOT | ||
|
||
if [ "true" = "${REAPER_CASS_AUTH_ENABLED}" ]; then | ||
cat <<EOT >> /etc/cassandra-reaper.yml | ||
authProvider: | ||
type: plainText | ||
username: ${REAPER_CASS_AUTH_USERNAME} | ||
password: ${REAPER_CASS_AUTH_PASSWORD} | ||
EOT | ||
fi | ||
;; | ||
"database") | ||
cat <<EOT >> /etc/cassandra-reaper.yml | ||
database: | ||
driverClass: ${REAPER_DB_DRIVER_CLASS} | ||
url: ${REAPER_DB_URL} | ||
user: ${REAPER_DB_USERNAME} | ||
password: ${REAPER_DB_PASSWORD} | ||
EOT | ||
|
||
esac |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
segmentCount: ${REAPER_SEGMENT_COUNT} | ||
repairParallelism: ${REAPER_REPAIR_PARALELLISM} | ||
repairIntensity: ${REAPER_REPAIR_INTENSITY} | ||
scheduleDaysBetween: ${REAPER_SCHEDULE_DAYS_BETWEEN} | ||
repairRunThreadCount: ${REAPER_REPAIR_RUN_THREADS} | ||
hangingRepairTimeoutMins: ${REAPER_HANING_REPAIR_TIMEOUT_MINS} | ||
storageType: ${REAPER_STORAGE_TYPE} | ||
enableCrossOrigin: ${REAPER_ENABLE_CORS} | ||
incrementalRepair: ${REAPER_INCREMENTAL_REPAIR} | ||
allowUnreachableNodes: ${REAPER_ALLOW_UNREACHABLE_NODES} | ||
enableDynamicSeedList: ${REAPER_ENABLE_DYNAMIC_SEEDS} | ||
|
||
autoScheduling: | ||
enabled: ${REAPER_AUTO_SCHEDULE_ENABLED} | ||
initialDelayPeriod: ${REAPER_AUTO_SCHEDULE_INITIAL_DELAY_PERIOD} | ||
periodBetweenPolls: ${REAPER_AUTO_SCHEDULE_PERIOD_BETWEEN_POLLS} | ||
timeBeforeFirstSchedule: ${REAPER_AUTO_SCHEDULE_TIME_BETWEEN_FIRST_SCHEDULE} | ||
scheduleSpreadPeriod: ${REAPER_AUTO_SCHEDULE_TIME_BETWEEN_FIRST_SCHEDULE} | ||
excludedKeyspaces: ${REAPER_AUTO_SCHEDULE_EXCLUDED_KEYSPACES} | ||
|
||
jmxPorts: ${REAPER_JMX_PORTS} | ||
|
||
logging: | ||
level: ${REAPER_LOGGING_ROOT_LEVEL} | ||
loggers: ${REAPER_LOGGERS} | ||
appenders: | ||
- type: console | ||
logFormat: ${REAPER_LOGGING_FORMAT} | ||
|
||
server: | ||
type: default | ||
applicationConnectors: | ||
- type: http | ||
port: ${REAPER_APP_PORT} | ||
bindHost: ${REAPER_APP_BIND_HOST} | ||
adminConnectors: | ||
- type: http | ||
port: ${REAPER_ADMIN_PORT} | ||
bindHost: ${REAPER_ADMIN_BIND_HOST} | ||
requestLog: | ||
appenders: [] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
if [ "$1" = 'cassandra-reaper' ]; then | ||
su-exec reaper /usr/local/bin/append-persistence.sh | ||
exec su-exec reaper java -jar ${JAVA_OPTS} \ | ||
/usr/local/lib/cassandra-reaper.jar server /etc/cassandra-reaper.yml | ||
fi | ||
|
||
exec "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
import javax.servlet.DispatcherType; | ||
import javax.servlet.FilterRegistration; | ||
|
||
import io.dropwizard.configuration.EnvironmentVariableSubstitutor; | ||
import io.dropwizard.configuration.SubstitutingSourceProvider; | ||
import org.apache.cassandra.repair.RepairParallelism; | ||
import org.eclipse.jetty.servlets.CrossOriginFilter; | ||
import org.flywaydb.core.Flyway; | ||
|
@@ -97,6 +99,11 @@ public String getName() { | |
public void initialize(Bootstrap<ReaperApplicationConfiguration> bootstrap) { | ||
bootstrap.addBundle(new AssetsBundle("/assets/", "/webui", "index.html")); | ||
bootstrap.getObjectMapper().registerModule(new JavaTimeModule()); | ||
|
||
// enable using environment variables in yml files | ||
final SubstitutingSourceProvider envSourceProvider = new SubstitutingSourceProvider( | ||
bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)); | ||
bootstrap.setConfigurationSourceProvider(envSourceProvider); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very nice configuration management extension! |
||
} | ||
|
||
@Override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm so glad you got this figured out! I couldn't, for the life of me, get this plugin to work correctly! :)