diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4c67dad4aa3dcbf3eef73200c64b70265809545f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +ARG BASE_REGISTRY=registry1.dsop.io +ARG BASE_IMAGE=redhat/openjdk/openjdk8 +ARG BASE_TAG=1.8.0 + +# FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} +FROM localhost/redhat/openjdk/openjdk8:1.8.0 + +LABEL name="ActiveMQ Artemis" \ + maintainer="bhearn@anchore.com" \ + vendor="Apache" \ + version="2.14.0" \ + release="1" \ + summary="Image of ActiveMQ Artemis" \ + description="Apache ActiveMQ is an open source, multi-protocol, Java-based messaging server." + +COPY apache-activemq-artemis.tar.gz /scripts/docker-run.sh opt/ + +# Make sure pipes are considered to determine success, see: https://github.com/hadolint/hadolint/wiki/DL4006 +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +WORKDIR /opt + +USER root + +RUN groupadd -g 1001 -r artemis; \ + useradd -r -u 1001 -g artemis artemis; \ + dnf upgrade -y; \ + dnf install -y libaio --setopt=tsflags=nodocs; \ + dnf clean all; \ + rm -rf /var/cache/dnf; \ + tar -zxf apache-activemq-artemis.tar.gz; \ + mv apache-artemis-2.14.0 activemq-artemis; \ + rm -f apache-activemq-artemis.tar.gz; \ + chmod +x docker-run.sh; \ + mkdir /var/lib/artemis-instance; \ + chown -R artemis.artemis /var/lib/artemis-instance + +USER artemis + +EXPOSE 8161 \ + 9404 \ + 61616 \ + 5445 \ + 5672 \ + 1883 \ + 61613 + +WORKDIR /var/lib/artemis-instance + +ENTRYPOINT ["/opt/docker-run.sh"] +CMD ["run"] + +HEALTHCHECK CMD curl -f localhost:8161 || exit 1 \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000000000000000000000000000000000..7bcae3ff3a7d5290bb79c74465e91d9e884e473f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,2 @@ +@Library('DCCSCR@master') _ +dccscrPipeline(version: "2.14.0") \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..85a01ca8f80dee8d072cd1ba5183e8797ae171ee --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019 DSOP + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 75d3e3b7180c0913e4a85a22b60ea153420e575a..8aa9b743469930dcd93dc8a015ba99f6e649cdd1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,67 @@ -# active-mq-artemis +# ActiveMQ Artemis +Apache ActiveMQ is an open source, multi-protocol, Java-based messaging server. + +## Download + +1. Go to the [Apache webpage](https://ironbank.dsop.io/ironbank/repomap/opensource/apache) in Iron Bank and download the latest ActiveMQ Artemis tarball. + +2. Navigate to the location of the download and run: +``` +docker load -i +``` + +## Install + +1. Clone this repo and change into the 'deployment' directory. +``` +git clone https://repo1.dsop.io/dsop/opensource/apache/active-mq/active-mq-artemis.git +cd active-mq-artemis/deployment +``` + +2. Create a namespace for our ActiveMQ deployment: +``` +kubectl create ns active-mq +``` + +3. Modify _kustomization.yaml_ to use your own custom username and password. **This file MUST be configured with proper values in order to deploy**: +``` +- ARTEMIS_USER=<<>> # line 10 +- ARTEMIS_PASSWORD=<<>> # line 11 +``` + +4. Modify _activemq-deployment.yaml_ to use the ActiveMQ image we loaded from Iron Bank. +``` +- image: # line 18 +``` + +5. Create a persistent volume claim, deployment, and service using the kustomize directory that you're in. +``` +kubectl -n active-mq apply -k . +``` + +## Usage + +1. Retrieve the external IP and port of the active-mq loadbalancer service or use port-forwarding to access the ActiveMQ console. +``` +kubectl -n active-mq get svc +# OR +kubectl -n active-mq port-forward svc/active-mq 8161:8161 +``` + +2. Navigate to the ActiveMQ console (`localhost:8161/console`) in your browser and login using the username and password you provided in step 3 of the install instructions. + +3. (Optional) Further configure Apache ActiveMQ Artemis to use your desired settings: [Artemis Documentation](https://activemq.apache.org/components/artemis/documentation/latest/security.html). + +## Notes + +Exposed Ports: +- 8161 (Web Server) +- 9404 (JMX Exporter) +- 61616 (Port for CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE) +- 5445 (Port for HORNETQ,STOMP) +- 5672 (Port for AMQP) +- 1883 (Port for MQTT) +- 61613 (Port for STOMP) + +For testing purposes only, see [here](https://github.com/apache/activemq-artemis/tree/master/artemis-docker). \ No newline at end of file diff --git a/deployment/activemq-deployment.yaml b/deployment/activemq-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bfa8d7f11f40af29f87a2941a4c4edabb4a5af12 --- /dev/null +++ b/deployment/activemq-deployment.yaml @@ -0,0 +1,63 @@ +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 + readinessProbe: + httpGet: + path: /console + port: 8161 + initialDelaySeconds: 10 + periodSeconds: 10 + livenessProbe: + httpGet: + path: /console + port: 8161 + initialDelaySeconds: 10 + periodSeconds: 10 + volumeMounts: + - name: data + mountPath: /var/lib/artemis-instance/data + - name: logs + mountPath: /var/lib/artemis-instance/logs + - name: tmp + mountPath: /var/lib/artemis-instance/tmp + env: + - name: ARTEMIS_USER + valueFrom: + secretKeyRef: + name: artemis-secrets + key: ARTEMIS_USER + - name: ARTEMIS_PASSWORD + valueFrom: + secretKeyRef: + name: artemis-secrets + key: ARTEMIS_PASSWORD + - name: ANONYMOUS_LOGIN + value: "false" + - name: EXTRA_ARGS + value: "--http-host 0.0.0.0 --relax-jolokia" + volumes: + - name: data + persistentVolumeClaim: + claimName: activemq-data-pv-claim + - name: logs + emptyDir: {} + - name: tmp + emptyDir: {} + restartPolicy: Always \ No newline at end of file diff --git a/deployment/activemq-pvc.yaml b/deployment/activemq-pvc.yaml new file mode 100644 index 0000000000000000000000000000000000000000..aac34fb3af863c11ac024fe6341a4f261e28d01a --- /dev/null +++ b/deployment/activemq-pvc.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: activemq-data-pv-claim +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi \ No newline at end of file diff --git a/deployment/activemq-service.yaml b/deployment/activemq-service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f96646b43d836a43ebad847d005d2951c6b68fe1 --- /dev/null +++ b/deployment/activemq-service.yaml @@ -0,0 +1,40 @@ +apiVersion: v1 +kind: Service +metadata: + name: active-mq + namespace: active-mq + labels: + app: active-mq +spec: + selector: + app: active-mq + ports: + - name: web-server + port: 8161 + targetPort: 8161 + protocol: TCP + - name: jmx-exporter + port: 9404 + targetPort: 9404 + protocol: TCP + - name: openwire + port: 61616 + targetPort: 61616 + protocol: TCP + - name: hornetq + port: 5445 + targetPort: 5445 + protocol: TCP + - name: amqp + port: 5672 + targetPort: 5672 + protocol: TCP + - name: mqtt + port: 1883 + targetPort: 1883 + protocol: TCP + - name: stomp + port: 61613 + targetPort: 61613 + protocol: TCP + type: LoadBalancer \ No newline at end of file diff --git a/deployment/kustomization.yaml b/deployment/kustomization.yaml new file mode 100644 index 0000000000000000000000000000000000000000..21768b041427a082cc6d046a482bdf1e22b5e933 --- /dev/null +++ b/deployment/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - activemq-pvc.yaml + - activemq-deployment.yaml + - activemq-service.yaml +secretGenerator: + - name: artemis-secrets + literals: + - ARTEMIS_USER=artemis + - ARTEMIS_PASSWORD=artemis \ No newline at end of file diff --git a/download.yaml b/download.yaml new file mode 100644 index 0000000000000000000000000000000000000000..874a8a883e4671c368397dde8ba2e77145f3cde9 --- /dev/null +++ b/download.yaml @@ -0,0 +1,7 @@ +--- +resources: + - url: "https://downloads.apache.org/activemq/activemq-artemis/2.14.0/apache-artemis-2.14.0-bin.tar.gz" + filename: "apache-activemq-artemis.tar.gz" + validation: + type: "sha512" + value: "84b5a65d8eb2fc8cf3f17df524d586b0c6a2acfa9a09089d5ffdfc1323ff99dfdc775b2e95eec264cfeddc4742839ba9b0f3269351a5c955dd4bbf6d5ec5dfa9" \ No newline at end of file diff --git a/scripts/docker-run.sh b/scripts/docker-run.sh new file mode 100644 index 0000000000000000000000000000000000000000..56431a79aa2a70f4dad07f9c85f31f9fe433366c --- /dev/null +++ b/scripts/docker-run.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + + +# This is the entry point for the docker images. +# This file is executed when docker run is called. + + +set -e + +BROKER_HOME=/var/lib/ +CONFIG_PATH=$BROKER_HOME/etc +export BROKER_HOME OVERRIDE_PATH CONFIG_PATH + +if [[ ${ANONYMOUS_LOGIN,,} == "true" ]]; then + LOGIN_OPTION="--allow-anonymous" +else + LOGIN_OPTION="--require-login" +fi + +CREATE_ARGUMENTS="--user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent ${LOGIN_OPTION} ${EXTRA_ARGS}" + +echo CREATE_ARGUMENTS=${CREATE_ARGUMENTS} + +if ! [ -f ./etc/broker.xml ]; then + /opt/activemq-artemis/bin/artemis create ${CREATE_ARGUMENTS} . +else + echo "broker already created, ignoring creation" +fi + +exec ./bin/artemis "$@" +