-
Notifications
You must be signed in to change notification settings - Fork 217
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 1 commit
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,54 @@ | ||
FROM openjdk:8-jre-alpine | ||
|
||
ARG SHADED_JAR | ||
|
||
ENV DW_REAPER_SEGMENT_COUNT=200 \ | ||
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. Why the 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. So, that was just for "Dropwizard" but since the application is effectively REAPER we could just drop the prefix as that is likely clearer. |
||
DW_REAPER_REPAIR_PARALELLISM=DATACENTER_AWARE \ | ||
DW_REAPER_REPAIR_INTENSITY=0.9 \ | ||
DW_REAPER_SCHEDULE_DAYS_BETWEEN=7 \ | ||
DW_REAPER_REPAIR_RUN_THREADS=15 \ | ||
DW_REAPER_HANING_REPAIR_TIMEOUT_MINS=30 \ | ||
DW_REAPER_STORAGE_TYPE=memory \ | ||
DW_REAPER_ENABLE_CORS=true \ | ||
DW_REAPER_INCREMENTAL_REPAIR=false \ | ||
DW_REAPER_ALLOW_UNREACHABLE_NODES=false \ | ||
DW_REAPER_ENABLE_DYNAMIC_SEEDS=true \ | ||
DW_REAPER_AUTO_SCHEDULE_ENABLED=false \ | ||
DW_REAPER_AUTO_SCHEDULE_INITIAL_DELAY_PERIOD=PT15S \ | ||
DW_REAPER_AUTO_SCHEDULE_PERIOD_BETWEEN_POLLS=PT10M \ | ||
DW_REAPER_AUTO_SCHEDULE_TIME_BETWEEN_FIRST_SCHEDULE=PT5M \ | ||
DW_REAPER_AUTO_SCHEDULE_TIME_BETWEEN_FIRST_SCHEDULE=PT6H \ | ||
DW_REAPER_AUTO_SCHEDULE_EXCLUDED_KEYSPACES="[]" \ | ||
DW_REAPER_JMX_PORTS="{}" \ | ||
DW_REAPER_LOGGING_ROOT_LEVEL=INFO \ | ||
DW_REAPER_LOGGERS="{}" \ | ||
DW_REAPER_LOGGING_FORMAT='"%-6level [%d] [%t] %logger{5} - %msg %n"' \ | ||
DW_REAPER_APP_PORT=8080 \ | ||
DW_REAPER_APP_BIND_HOST="0.0.0.0" \ | ||
DW_REAPER_ADMIN_PORT=8081 \ | ||
DW_REAPER_ADMIN_BIND_HOST="0.0.0.0" \ | ||
DW_REAPER_CASS_CLUSTER_NAME="clutername" \ | ||
DW_REAPER_CASS_CONTACT_POINTS="[]" \ | ||
DW_REAPER_CASS_KEYSPACE="cassandra-reaper" \ | ||
DW_REAPER_CASS_AUTH_ENABLED="false" \ | ||
DW_REAPER_CASS_AUTH_USERNAME="cassandra" \ | ||
DW_REAPER_CASS_AUTH_PASSWORD="cassandra" \ | ||
DW_REAPER_DB_DRIVER_CLASS="org.h2.Driver" \ | ||
DW_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 /root/cassandra-reaper.yml | ||
ADD entrypoint.sh /root/entrypoint.sh | ||
ADD append-persistence.sh /root/append-persistence.sh | ||
RUN mkdir -p /var/lib/cassandra-reaper/data && \ | ||
chmod u+x /root/entrypoint.sh && \ | ||
chmod u+x /root/append-persistence.sh | ||
|
||
VOLUME /var/lib/cassandra-reaper/data | ||
|
||
ADD ${SHADED_JAR} /root/cassandra-reaper.jar | ||
|
||
ENTRYPOINT ["/root/entrypoint.sh"] | ||
CMD ["cassandra-reaper"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
case ${DW_REAPER_STORAGE_TYPE} in | ||
"cassandra") | ||
cat <<EOT >> /root/cassandra-reaper.yml | ||
cassandra: | ||
clusterName: ${DW_REAPER_CASS_CLUSTER_NAME} | ||
contactPoints: ${DW_REAPER_CASS_CONTACT_POINTS} | ||
keyspace: ${DW_REAPER_CASS_KEYSPACE} | ||
EOT | ||
|
||
if [ "true" = "${DW_REAPER_CASS_AUTH_ENABLED}" ]; then | ||
cat <<EOT >> /root/cassandra-reaper.yml | ||
authProvider: | ||
type: plainText | ||
username: ${DW_REAPER_CASS_AUTH_USERNAME} | ||
password: ${DW_REAPER_CASS_AUTH_PASSWORD} | ||
EOT | ||
fi | ||
;; | ||
"database") | ||
cat <<EOT >> /root/cassandra-reaper.yml | ||
database: | ||
driverClass: ${DW_REAPER_DB_DRIVER_CLASS} | ||
url: ${DW_REAPER_DB_URL} | ||
user: ${DW_REAPER_DB_USERNAME} | ||
password: ${DW_REAPER_DB_PASSWORD} | ||
EOT | ||
|
||
esac |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
segmentCount: ${DW_REAPER_SEGMENT_COUNT} | ||
repairParallelism: ${DW_REAPER_REPAIR_PARALELLISM} | ||
repairIntensity: ${DW_REAPER_REPAIR_INTENSITY} | ||
scheduleDaysBetween: ${DW_REAPER_SCHEDULE_DAYS_BETWEEN} | ||
repairRunThreadCount: ${DW_REAPER_REPAIR_RUN_THREADS} | ||
hangingRepairTimeoutMins: ${DW_REAPER_HANING_REPAIR_TIMEOUT_MINS} | ||
storageType: ${DW_REAPER_STORAGE_TYPE} | ||
enableCrossOrigin: ${DW_REAPER_ENABLE_CORS} | ||
incrementalRepair: ${DW_REAPER_INCREMENTAL_REPAIR} | ||
allowUnreachableNodes: ${DW_REAPER_ALLOW_UNREACHABLE_NODES} | ||
enableDynamicSeedList: ${DW_REAPER_ENABLE_DYNAMIC_SEEDS} | ||
|
||
autoScheduling: | ||
enabled: ${DW_REAPER_AUTO_SCHEDULE_ENABLED} | ||
initialDelayPeriod: ${DW_REAPER_AUTO_SCHEDULE_INITIAL_DELAY_PERIOD} | ||
periodBetweenPolls: ${DW_REAPER_AUTO_SCHEDULE_PERIOD_BETWEEN_POLLS} | ||
timeBeforeFirstSchedule: ${DW_REAPER_AUTO_SCHEDULE_TIME_BETWEEN_FIRST_SCHEDULE} | ||
scheduleSpreadPeriod: ${DW_REAPER_AUTO_SCHEDULE_TIME_BETWEEN_FIRST_SCHEDULE} | ||
excludedKeyspaces: ${DW_REAPER_AUTO_SCHEDULE_EXCLUDED_KEYSPACES} | ||
|
||
jmxPorts: ${DW_REAPER_JMX_PORTS} | ||
|
||
logging: | ||
level: ${DW_REAPER_LOGGING_ROOT_LEVEL} | ||
loggers: ${DW_REAPER_LOGGERS} | ||
appenders: | ||
- type: console | ||
logFormat: ${DW_REAPER_LOGGING_FORMAT} | ||
|
||
server: | ||
type: default | ||
applicationConnectors: | ||
- type: http | ||
port: ${DW_REAPER_APP_PORT} | ||
bindHost: ${DW_REAPER_APP_BIND_HOST} | ||
adminConnectors: | ||
- type: http | ||
port: ${DW_REAPER_ADMIN_PORT} | ||
bindHost: ${DW_REAPER_ADMIN_BIND_HOST} | ||
requestLog: | ||
appenders: [] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
if [ "$1" = 'cassandra-reaper' ]; then | ||
/root/append-persistence.sh | ||
exec java -jar ${JAVA_OPTS} /root/cassandra-reaper.jar server /root/cassandra-reaper.yml | ||
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. Using 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. Agreed. I can do it as part of this pull request and refactor to remove the DW_ |
||
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! :)