Skip to content

Commit

Permalink
Update for CASSANDRA-15299 protocol v5 changes
Browse files Browse the repository at this point in the history
* Update to Cassandra-beta4
* Run Cassandra/DSE as cassandra/dse user
* Remove shim projects
* Refactor agent project into server-specific projects
  • Loading branch information
emerkle826 committed Feb 5, 2021
1 parent 0cdeb65 commit 0608d0c
Show file tree
Hide file tree
Showing 81 changed files with 2,318 additions and 748 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/jar-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
mvn -q -ff package -DskipTests -P dse
- name: zip-up
run: |
zip jars.zip management-api-agent/target/datastax-mgmtapi-agent-*.jar management-api-server/target/datastax-mgmtapi-server-*.jar management-api-shim-4.x/target/datastax-mgmtapi-shim-4.x-*.jar management-api-shim-dse-6.8/target/datastax-mgmtapi-shim-dse-6.8-*.jar management-api-shim-3.x/target/datastax-mgmtapi-shim-3.x-*.jar management-api-common/target/datastax-mgmtapi-common-*.jar
zip jars.zip management-api-agent-common/target/datastax-mgmtapi-agent-*.jar management-api-agent-3.x/target/datastax-mgmtapi-agent-*.jar management-api-agent-4.x/target/datastax-mgmtapi-agent-*.jar management-api-agent-dse-6.8/target/datastax-mgmtapi-agent-*.jar management-api-server/target/datastax-mgmtapi-server-*.jar management-api-common/target/datastax-mgmtapi-common-*.jar
- name: Retrieve stashed release URL
uses: actions/download-artifact@v1
with:
Expand Down
35 changes: 0 additions & 35 deletions Dockerfile-3_11

This file was deleted.

63 changes: 51 additions & 12 deletions Dockerfile-4_0
Original file line number Diff line number Diff line change
@@ -1,26 +1,63 @@
FROM management-api-for-apache-cassandra-builder as builder
ARG CASSANDRA_VERSION=4.0-beta4

FROM datastax/cassandra:4.0
FROM maven:3.6.3-jdk-8-slim as builder

COPY --from=builder /build/management-api-common/target/datastax-mgmtapi-common-0.1.0-SNAPSHOT.jar /tmp
COPY --from=builder /build/management-api-agent/target/datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar /tmp
COPY --from=builder /build/management-api-server/target/datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
COPY --from=builder /build/management-api-shim-3.x/target/datastax-mgmtapi-shim-3.x-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
COPY --from=builder /build/management-api-shim-4.x/target/datastax-mgmtapi-shim-4.x-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
ARG METRICS_COLLECTOR_VERSION=0.1.9

WORKDIR /build

COPY pom.xml ./
COPY management-api-agent-common/pom.xml ./management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml ./management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml ./management-api-agent-4.x/pom.xml
COPY management-api-common/pom.xml ./management-api-common/pom.xml
COPY management-api-server/pom.xml ./management-api-server/pom.xml
# this duplicates work done in the next steps, but this should provide
# a solid cache layer that only gets reset on pom.xml changes
RUN mvn -q -ff -T 1C install && rm -rf target

COPY management-api-agent-common ./management-api-agent-common
COPY management-api-agent-3.x ./management-api-agent-3.x
COPY management-api-agent-4.x ./management-api-agent-4.x
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
RUN mvn -q -ff package -DskipTests

# Download and extract Metrics Collector
ENV MCAC_PATH /opt/metrics-collector
RUN mkdir ${MCAC_PATH} && \
if test ! -e datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz; then curl -L -O "https://github.com/datastax/metric-collector-for-apache-cassandra/releases/download/v${METRICS_COLLECTOR_VERSION}/datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz"; fi && \
tar --directory ${MCAC_PATH} --strip-components 1 --gzip --extract --file datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz

FROM cassandra:${CASSANDRA_VERSION}

ENV CASSANDRA_PATH /opt/cassandra
ENV MAAC_PATH /opt/management-api
ENV MCAC_PATH /opt/metrics-collector

