From 39529fda540f18b785d62b7f9ab60f31de3eed37 Mon Sep 17 00:00:00 2001 From: bhearn Date: Mon, 13 Jul 2020 16:05:48 -0600 Subject: [PATCH] update to 5.15.13 --- Dockerfile | 46 ++++++++++++---------------- Jenkinsfile | 2 +- README.md | 47 +++++++++++++++++++++++------ deployment/activemq-deployment.yaml | 36 ++++++++++++++++++++++ deployment/activemq-service.yaml | 32 ++++++++++++++++++++ deployment/jetty-realm.properties | 3 ++ download.yaml | 9 +++--- 7 files changed, 133 insertions(+), 42 deletions(-) create mode 100644 deployment/activemq-deployment.yaml create mode 100644 deployment/activemq-service.yaml create mode 100644 deployment/jetty-realm.properties diff --git a/Dockerfile b/Dockerfile index 9f530a5..1de3a7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,32 @@ -ARG BASE_REGISTRY=nexus-docker-secure.levelup-nexus.svc.cluster.local:18082 -ARG BASE_IMAGE=redhat/ubi/ubi8 -ARG BASE_TAG=8.2 +ARG BASE_REGISTRY=nexus-docker-secure.levelup-dev.io +ARG BASE_IMAGE=redhat/openjdk/openjdk13 +ARG BASE_TAG=1.13.0 -FROM ${BASE_REGISTRY}/opensource/openjdk/openjdk13:1.13.0 - -ARG VERSION=5.15.12 -ARG DISTRO_NAME=apache-activemq-${VERSION} -ARG USER_NAME=activemq -ARG ACTIVEMQ_HOME=/opt/activemq +FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} LABEL name="ActiveMQ" \ + maintainer="bhearn@anchore.com" \ vendor="Apache" \ - version=$VERSION \ - summary="Apache ActiveMQâ„¢ is the most popular open source, multi-protocol, Java-based messaging server. " + version="5.15.13" \ + release="1" \ + summary="Image of ActiveMQ" \ + description="Apache ActiveMQ is an open source, multi-protocol, Java-based messaging server" -USER root +COPY apache-activemq-5.15.13-bin.tar.gz / -COPY ${DISTRO_NAME}.tar.gz /opt - -RUN tar -zxf /opt/${DISTRO_NAME}.tar.gz -C /opt && \ - rm -f /opt/${DISTRO_NAME}.tar.gz && \ - ln -s /opt/${DISTRO_NAME} ${ACTIVEMQ_HOME} && \ - useradd -r ${USER_NAME} --uid=1000 && \ - chown -R ${USER_NAME}:${USER_NAME} /opt/${DISTRO_NAME} && \ - chown -h ${USER_NAME}:${USER_NAME} ${ACTIVEMQ_HOME} && \ - sed -i "/#JAVA_HOME=*/c\JAVA_HOME=/opt/jdk-13.0.2" /opt/${DISTRO_NAME}/bin/env +# root user is needed to extract files from the ActiveMQ gzip +USER root -USER ${USER_NAME} +RUN tar -zxf apache-activemq-5.15.13-bin.tar.gz && \ + rm apache-activemq-5.15.13-bin.tar.gz && \ + chmod 755 apache-activemq-5.15.13/bin/activemq && \ + useradd -r activemq --uid=1000 && \ + chown -R activemq:activemq apache-activemq-5.15.13 -WORKDIR ${ACTIVEMQ_HOME} +USER activemq -EXPOSE 61616 8161 5672 61613 1883 61614 +EXPOSE 8161 61616 5672 61613 1833 HEALTHCHECK CMD curl localhost:8161 -CMD ["bin/activemq", " start"] - +CMD ["apache-activemq-5.15.13/bin/activemq", " start"] \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 326bba1..a00bb8c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,2 +1,2 @@ @Library('DCCSCR@master') _ -dccscrPipeline(version: "5.15.12") +dccscrPipeline(version: "5.15.13") \ No newline at end of file diff --git a/README.md b/README.md index d9034e7..ec43515 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,47 @@ -# Apache ActiveMQ v5.15.12 +# ActiveMQ -## Usage +Version: 5.15.13 -`docker run -d -p 61616:61616 -p 8161:8161 ` +Apache ActiveMQ is an open source, multi-protocol, Java-based messaging server. -## Port map +## Download from Iron Bank -61616 JMS +1. Go to the [Apache webpage](https://ironbank.dsop.io/ironbank/repomap/opensource/apache) in Iron Bank and download the latest ActiveMQ tarball. -8161 UI +2. Navigate to the location of the download and run: +``` +docker load -i *tarball* +``` -5672 AMQP +## Usage with Kubernetes -61613 STOMP +1. Create a namespace for our ActiveMQ deployment: +``` +kubectl create ns active-mq +``` -1883 MQTT +2. Modify _jetty-realm.properties_ in the 'deployment' directory of this repo to use your own custom usernames and passwords. -61614 WS +3. Create a secret using your _jetty-realm.properties_ file: +``` +kubectl -n active-mq create secret generic active-mq-creds --from-file=jetty-realm.properties +``` +4. Modify line 18 of _activemq-deployment.yaml_ in the 'deployment' directory of this repo to use the ActiveMQ image we loaded from Iron Bank. + +5. Create a deployment using your _activemq-deployment.yaml_ file: +``` +kubectl -n active-mq apply -f activemq-deployment.yaml +``` + +6. Create a service using the _activemq-service.yaml_ file: +``` +kubectl -n active-mq apply -f activemq-service.yaml +``` + +You should now be able to navigate to the ActiveMQ dashboard URL and login using your credentials. + +## Notes + +- root user is needed to extract files from the ActiveMQ gzip +- exposed ports: 8161, 61616, 5672, 61613, and 1833 \ No newline at end of file diff --git a/deployment/activemq-deployment.yaml b/deployment/activemq-deployment.yaml new file mode 100644 index 0000000..21850fa --- /dev/null +++ b/deployment/activemq-deployment.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: active-mq + labels: + app: active-mq +spec: + replicas: 1 + selector: + matchLabels: + app: active-mq + template: + metadata: + labels: + app: active-mq + spec: + containers: + - image: # modify this + name: active-mq + imagePullPolicy: Always + resources: + requests: + memory: 500Mi + cpu: 200m + limits: + memory: 1000Mi + cpu: 400m + volumeMounts: + - name: active-creds + mountPath: /apache-activemq-5.15.13/conf/jetty-realm.properties + subPath: jetty-realm.properties + volumes: + - name: active-creds + secret: + secretName: active-mq-creds + restartPolicy: Always \ No newline at end of file diff --git a/deployment/activemq-service.yaml b/deployment/activemq-service.yaml new file mode 100644 index 0000000..19c9a9c --- /dev/null +++ b/deployment/activemq-service.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: Service +metadata: + name: active-mq + namespace: active-mq + labels: + app: active-mq +spec: + selector: + app: active-mq + ports: + - name: dashboard + port: 8161 + targetPort: 8161 + protocol: TCP + - name: openwire + port: 61616 + targetPort: 61616 + protocol: TCP + - name: amqp + port: 5672 + targetPort: 5672 + protocol: TCP + - name: stomp + port: 61613 + targetPort: 61613 + protocol: TCP + - name: mqtt + port: 1883 + targetPort: 1883 + protocol: TCP + type: LoadBalancer \ No newline at end of file diff --git a/deployment/jetty-realm.properties b/deployment/jetty-realm.properties new file mode 100644 index 0000000..2b14d59 --- /dev/null +++ b/deployment/jetty-realm.properties @@ -0,0 +1,3 @@ +# username: password, role +admin_username: admin_pass, admin +guest_user: guest_pass, guest \ No newline at end of file diff --git a/download.yaml b/download.yaml index 23321ff..a630d2f 100644 --- a/download.yaml +++ b/download.yaml @@ -1,8 +1,7 @@ +--- resources: - - url: "https://downloads.apache.org/activemq/5.15.12/apache-activemq-5.15.12-bin.tar.gz" - filename: "apache-activemq-5.15.12.tar.gz" + - url: "http://www.apache.org/dyn/closer.cgi?filename=/activemq/5.15.13/apache-activemq-5.15.13-bin.tar.gz&action=download" + filename: "apache-activemq-5.15.13-bin.tar.gz" validation: type: "sha512" - value: "3c6e44bcd53d73ab03063a52244e54d26d39eb38b5c0bba6c34bc639645eb1a2a0004cb309ee3162a013977384157e345cf1c69d93f8c9a1e11fb690680eb24a" - - + value: "4a237fe2d3cdfbc1b5b45c92a5aab0d009acbfe5383c188b9691100e2e47de0548a1c24e0d8382a88c4600cd2b8792ce75e9be7d88de55f86b0bde7c9a92c285" \ No newline at end of file -- GitLab