-
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
Conversation
- Including environment variable substitution functionality for application yml - Including spotify docker build dependency - Adding initial Dockerfile and supporting startup shell scripts
I just realized that #46 is perhaps a superset of some of the work I did here. @joaquincasares @adejanovski Do you think it might be worth combining some of the work between the 2 PRs? |
Oh nice! Thanks for getting that plugin to work! I seriously couldn't get it for the life of me! :) Yeah, merging the two would be great! My purpose was primarily around getting an environment together to simply build packages without mucking up my system. It seems your intent is geared towards an actual Docker use case, which is what was missing from my PR, hence why it's still pending. I hope to get back to these 2 PRs sometime this week, but feel free to merge them together if you get a chance to do so before I do and I can review that as well. Thanks again for your contribution! 👍 |
@joaquincasares I'm thinking perhaps we have 2 separate pull requests for this work. One that is building the cassandra-reaper image (this one). And another that utilizes docker for building the debian and rpm packages #46 . If you'd prefer to keep it as a single PR I can work on merging them tonight. |
@adejanovski Do you think we can go ahead and merge this? |
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.
Apologies for the extremely long delay! Alex was out for ~3 weeks for conferences and vacation and I was pretty busy for ~2 weeks in preparation for my own wedding.
I'm fine to merge this in today and I can work on my other Docker branch later. This is definitely the ideal path forward for a Docker-first sort of deployment model (I just couldn't figure out that Spotify plugin).
My other branch is more geared towards a build system for building Debian and RHEL packages as Chris noted, but no need to get both of these into a single PR.
Thanks again @chrislbs and major apologies for the delay!
@@ -266,6 +266,25 @@ | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<plugin> | |||
<groupId>com.spotify</groupId> | |||
<artifactId>docker-maven-plugin</artifactId> |
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! :)
src/main/docker/Dockerfile
Outdated
|
||
ARG SHADED_JAR | ||
|
||
ENV DW_REAPER_SEGMENT_COUNT=200 \ |
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.
Why the DW_
prefix?
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.
So, that was just for "Dropwizard" but since the application is effectively REAPER we could just drop the prefix as that is likely clearer.
// 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice configuration management extension!
src/main/docker/entrypoint.sh
Outdated
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Using gosu
might be most secure, but I can handle that at a later date.
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.
Agreed. I can do it as part of this pull request and refactor to remove the DW_
Once we get a documented answer for the @adejanovski depending on when the answer comes in, mind if I merge this branch tomorrow if you're already offline? |
@joaquincasares I used su-exec as it was an alpine base image and gosu seemed more cumbersome. Also, I removed the DW_ prefix from all the environment variables. |
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.
Thanks @chrislbs those changes look great.
I caught the DB_REAPER
issue and the other two are strictly nitpicks.
I forgot that @adejanovski would be out at a client on-site this week. Once the next patch comes in, I'll just merge it in myself.
I also hadn't realized you were based out of Houston. Let me know if you're ever in Austin and want to grab some drinks and/or present at the Austin Cassandra User Group!
Perhaps you could do a presentation on Reaper. hint hint :)
src/main/docker/Dockerfile
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
These two envars were left as DB_REAPER
, while append-persistence.sh
was correctly updated.
src/main/docker/Dockerfile
Outdated
chown reaper:reaper /usr/local/bin/entrypoint.sh && \ | ||
chown reaper:reaper /usr/local/bin/append-persistence.sh && \ | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
We could combine the above chmod
commands.
src/main/docker/Dockerfile
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
We could combine the above chown
commands.
I might just take you up on that invitation @joaquincasares . Thanks for the feedback and the great tool. |
Thanks for the additional commit and yes, any time you're in Austin. :) I only help with the Docker stuff. The Spotify team, other forks, @adejanovski , and @rustyrazorblade are more to blame for this repo of awesomeness. :D Thanks again! |
Resolves #75
Including environment variable substitution functionality for
application yml
Including spotify docker build dependency
Adding initial Dockerfile and supporting startup shell scripts
There are some additional changes I can do but I wanted to get some feedback first. Some ideas that I can include in this or future pull requests.