Skip to content

Commit 17e6537

Browse files
authored
Add Docker images definition and instruction to deploy on Kubernetes (apache#443)
1 parent f5ab3b9 commit 17e6537

25 files changed

+9096
-0
lines changed

docker/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# Ignore
3+
pulsar-*-bin.tar.gz

docker/Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# Copyright 2016 Yahoo Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
FROM openjdk:8-jdk
18+
19+
# Install some utilities
20+
RUN apt-get update && apt-get install -y netcat dnsutils
21+
22+
ARG VERSION
23+
24+
ADD pulsar-${VERSION}-bin.tar.gz /
25+
RUN mv /pulsar-${VERSION} /pulsar
26+
27+
COPY scripts/apply-config-from-env.py /pulsar/bin
28+
COPY scripts/generate-zookeeper-config.sh /pulsar/bin
29+
COPY scripts/pulsar-zookeeper-ruok.sh /pulsar/bin
30+
31+
WORKDIR /pulsar
32+
33+
VOLUME ["/pulsar/conf", "/pulsar/data"]
34+
35+
ENV PULSAR_ROOT_LOGGER=INFO,CONSOLE

docker/build.sh

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2016 Yahoo Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Get the project version from Maven
19+
pushd .. > /dev/null
20+
MVN_VERSION=$(mvn -q \
21+
-Dexec.executable="echo" \
22+
-Dexec.args='${project.version}' \
23+
--non-recursive \
24+
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
25+
popd > /dev/null
26+
27+
echo "Pulsar version: ${MVN_VERSION}"
28+
29+
PULSAR_TGZ=$(dirname $PWD)/all/target/pulsar-${MVN_VERSION}-bin.tar.gz
30+
31+
if [ ! -f $PULSAR_TGZ ]; then
32+
echo "Pulsar bin distribution not found at ${PULSAR_TGZ}"
33+
exit 1
34+
fi
35+
36+
LINKED_PULSAR_TGZ=pulsar-${MVN_VERSION}-bin.tar.gz
37+
ln -f ${PULSAR_TGZ} $LINKED_PULSAR_TGZ
38+
39+
echo "Using Pulsar binary package at ${PULSAR_TGZ}"
40+
41+
# Build base image, reused by all other components
42+
docker build --build-arg VERSION=${MVN_VERSION} \
43+
-t pulsar:latest .
44+
45+
if [ $? != 0 ]; then
46+
echo "Error: Failed to create Docker image for pulsar"
47+
exit 1
48+
fi
49+
50+
rm pulsar-${MVN_VERSION}-bin.tar.gz
51+
52+
53+
# Build pulsar-grafana image
54+
docker build -t pulsar-grafana grafana
55+
if [ $? != 0 ]; then
56+
echo "Error: Failed to create Docker image for pulsar-grafana"
57+
exit 1
58+
fi
59+
60+
# Build dashboard docker image
61+
docker build -t pulsar-dashboard ../dashboard
62+
if [ $? != 0 ]; then
63+
echo "Error: Failed to create Docker image for pulsar-dashboard"
64+
exit 1
65+
fi

docker/grafana/Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright 2016 Yahoo Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
FROM grafana/grafana:4.3.1
18+
19+
COPY grafana.ini /etc/grafana/grafana.ini
20+
COPY dashboards/* /var/lib/grafana/dashboards/
21+
COPY start.sh /start.sh
22+
23+
EXPOSE 3000
24+
25+
ENV PROMETHEUS_URL http://prometheus:9090
26+
27+
ENTRYPOINT ["/start.sh"]

0 commit comments

Comments
 (0)