This commit is contained in:
parent
e24fef78d1
commit
337c33bdd1
37
.drone.yml
Normal file
37
.drone.yml
Normal file
@ -0,0 +1,37 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: prepare-environment
|
||||
image: ubuntu
|
||||
environment:
|
||||
ARTEMIS_VERSION: 2.13.0
|
||||
commands:
|
||||
- apt update && apt install -y wget
|
||||
- wget http://xenia.sote.hu/ftp/mirrors/www.apache.org/activemq/activemq-artemis/${ARTEMIS_VERSION}/apache-artemis-${ARTEMIS_VERSION}-bin.tar.gz
|
||||
- tar -xvf apache-artemis-${ARTEMIS_VERSION}-bin.tar.gz
|
||||
- mv apache-artemis-${ARTEMIS_VERSION}/* .
|
||||
- rm -rf apache-artemis-${ARTEMIS_VERSION}-bin.tar.gz
|
||||
- rmdir apache-artemis-${ARTEMIS_VERSION}
|
||||
|
||||
- name: kaniko
|
||||
image: banzaicloud/drone-kaniko
|
||||
settings:
|
||||
registry: registry.kmlabz.com
|
||||
repo: birbnetes/${DRONE_REPO_NAME}
|
||||
username:
|
||||
from_secret: DOCKER_USERNAME
|
||||
password:
|
||||
from_secret: DOCKER_PASSWORD
|
||||
tags:
|
||||
- latest
|
||||
- ${DRONE_BUILD_NUMBER}
|
||||
|
||||
- name: ms-teams
|
||||
image: kuperiu/drone-teams
|
||||
settings:
|
||||
webhook:
|
||||
from_secret: TEAMS_WEBHOOK
|
||||
when:
|
||||
status: [ failure ]
|
69
Dockerfile
Normal file
69
Dockerfile
Normal file
@ -0,0 +1,69 @@
|
||||
# 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.
|
||||
|
||||
# ActiveMQ Artemis
|
||||
|
||||
FROM jboss/base-jdk:8
|
||||
LABEL maintainer="Apache ActiveMQ Team"
|
||||
# Make sure pipes are considered to determine success, see: https://github.com/hadolint/hadolint/wiki/DL4006
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
WORKDIR /opt
|
||||
|
||||
ENV ARTEMIS_USER artemis
|
||||
ENV ARTEMIS_PASSWORD artemis
|
||||
ENV ANONYMOUS_LOGIN false
|
||||
ENV EXTRA_ARGS --http-host 0.0.0.0 --relax-jolokia
|
||||
|
||||
USER root
|
||||
|
||||
# add user and group for artemis
|
||||
RUN groupadd -g 1001 -r artemis && useradd -r -u 1001 -g artemis artemis \
|
||||
&& yum install -y libaio && yum -y clean all
|
||||
|
||||
USER artemis
|
||||
|
||||
ADD . /opt/activemq-artemis
|
||||
|
||||
# Web Server
|
||||
EXPOSE 8161 \
|
||||
# JMX Exporter
|
||||
9404 \
|
||||
# Port for CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE
|
||||
61616 \
|
||||
# Port for HORNETQ,STOMP
|
||||
5445 \
|
||||
# Port for AMQP
|
||||
5672 \
|
||||
# Port for MQTT
|
||||
1883 \
|
||||
#Port for STOMP
|
||||
61613
|
||||
|
||||
USER root
|
||||
|
||||
RUN mkdir /var/lib/artemis-instance && chown -R artemis.artemis /var/lib/artemis-instance
|
||||
|
||||
COPY ./docker/docker-run.sh /
|
||||
|
||||
USER artemis
|
||||
|
||||
# Expose some outstanding folders
|
||||
VOLUME ["/var/lib/artemis-instance"]
|
||||
WORKDIR /var/lib/artemis-instance
|
||||
|
||||
ENTRYPOINT ["/docker-run.sh"]
|
||||
CMD ["run"]
|
62
README.md
62
README.md
@ -1,3 +1,61 @@
|
||||
# activemq-artemis
|
||||
# Apache ActiveMQ Artemis Container Image
|
||||
|
||||
ActiveMQ Artemis Container Image
|
||||
This is a container Image of Apache ActiveMQ Artemis that can be used inside Kubernetes.
|
||||
|
||||
# Environment variables
|
||||
Environment variables determine the options sent to `artemis create` on first execution of the Docker
|
||||
container. The available options are:
|
||||
|
||||
**`ARTEMIS_USER`**
|
||||
|
||||
The administrator username. The default is `artemis`.
|
||||
|
||||
**`ARTEMIS_PASSWORD`**
|
||||
|
||||
The administrator password. The default is `artemis`.
|
||||
|
||||
**`ANONYMOUS_LOGIN`**
|
||||
|
||||
Set to `true` to allow anonymous logins. The default is `false`.
|
||||
|
||||
**`EXTRA_ARGS`**
|
||||
|
||||
Additional arguments sent to the `artemis create` command. The default is `--http-host 0.0.0.0 --relax-jolokia`.
|
||||
Setting this value will override the default. See the documentation on `artemis create` for available options.
|
||||
|
||||
**Final broker creation command:**
|
||||
|
||||
The combination of the above environment variables results in the `docker-run.sh` script calling
|
||||
the following command to create the broker instance the first time the Docker container runs:
|
||||
|
||||
${ARTEMIS_HOME}/bin/artemis create --user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent ${LOGIN_OPTION} ${EXTRA_ARGS}
|
||||
|
||||
Note: `LOGIN_OPTION` is either `--allow-anonymous` or `--require-login` depending on the value of `ANONYMOUS_LOGIN`.
|
||||
|
||||
# Mapping point
|
||||
|
||||
- `/var/lib/artemis-instance`
|
||||
|
||||
It's possible to map a folder as the instance broker.
|
||||
This will hold the configuration and the data of the running broker. This is useful for when you want the data persisted outside of a container.
|
||||
|
||||
|
||||
# Lifecycle of the execution
|
||||
|
||||
A broker instance will be created during the execution of the instance. If you pass a mapped folder for `/var/lib/artemis-instance` an image will be created or reused depending on the contents of the folder.
|
||||
|
||||
|
||||
|
||||
## Running the image
|
||||
|
||||
The image just created in the previous step allows both stateless or stateful runs.
|
||||
The stateless run is achieved by:
|
||||
```
|
||||
$ docker run --rm -it -p 61616:61616 -p 8161:8161 artemis-centos
|
||||
```
|
||||
The image will also support mapped folders and mapped ports. To run the image with the instance persisted on the host:
|
||||
```
|
||||
docker run -it -p 61616:61616 -p 8161:8161 -v <broker folder on host>:/var/lib/artemis-instance artemis-centos
|
||||
```
|
||||
where `<broker folder on host>` is a folder where the broker instance is supposed to
|
||||
be saved and reused on each run.
|
||||
|
48
docker-run.sh
Normal file
48
docker-run.sh
Normal file
@ -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 "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user