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

Attempt building debian, jar, and rpm packages using Dockerfiles #46

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
693cce9
Attempt building debian, jar, and rpm packages using Dockerfiles
joaquincasares Feb 1, 2017
02127cf
New changes to build debian packages and build locally, instead of fr…
joaquincasares Feb 2, 2017
29d6d73
git needed to pull bower packages. might also be needed for rhel and …
joaquincasares Feb 2, 2017
294ddbb
committed git package to wrong dockerfile
joaquincasares Feb 2, 2017
6cac1cd
Add instructions for retrieving the built jar. Make the docker/jar au…
joaquincasares Feb 2, 2017
2c087d6
Finish Cassandra-backed Docker example
joaquincasares Feb 3, 2017
bba357b
Documentation tweaks. Lock down docker images to tags.
joaquincasares Feb 3, 2017
16a33be
Add links to urls
joaquincasares Feb 3, 2017
2fc1b8e
Add down command
joaquincasares Feb 3, 2017
c17b8ca
Allow Docker to build rpm packages.
joaquincasares Feb 3, 2017
615cd81
Simpler run commands and inline comments
joaquincasares Feb 8, 2017
d11a122
Include jmxAuth key in sample yamls
joaquincasares Feb 8, 2017
ebf37c9
No longer use mounted volumes to simplify testing workflows
joaquincasares Feb 9, 2017
18f0df2
Remove the configuration to have Cassandra auto-restart
joaquincasares Feb 9, 2017
f03f1cb
Fix and simplify rpm building
joaquincasares Feb 9, 2017
398101e
Forgot to upload docker-entrypoint.sh
joaquincasares Feb 9, 2017
1c0406b
Simplify .deb creation
joaquincasares Feb 9, 2017
0d8f7c5
Cleaner jar building
joaquincasares Feb 9, 2017
7c026bf
Test docker-compose with new setup
joaquincasares Feb 10, 2017
6312bda
Confirm in-memory and cassandra-backend work as expected.
joaquincasares Feb 10, 2017
e571a21
Use 127.0.0.1 to contact cassandra by default
joaquincasares Feb 10, 2017
dc77d4c
Add ability to define Cassandra node from docker-compose.yml
joaquincasares Feb 10, 2017
e27ddb3
Phrasing
joaquincasares Feb 10, 2017
0ffaa7c
README updates
joaquincasares Feb 10, 2017
ab6b1fc
Don't bind to a specific jar version
joaquincasares Feb 10, 2017
9c057d9
Reorg Docker Readme and Dockerfiles
joaquincasares Feb 10, 2017
3d37f35
Remove debuild and consolidate build command
joaquincasares Feb 10, 2017
7e75c56
Documenaion cleanup and enhancement
joaquincasares Feb 10, 2017
4ebf674
Include production-ready container note
joaquincasares Feb 10, 2017
57c1030
Don't repeat the build process.
joaquincasares Feb 10, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,29 @@ After modifying the `resource/cassandra-reaper.yaml` config file, Reaper can be
Once started, the UI can be accessed through : `http://127.0.0.1:8080/webui/`

Reaper can also be accessed using the REST API exposed on port 8080, or using the command line tool `bin/spreaper`


Building and running Reaper using Docker
----------------------------------------

These commands will attempt to build the Debian, jar, and RPM packages:

docker build -t reaper-debian docker/debian
docker build -t reaper-jar docker/jar
docker build -t reaper-rhel docker/rhel

These commands need to be run to start a container from a built image:

docker run -ti reaper-debian
docker run -ti reaper-jar # experiencing an error with bower ESUDO
docker run -ti reaper-rhel

Once a container is running, we can copy the built file out of the container
and onto our local filesystem:

# copy Debian packages
docker cp `docker ps | grep reaper-debian | awk '{print $1}'`:/usr/src/app/packages/cassandra-reaper-cli_0.2.3-1_all.deb .
docker cp `docker ps | grep reaper-debian | awk '{print $1}'`:/usr/src/app/packages/cassandra-reaper_0.2.3-1_all.deb .

# copy RPM packages
docker cp `docker ps | grep reaper-rhel | awk '{print $1}'`:/usr/src/app/packages/reaper-0.3-1.x86_64.rpm .
32 changes: 32 additions & 0 deletions docker/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ubuntu

