Skip to content

Commit be745f6

Browse files
committed
Updates to Docker packaging to fix structure and flexibility
- Updated main POM file properties to include docker build directory - Added new service to ./packaging/docker-compose.yml file which extends the services in the ./packaging/docker-build/docker-compose.yml. This allows packages to be built using the commands: 'docker-compose build reaper-build-packages && docker-compose run reaper-build-packages' - Renamed ./packaging/docker to ./packaging/docker-services to better reflect the directory contents and to separate it from the ./packaging/docker-build directory - Updated site documentation to match new structure
1 parent 536ddc6 commit be745f6

File tree

11 files changed

+75
-39
lines changed

11 files changed

+75
-39
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ src/ui/node_modules
2828
src/ui/package-lock.json
2929

3030
# Docker Compose persistent storage directory
31-
src/packaging/docker
31+
src/packaging/data

src/docs/content/docs.md

+57-27
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
See the [download](/download/) section for information on how to download and install reaper.
66

7-
87
## Community
98

10-
We have a [Mailing List](https://groups.google.com/forum/#!forum/tlp-apache-cassandra-reaper-users) and [Gitter chat](https://gitter.im/thelastpickle/cassandra-reaper) available.
11-
9+
We have a [Mailing List](https://groups.google.com/forum/#!forum/tlp-apache-cassandra-reaper-users) and [Gitter chat](https://gitter.im/thelastpickle/cassandra-reaper) available.
1210

1311
## Configuration
1412

@@ -358,41 +356,65 @@ Source code for all the REST resources can be found from package com.spotify.rea
358356
Delete all the related repair runs before calling this endpoint.
359357
360358
361-
## Running through Docker
359+
## Docker
360+
361+
[Docker](https://docs.docker.com/engine/installation/) and [Docker Compose](https://docs.docker.com/compose/install/) will need to be installed in order to use the commands in this section.
362+
363+
### Building Reaper Packages with Docker
364+
365+
Building Reaper packages requires quite a few dependencies, especially when making changes to the web interface code. In an effort to simplify the build process, Dockerfiles have been created that implement the build actions required to package Reaper.
362366
367+
To build the JAR and other packages which are then placed in the _packages_ directory run the following commands from the top level directory:
363368
364-
### Build Reaper Docker Image
369+
```bash
370+
cd src/packaging
371+
docker-compose build reaper-build-packages && docker-compose run reaper-build-packages
372+
```
373+
374+
### Building Reaper Docker Image
365375

366-
First, build the Docker image and add it to your local image cache using the
367-
`cassandra-reaper:latest` tag:
376+
To build the Reaper Docker Image which is then added to the local image cache using the `cassandra-reaper:latest` tag, run the following commands from the top level directory:
368377

369-
```mvn clean package docker:build```
378+
```bash
379+
cd src/server
380+
mvn package docker:build
381+
```
382+
383+
Note that the above command will build the Reaper JAR and place it in the _src/server/target_ directory prior to creating the Docker Image. It is also possible to build the JAR file using the [Docker package build](building-reaper-packages-with-docker) instructions and omitting the `package` command from the above Maven commands.
370384

371385
### Start Docker Environment
372386

373-
First, start the Cassandra cluster:
387+
From the top level directory change to the _src/packaging_ directory
388+
389+
```bash
390+
cd src/packaging
391+
```
374392

375-
```docker-compose up cassandra```
393+
Start the Cassandra cluster:
376394

377-
You can use the `nodetool` Docker Compose service to check on the Cassandra
378-
node's status:
395+
```bash
396+
docker-compose up cassandra
397+
```
379398

380-
```docker-compose run nodetool status```
399+
The `nodetool` Docker Compose service can be used to check on the Cassandra node's status:
381400

382-
Once the Cassandra node is online and accepting CQL connections,
383-
create the required `reaper_db` Cassandra keyspace to allow Reaper to save
384-
its cluster and scheduling data.
401+
```bash
402+
docker-compose run nodetool status
403+
```
385404

386-
By default, the `reaper_db` keyspace is created using a replication factor
387-
of 1. To change this replication factor, provide the intended replication
388-
factor as an optional argument:
405+
Once the Cassandra node is online and accepting CQL connections, create the required `reaper_db` Cassandra keyspace to allow Reaper to save its cluster and scheduling data.
389406

390-
```docker-compose run initialize-reaper_db [$REPLICATION_FACTOR]```
407+
By default, the `reaper_db` keyspace is created using a replication factor of 1. To change this replication factor, provide the intended replication factor as an optional argument:
408+
409+
```bash
410+
docker-compose run initialize-reaper_db [$REPLICATION_FACTOR]
411+
```
391412

392-
Wait a few moments for the `reaper_db` schema change to propagate,
393-
then start Reaper:
413+
Wait a few moments for the `reaper_db` schema change to propagate, then start Reaper:
394414

395-
```docker-compose up reaper```
415+
```bash
416+
docker-compose up reaper
417+
```
396418

397419

398420
### Access The Environment
@@ -403,19 +425,27 @@ http://127.0.0.1:8080/webui/
403425

404426
When adding the Cassandra node to the Reaper UI, use the IP address found via:
405427

406-
```docker-compose run nodetool status```
428+
```bash
429+
docker-compose run nodetool status
430+
```
407431

408432
The helper `cqlsh` Docker Compose service has also been included:
409433

410-
```docker-compose run cqlsh```
434+
```bash
435+
docker-compose run cqlsh
436+
```
411437

412438
### Destroying the Docker Environment
413439

414440
When terminating the infrastructure, use the following command to stop
415441
all related Docker Compose services:
416442

417-
```docker-compose down```
443+
```bash
444+
docker-compose down
445+
```
418446

419447
To completely clean up all persistent data, delete the `./data/` directory:
420448

421-
```rm -rf ./data/```
449+
```bash
450+
rm -rf ./data/
451+
```

src/packaging/docker-compose.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
version: '2.2'
1+
version: '2.1'
22

33
services:
44
cassandra:
55
image: cassandra:3.11
66
env_file:
7-
- docker/cassandra/cassandra.env
7+
- ./docker-services/cassandra/cassandra.env
88
mem_limit: 4g
99
memswap_limit: 4g
1010
mem_swappiness: 0
@@ -15,32 +15,37 @@ services:
1515
- "9042:9042"
1616
volumes:
1717
- ./data/cassandra:/var/lib/cassandra
18-
- ./docker/cassandra/jmxremote.access:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/management/jmxremote.access
19-
- ./docker/cassandra/jmxremote.password:/etc/cassandra/jmxremote.password
18+
- ./docker-services/cassandra/jmxremote.access:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/management/jmxremote.access
19+
- ./docker-services/cassandra/jmxremote.password:/etc/cassandra/jmxremote.password
2020

2121
cqlsh:
2222
image: cassandra:3.11
2323
command: cqlsh cassandra
2424
links:
2525
- cassandra
2626

27-
nodetool:
28-
image: cassandra:3.11
29-
entrypoint: nodetool --host cassandra --username reaperUser --password reaperPass
27+
initialize-reaper_db:
28+
build: ./docker-services/initialize-reaper_db
3029
links:
3130
- cassandra
3231

33-
initialize-reaper_db:
34-
build: ./docker/initialize-reaper_db
32+
nodetool:
33+
image: cassandra:3.11
34+
entrypoint: nodetool --host cassandra --username reaperUser --password reaperPass
3535
links:
3636
- cassandra
3737

3838
reaper:
3939
image: cassandra-reaper:latest
4040
env_file:
41-
- docker/reaper/reaper.env
41+
- ./docker-services/reaper/reaper.env
4242
links:
4343
- cassandra
4444
ports:
4545
- "8080:8080"
4646
- "8081:8081"
47+
48+
reaper-build-packages:
49+
extends:
50+
file: ./docker-build/docker-compose.yml
51+
service: build

src/server/pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<dropwizard.metrics.datadog.version>1.0.6</dropwizard.metrics.datadog.version>
1717
<cassandra.version>2.2.7</cassandra.version>
1818
<cucumber.version>1.2.5</cucumber.version>
19+
<docker.directory>src/main/docker</docker.directory>
1920
</properties>
2021

2122
<dependencies>
@@ -292,7 +293,7 @@
292293
<version>1.0.0</version>
293294
<configuration>
294295
<imageName>cassandra-reaper</imageName>
295-
<dockerDirectory>src/main/docker</dockerDirectory>
296+
<dockerDirectory>${docker.directory}</dockerDirectory>
296297
<buildArgs>
297298
<SHADED_JAR>cassandra-reaper-${project.version}.jar</SHADED_JAR>
298299
</buildArgs>

0 commit comments

Comments
 (0)