ENV CASSANDRA_HOME ${CASSANDRA_PATH}
ENV CASSANDRA_CONF ${CASSANDRA_PATH}/conf
ENV CASSANDRA_LOGS ${CASSANDRA_PATH}/logs

COPY --from=builder /build/management-api-agent-4.x/target/datastax-mgmtapi-agent-4.x-0.1.0-SNAPSHOT.jar ${MAAC_PATH}/datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar
COPY --from=builder /build/management-api-server/target/datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar ${MAAC_PATH}/
COPY --from=builder ${MCAC_PATH} ${MCAC_PATH}

# Setup user and fixup permissions
RUN chown -R cassandra:root ${CASSANDRA_PATH} ${MAAC_PATH} ${MCAC_PATH} && \
chmod -R g+w ${CASSANDRA_PATH} ${MAAC_PATH} ${MCAC_PATH}

ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

RUN set -eux; \
rm -fr /etc/apt/sources.list.d/*; \
rm -rf /var/lib/apt/lists/*; \
apt-get update; \
apt-get install -y --no-install-recommends wget iproute2; \
rm -rf /var/lib/apt/lists/*

ENV MCAC_VERSION 0.1.7
ADD https://github.com/datastax/metric-collector-for-apache-cassandra/releases/download/v${MCAC_VERSION}/datastax-mcac-agent-${MCAC_VERSION}.tar.gz /opt/mcac-agent.tar.gz
RUN mkdir /opt/mcac-agent && tar zxvf /opt/mcac-agent.tar.gz -C /opt/mcac-agent --strip-components 1 && rm /opt/mcac-agent.tar.gz

# backwards compat with upstream ENTRYPOINT
COPY scripts/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
Expand All @@ -29,5 +66,7 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
EXPOSE 9103
EXPOSE 8080

ENTRYPOINT ["/docker-entrypoint.sh"]
USER cassandra

ENTRYPOINT ["/tini", "-g", "--", "/docker-entrypoint.sh"]
CMD ["mgmtapi"]
53 changes: 43 additions & 10 deletions Dockerfile-astra-4_0
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
FROM management-api-for-apache-cassandra-builder as builder
FROM maven:3.6.3-jdk-8-slim as builder

ARG METRICS_COLLECTOR_VERSION=0.1.9

WORKDIR /build

COPY pom.xml ./
COPY management-api-agent-common/pom.xml ./management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml ./management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml ./management-api-agent-4.x/pom.xml
COPY management-api-common/pom.xml ./management-api-common/pom.xml
COPY management-api-server/pom.xml ./management-api-server/pom.xml
# this duplicates work done in the next steps, but this should provide
# a solid cache layer that only gets reset on pom.xml changes
RUN mvn -q -ff -T 1C install && rm -rf target

COPY management-api-agent-common ./management-api-agent-common
COPY management-api-agent-3.x ./management-api-agent-3.x
COPY management-api-agent-4.x ./management-api-agent-4.x
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
RUN mvn -q -ff package -DskipTests

# Download and extract Metrics Collector
ENV MCAC_PATH /opt/metrics-collector
RUN mkdir ${MCAC_PATH} && \
if test ! -e datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz; then curl -L -O "https://github.com/datastax/metric-collector-for-apache-cassandra/releases/download/v${METRICS_COLLECTOR_VERSION}/datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz"; fi && \
tar --directory ${MCAC_PATH} --strip-components 1 --gzip --extract --file datastax-mcac-agent-${METRICS_COLLECTOR_VERSION}.tar.gz

FROM datastax/astra:4.0

COPY --from=builder /build/management-api-common/target/datastax-mgmtapi-common-0.1.0-SNAPSHOT.jar /tmp/
COPY --from=builder /build/management-api-agent/target/datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar /tmp/
COPY --from=builder /build/management-api-server/target/datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
COPY --from=builder /build/management-api-shim-3.x/target/datastax-mgmtapi-shim-3.x-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
COPY --from=builder /build/management-api-shim-4.x/target/datastax-mgmtapi-shim-4.x-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
ENV CASSANDRA_PATH /opt/cassandra
ENV MAAC_PATH /opt/management-api
ENV MCAC_PATH /opt/metrics-collector

ENV CASSANDRA_HOME ${CASSANDRA_PATH}
ENV CASSANDRA_CONF ${CASSANDRA_PATH}/conf
ENV CASSANDRA_LOGS ${CASSANDRA_PATH}/logs

COPY --from=builder /build/management-api-agent-3.x/target/datastax-mgmtapi-agent-3.x-0.1.0-SNAPSHOT.jar ${MAAC_PATH}/datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar
COPY --from=builder /build/management-api-server/target/datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar ${MAAC_PATH}/
COPY --from=builder ${MCAC_PATH} ${MCAC_PATH}

# Setup user and fixup permissions
RUN chown -R cassandra:root ${CASSANDRA_PATH} ${MAAC_PATH} ${MCAC_PATH} && \
chmod -R g+w ${CASSANDRA_PATH} ${MAAC_PATH} ${MCAC_PATH}

ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
Expand All @@ -17,10 +54,6 @@ RUN set -eux; \
apt-get install -y --no-install-recommends wget; \
rm -rf /var/lib/apt/lists/*

ENV MCAC_VERSION 0.1.2
ADD https://github.com/datastax/metric-collector-for-apache-cassandra/releases/download/v${MCAC_VERSION}/datastax-mcac-agent-${MCAC_VERSION}.tar.gz /opt/mcac-agent.tar.gz
RUN mkdir /opt/mcac-agent && tar zxvf /opt/mcac-agent.tar.gz -C /opt/mcac-agent --strip-components 1 && rm /opt/mcac-agent.tar.gz

# backwards compat with upstream ENTRYPOINT
COPY scripts/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile-build
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ FROM maven:3.6.3-jdk-8-slim
WORKDIR /build

COPY pom.xml ./
COPY management-api-agent/pom.xml ./management-api-agent/pom.xml
COPY management-api-agent-common/pom.xml ./management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml ./management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml ./management-api-agent-4.x/pom.xml
COPY management-api-common/pom.xml ./management-api-common/pom.xml
COPY management-api-server/pom.xml ./management-api-server/pom.xml
COPY management-api-shim-3.x/pom.xml ./management-api-shim-3.x/pom.xml
COPY management-api-shim-4.x/pom.xml ./management-api-shim-4.x/pom.xml
# this duplicates work done in the next steps, but this should provide
# a solid cache layer that only gets reset on pom.xml changes
RUN mvn -q -ff -T 1C install && rm -rf target

COPY management-api-agent ./management-api-agent
COPY management-api-agent-common ./management-api-agent-common
COPY management-api-agent-3.x ./management-api-agent-3.x
COPY management-api-agent-4.x ./management-api-agent-4.x
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
COPY management-api-shim-3.x ./management-api-shim-3.x
COPY management-api-shim-4.x ./management-api-shim-4.x
RUN mvn -q -ff package -DskipTests
16 changes: 8 additions & 8 deletions Dockerfile-build-dse
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ FROM maven:3.6.3-jdk-8-slim
WORKDIR /build

COPY pom.xml ./
COPY management-api-agent/pom.xml ./management-api-agent/pom.xml
COPY management-api-agent-common/pom.xml ./management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml ./management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml ./management-api-agent-4.x/pom.xml
COPY management-api-agent-dse-6.8/pom.xml ./management-api-agent-dse-6.8/pom.xml
COPY management-api-common/pom.xml ./management-api-common/pom.xml
COPY management-api-server/pom.xml ./management-api-server/pom.xml
COPY management-api-shim-3.x/pom.xml ./management-api-shim-3.x/pom.xml
COPY management-api-shim-4.x/pom.xml ./management-api-shim-4.x/pom.xml
COPY management-api-shim-dse-6.8/pom.xml ./management-api-shim-dse-6.8/pom.xml

COPY settings.xml settings.xml /root/.m2/

COPY management-api-agent ./management-api-agent
COPY management-api-agent-common ./management-api-agent-common
COPY management-api-agent-3.x ./management-api-agent-3.x
COPY management-api-agent-4.x ./management-api-agent-4.x
COPY management-api-agent-dse-6.8 ./management-api-agent-dse-6.8
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
COPY management-api-shim-3.x ./management-api-shim-3.x
COPY management-api-shim-4.x ./management-api-shim-4.x
COPY management-api-shim-dse-6.8 ./management-api-shim-dse-6.8
RUN mvn -ff -q clean package -DskipTests -P dse
53 changes: 40 additions & 13 deletions Dockerfile-dse-68
Original file line number Diff line number Diff line change
@@ -1,34 +1,61 @@
FROM management-api-for-dse-builder as builder
ARG CASSANDRA_VERSION=6.8.9

FROM datastax/dse-server:6.8.0
FROM maven:3.6.3-jdk-8-slim as builder

ARG METRICS_COLLECTOR_VERSION=0.1.9

WORKDIR /build

COPY pom.xml ./
COPY management-api-agent-common/pom.xml ./management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml ./management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml ./management-api-agent-4.x/pom.xml
COPY management-api-agent-dse-6.8/pom.xml ./management-api-agent-dse-6.8/pom.xml
COPY management-api-common/pom.xml ./management-api-common/pom.xml
COPY management-api-server/pom.xml ./management-api-server/pom.xml
COPY settings.xml settings.xml /root/.m2/
# this duplicates work done in the next steps, but this should provide
# a solid cache layer that only gets reset on pom.xml changes
RUN mvn -q -ff -T 1C install -Pdse && rm -rf target

COPY management-api-agent-common ./management-api-agent-common
COPY management-api-agent-3.x ./management-api-agent-3.x
COPY management-api-agent-4.x ./management-api-agent-4.x
COPY management-api-agent-dse-6.8 ./management-api-agent-dse-6.8
COPY management-api-common ./management-api-common
COPY management-api-server ./management-api-server
RUN mvn -q -ff package -DskipTests -Pdse

FROM datastax/dse-server:${CASSANDRA_VERSION}

# accept the License
ENV DS_LICENSE=accept

COPY --from=builder /build/management-api-common/target/datastax-mgmtapi-common-0.1.0-SNAPSHOT.jar /opt/dse/
COPY --from=builder /build/management-api-agent/target/datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar /opt/dse/
COPY --from=builder /build/management-api-server/target/datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
COPY --from=builder /build/management-api-shim-3.x/target/datastax-mgmtapi-shim-3.x-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
COPY --from=builder /build/management-api-shim-4.x/target/datastax-mgmtapi-shim-4.x-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
COPY --from=builder /build/management-api-shim-dse-6.8/target/datastax-mgmtapi-shim-dse-6.8-0.1.0-SNAPSHOT.jar /opt/mgmtapi/
ENV CASSANDRA_PATH /opt/dse
ENV MAAC_PATH /opt/management-api

USER root
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENV CASSANDRA_HOME ${CASSANDRA_PATH}
ENV CASSANDRA_CONF ${CASSANDRA_PATH}/resources/cassandra/conf
ENV CASSANDRA_LOGS ${CASSANDRA_PATH}/logs

COPY --from=builder /build/management-api-agent-dse-6.8/target/datastax-mgmtapi-agent-dse-6.8-0.1.0-SNAPSHOT.jar ${MAAC_PATH}/datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar
COPY --from=builder /build/management-api-server/target/datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar ${MAAC_PATH}/

USER root
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends wget iproute2; \
rm -rf /var/lib/apt/lists/*

# backwards compat with upstream ENTRYPOINT
COPY dse-68/docker-entrypoint.sh /usr/local/bin/
COPY scripts/dse-6.8-docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
ln -sf /usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh

EXPOSE 9103
EXPOSE 8080

USER dse

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["mgmtapi"]
Loading

0 comments on commit 0608d0c

Please sign in to comment.