# use a common app path, copied from python-onbuild:latest
ENV WORKDIR /usr/src/app
RUN mkdir -p ${WORKDIR}
WORKDIR ${WORKDIR}

# install dependencies
RUN apt-get update \
&& apt-get install -y \
apt-file \
debhelper \
devscripts \
git \
maven \
openjdk-8-jdk \
&& mvn --version

# grab source
RUN git clone https://github.com/thelastpickle/cassandra-reaper
WORKDIR ${WORKDIR}/cassandra-reaper

# target directory for final build
RUN mkdir ${WORKDIR}/packages

# -d is required to avoid:
# dpkg-checkbuilddeps: error: Unmet build dependencies: java7-jdk
RUN debuild -uc -us -b -d \
&& cp ${WORKDIR}/*.deb ${WORKDIR}/packages

# change the WORKDIR to the directory that only includes the built packages
WORKDIR ${WORKDIR}/packages
55 changes: 55 additions & 0 deletions docker/jar/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM ubuntu

# use a common app path, copied from python-onbuild:latest
ENV WORKDIR /usr/src/app
RUN mkdir -p ${WORKDIR}
WORKDIR ${WORKDIR}

# install dependencies
RUN apt-get update \
&& apt-get install -y \
curl \
&& curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh \
&& bash nodesource_setup.sh \
&& apt-get update \
&& apt-get install -y \
build-essential \
git \
maven \
nodejs \
openjdk-8-jdk \
&& mvn --version \
&& npm install -g bower

# grab source
RUN git clone https://github.com/thelastpickle/cassandra-reaper
WORKDIR ${WORKDIR}/cassandra-reaper

# cache maven dependencies, useful during Dockerfile testing
RUN cp pom.xml /tmp
WORKDIR /tmp
RUN mvn package
WORKDIR ${WORKDIR}/cassandra-reaper

# target directory for final build
RUN mkdir ${WORKDIR}/packages

# build jar
# FAILS WITH:
# [INFO] --- exec-maven-plugin:1.5.0:exec (exec-bower-install) @ cassandra-reaper ---
# bower ESUDO Cannot be run with sudo
#
# Additional error details:
# Since bower is a user command, there is no need to execute it with superuser permissions.
# If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.
#
# http://www.joyent.com/blog/installing-node-and-npm
# https://gist.github.com/isaacs/579814
#
# You can however run a command with sudo using --allow-root option
# [ERROR] Command execution failed.
RUN mvn clean package \
&& mvn clean package -Pbuild-ui
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for that information! That's good to know the UI doesn't need to be recompiled each time.

Would you mind taking a look at the cause of the sudo issue? It'd be nice to have a streamlined way to have potential contributors make changes and recompile the UI without having to manage about the entire build process.


# change the WORKDIR to the directory that only includes the built packages
WORKDIR ${WORKDIR}/packages
50 changes: 50 additions & 0 deletions docker/rhel/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM amazonlinux

# use a common app path, copied from python-onbuild:latest
ENV WORKDIR /usr/src/app
RUN mkdir -p ${WORKDIR}
WORKDIR ${WORKDIR}

# install dependencies
RUN yum update \
&& yum install -y \
wget \
&& wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.rpm" \
&& yum localinstall -y jdk-8u60-linux-x64.rpm \
&& wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo \
&& sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo \
&& yum update \
&& yum install -y \
apache-maven \
gcc \
git \
make \
rpm-build \
ruby-devel \
which \
&& mvn --version \
&& gem install fpm

# grab source
RUN git clone https://github.com/thelastpickle/cassandra-reaper
WORKDIR ${WORKDIR}/cassandra-reaper

# cache maven dependencies, useful during Dockerfile testing
RUN cp pom.xml /tmp
WORKDIR /tmp
RUN mvn package
WORKDIR ${WORKDIR}/cassandra-reaper

# target directory for final build
RUN mkdir ${WORKDIR}/packages

# REQUIRED to build rpm packages
RUN git checkout v0.3.0

# build rpm
RUN mvn package \
&& make rpm \
&& cp *.rpm ${WORKDIR}/packages

# change the WORKDIR to the directory that only includes the built packages
WORKDIR ${WORKDIR}/packages