Skip to content
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

Merged
merged 3 commits into from
May 3, 2017

Conversation

chrislbs
Copy link

@chrislbs chrislbs commented Apr 4, 2017

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.

  • Including a docker-compose.yml example that demonstrates multiple configurations
  • Update documentation to include all possible environment variable tweaks

- Including environment variable substitution functionality for
  application yml

- Including spotify docker build dependency

- Adding initial Dockerfile and supporting startup shell scripts
@chrislbs
Copy link
Author

chrislbs commented Apr 4, 2017

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?

@joaquincasares
Copy link
Contributor

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! 👍

@chrislbs
Copy link
Author

chrislbs commented Apr 4, 2017

@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.

@chrislbs
Copy link
Author

chrislbs commented May 2, 2017

@adejanovski Do you think we can go ahead and merge this?

Copy link
Contributor

@joaquincasares joaquincasares left a 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>
Copy link
Contributor

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! :)


ARG SHADED_JAR

ENV DW_REAPER_SEGMENT_COUNT=200 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the DW_ prefix?

Copy link
Author

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);
Copy link
Contributor

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!


if [ "$1" = 'cassandra-reaper' ]; then
/root/append-persistence.sh
exec java -jar ${JAVA_OPTS} /root/cassandra-reaper.jar server /root/cassandra-reaper.yml
Copy link
Contributor

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.

Copy link
Author

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_

@joaquincasares
Copy link
Contributor

Once we get a documented answer for the DW_ prefix, we're good to merge.

@adejanovski depending on when the answer comes in, mind if I merge this branch tomorrow if you're already offline?

@chrislbs
Copy link
Author

chrislbs commented May 3, 2017

@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.

Copy link
Contributor

@joaquincasares joaquincasares left a 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 :)

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="" \
Copy link
Contributor

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.

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
Copy link
Contributor

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.

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 && \
Copy link
Contributor

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.

@chrislbs
Copy link
Author

chrislbs commented May 3, 2017

I might just take you up on that invitation @joaquincasares . Thanks for the feedback and the great tool.

@joaquincasares joaquincasares merged commit fd3cf9c into thelastpickle:master May 3, 2017
@joaquincasares
Copy link
Contributor

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!

@joaquincasares
Copy link
Contributor

Hey @chrislbs , I just finished that old #46 PR by breaking it out into: #134, #135, and #136 . Thanks again for your Docker image build setup! It ran just perfectly with ease and using the ideal way to do so. (Unlike my hacky attempt within #46. :p)

Thanks again! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants