2018-09-18 11:39:26 -04:00
|
|
|
# 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.
|
|
|
|
|
2017-11-08 22:56:31 -05:00
|
|
|
# Base image is built from integration-tests/docker-base in the Druid repo
|
|
|
|
FROM imply/druiditbase
|
2014-11-06 13:23:24 -05:00
|
|
|
|
|
|
|
# Setup metadata store
|
2018-02-07 14:19:25 -05:00
|
|
|
# touch is needed because OverlayFS's copy-up operation breaks POSIX standards. See https://github.com/docker/for-linux/issues/72.
|
|
|
|
RUN find /var/lib/mysql -type f -exec touch {} \; && /etc/init.d/mysql start \
|
2015-11-12 20:28:56 -05:00
|
|
|
&& echo "GRANT ALL ON druid.* TO 'druid'@'%' IDENTIFIED BY 'diurd'; CREATE database druid DEFAULT CHARACTER SET utf8;" | mysql -u root \
|
|
|
|
&& /etc/init.d/mysql stop
|
|
|
|
|
|
|
|
# Add Druid jars
|
|
|
|
ADD lib/* /usr/local/druid/lib/
|
2014-11-06 13:23:24 -05:00
|
|
|
|
2018-10-20 21:18:58 -04:00
|
|
|
# Download the MySQL Java connector
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils libmysql-java
|
|
|
|
RUN ln -sf /usr/share/java/mysql-connector-java.jar /usr/local/druid/lib/mysql-connector-java.jar
|
|
|
|
|
2014-11-06 13:23:24 -05:00
|
|
|
# Add sample data
|
2018-02-07 14:19:25 -05:00
|
|
|
# touch is needed because OverlayFS's copy-up operation breaks POSIX standards. See https://github.com/docker/for-linux/issues/72.
|
|
|
|
RUN find /var/lib/mysql -type f -exec touch {} \; && service mysql start \
|
2018-08-30 12:56:26 -04:00
|
|
|
&& java -cp "/usr/local/druid/lib/*" -Ddruid.metadata.storage.type=mysql org.apache.druid.cli.Main tools metadata-init --connectURI="jdbc:mysql://localhost:3306/druid" --user=druid --password=diurd \
|
2015-11-12 20:28:56 -05:00
|
|
|
&& /etc/init.d/mysql stop
|
2014-11-06 13:23:24 -05:00
|
|
|
ADD sample-data.sql sample-data.sql
|
2018-02-07 14:19:25 -05:00
|
|
|
# touch is needed because OverlayFS's copy-up operation breaks POSIX standards. See https://github.com/docker/for-linux/issues/72.
|
|
|
|
RUN find /var/lib/mysql -type f -exec touch {} \; && service mysql start \
|
2015-11-12 20:28:56 -05:00
|
|
|
&& cat sample-data.sql | mysql -u root druid \
|
|
|
|
&& /etc/init.d/mysql stop
|
2014-11-06 13:23:24 -05:00
|
|
|
|
|
|
|
# Setup supervisord
|
|
|
|
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
|
2018-09-19 12:56:15 -04:00
|
|
|
# mysql
|
|
|
|
ADD run-mysql.sh /run-mysql.sh
|
|
|
|
|
2018-02-07 16:06:06 -05:00
|
|
|
# internal docker_ip:9092 endpoint is used to access Kafka from other Docker containers
|
|
|
|
# external docker ip:9093 endpoint is used to access Kafka from test code
|
2015-11-12 20:28:56 -05:00
|
|
|
# run this last to avoid rebuilding the image every time the ip changes
|
|
|
|
ADD docker_ip docker_ip
|
2018-09-19 12:56:15 -04:00
|
|
|
RUN perl -pi -e "s/#listeners=.*/listeners=INTERNAL:\/\/172.172.172.2:9092,EXTERNAL:\/\/172.172.172.2:9093/" /usr/local/kafka/config/server.properties
|
|
|
|
RUN perl -pi -e "s/#advertised.listeners=.*/advertised.listeners=INTERNAL:\/\/172.172.172.2:9092,EXTERNAL:\/\/$(cat docker_ip):9093/" /usr/local/kafka/config/server.properties
|
2018-02-07 16:06:06 -05:00
|
|
|
RUN perl -pi -e "s/#listener.security.protocol.map=.*/listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT\ninter.broker.listener.name=INTERNAL/" /usr/local/kafka/config/server.properties
|
|
|
|
RUN perl
|
2014-11-06 13:23:24 -05:00
|
|
|
|
2018-09-19 12:56:15 -04:00
|
|
|
# Add directory with TLS support files
|
|
|
|
ADD tls tls
|
|
|
|
|
|
|
|
ADD client_tls client_tls
|
|
|
|
|
2014-11-06 13:23:24 -05:00
|
|
|
# Expose ports:
|
2018-09-19 12:56:15 -04:00
|
|
|
# - 8081, 8281: HTTP, HTTPS (coordinator)
|
|
|
|
# - 8082, 8282: HTTP, HTTPS (broker)
|
|
|
|
# - 8083, 8283: HTTP, HTTPS (historical)
|
|
|
|
# - 8090, 8290: HTTP, HTTPS (overlord)
|
|
|
|
# - 8091, 8291: HTTP, HTTPS (middlemanager)
|
2018-10-24 19:31:52 -04:00
|
|
|
# - 8888-8891, 9088-9091: HTTP, HTTPS (routers)
|
2014-11-06 13:23:24 -05:00
|
|
|
# - 3306: MySQL
|
|
|
|
# - 2181 2888 3888: ZooKeeper
|
2018-09-19 12:56:15 -04:00
|
|
|
# - 8100 8101 8102 8103 8104 8105 : peon ports
|
|
|
|
# - 8300 8301 8302 8303 8304 8305 : peon HTTPS ports
|
|
|
|
EXPOSE 8081 8281
|
|
|
|
EXPOSE 8082 8282
|
|
|
|
EXPOSE 8083 8283
|
|
|
|
EXPOSE 8090 8290
|
|
|
|
EXPOSE 8091 8291
|
2014-11-06 13:23:24 -05:00
|
|
|
EXPOSE 3306
|
|
|
|
EXPOSE 2181 2888 3888
|
2018-09-19 12:56:15 -04:00
|
|
|
EXPOSE 8100 8101 8102 8103 8104 8105
|
|
|
|
EXPOSE 8300 8301 8302 8303 8304 8305
|
|
|
|
EXPOSE 9092 9093
|
2015-11-12 20:28:56 -05:00
|
|
|
|
2014-11-06 13:23:24 -05:00
|
|
|
WORKDIR /var/lib/druid
|
2018-09-19 12:56:15 -04:00
|
|
|
ENTRYPOINT export HOST_IP="$(resolveip -s $HOSTNAME)" && /tls/generate-server-certs-and-keystores.sh && exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|