-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1 WIP: added a Dockerfile; also update the logging to print to stder…
…r messages during container startup. stdout prints messages according to its own buffer setting.
- Loading branch information
Showing
7 changed files
with
219 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
#/* | ||
# * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. | ||
# * | ||
# * Permission is hereby granted, free of charge, to any person obtaining a | ||
# * copy of this software and associated documentation files (the "Software"), | ||
# * to deal in the Software without restriction, including without limitation | ||
# * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
# * and/or sell copies of the Software, and to permit persons to whom the | ||
# * Software is furnished to do so, subject to the following conditions: | ||
# * | ||
# * The above copyright notice and this permission notice shall be included in | ||
# * all copies or substantial portions of the Software. | ||
# * | ||
# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
# * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
# * DEALINGS IN THE SOFTWARE. | ||
# * | ||
# */ | ||
debug_mode=$(echo $DEBUG) | ||
gateway_listen_queue=${GATEWAY_LISTEN_QUEUE:-ipc://@nginx_queue_listen} | ||
|
||
mkdir -p /var/log/api-gateway | ||
|
||
# ldd /usr/local/sbin/api-gateway-zmq-adaptor | ||
|
||
echo "Starting ZeroMQ adaptor ..." | ||
zmq_port=$(echo $ZMQ_PUBLISHER_PORT) | ||
# use -d flag to start API Gateway ZMQ adaptor in debug mode to print all messages sent by the GW | ||
zmq_adaptor_cmd="api-gateway-zmq-adaptor -b ${gateway_listen_queue}" | ||
if [[ -n "${zmq_port}" ]]; then | ||
echo "... ZMQ will publish messages on:" ${zmq_port} | ||
zmq_adaptor_cmd="${zmq_adaptor_cmd} -p ${zmq_port}" | ||
fi | ||
if [ "${debug_mode}" == "true" ]; then | ||
echo " ... in DEBUG mode " | ||
zmq_adaptor_cmd="${zmq_adaptor_cmd} -d" | ||
fi | ||
|
||
echo "Running "$zmq_adaptor_cmd | ||
$zmq_adaptor_cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# apigateway-zmq-adaptor | ||
# | ||
# VERSION 0.1.0 | ||
# | ||
# From https://hub.docker.com/_/alpine/ | ||
# | ||
FROM alpine:latest | ||
|
||
ENV ZMQ_VERSION 4.0.5 | ||
ENV CZMQ_VERSION 2.2.0 | ||
ENV ZMQ_ADAPTOR_VERSION 0.1.1 | ||
|
||
RUN apk update \ | ||
&& apk add \ | ||
gcc tar libtool zlib make musl-dev openssl-dev g++ zlib-dev curl \ | ||
&& echo " ... adding ZMQ and CZMQ" \ | ||
&& curl -L http://download.zeromq.org/zeromq-${ZMQ_VERSION}.tar.gz -o /tmp/zeromq.tar.gz \ | ||
&& cd /tmp/ \ | ||
&& tar -xf /tmp/zeromq.tar.gz \ | ||
&& cd /tmp/zeromq*/ \ | ||
&& ./configure --prefix=/usr \ | ||
--sysconfdir=/etc \ | ||
--mandir=/usr/share/man \ | ||
--infodir=/usr/share/info \ | ||
&& make && make install \ | ||
&& curl -L http://download.zeromq.org/czmq-${CZMQ_VERSION}.tar.gz -o /tmp/czmq.tar.gz \ | ||
&& cd /tmp/ \ | ||
&& tar -xf /tmp/czmq.tar.gz \ | ||
&& cd /tmp/czmq*/ \ | ||
&& ./configure --prefix=/usr \ | ||
--sysconfdir=/etc \ | ||
--mandir=/usr/share/man \ | ||
--infodir=/usr/share/info \ | ||
&& make && make install \ | ||
&& rm -rf /tmp/zeromq* && rm -rf /tmp/czmq* \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& echo " ... installing api-gateway-zmq-adaptor" \ | ||
&& curl -L https://github.com/adobe-apiplatform/api-gateway-zmq-adaptor/archive/${ZMQ_ADAPTOR_VERSION}.tar.gz -o /tmp/api-gateway-zmq-adaptor-${ZMQ_ADAPTOR_VERSION} \ | ||
&& apk update \ | ||
&& apk add check-dev \ | ||
&& cd /tmp/ \ | ||
&& tar -xf /tmp/api-gateway-zmq-adaptor-${ZMQ_ADAPTOR_VERSION} \ | ||
&& cd /tmp/api-gateway-zmq-adaptor-* \ | ||
&& make test \ | ||
&& mkdir -p /usr/local/sbin \ | ||
&& PREFIX=/usr/local/sbin make install \ | ||
&& rm -rf /tmp/api-gateway-zmq-adaptor-* \ | ||
&& apk del check-dev \ | ||
&& apk del gcc tar libtool make musl-dev openssl-dev g++ zlib-dev curl \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
RUN apk update \ | ||
&& apk add libgcc libstdc++ | ||
|
||
# --- DEV ONLY --- | ||
# RUN apk update \ | ||
# && apk add \ | ||
# gcc tar libtool zlib make musl-dev openssl-dev g++ zlib-dev curl \ | ||
# && apk add check-dev | ||
# COPY src /tmp/api-gateway-zmq-adaptor-${ZMQ_ADAPTOR_VERSION}/src | ||
# COPY tests /tmp/api-gateway-zmq-adaptor-${ZMQ_ADAPTOR_VERSION}/tests | ||
# COPY Makefile /tmp/api-gateway-zmq-adaptor-${ZMQ_ADAPTOR_VERSION}/Makefile | ||
# RUN cd /tmp/api-gateway-zmq-adaptor-* \ | ||
# && make test \ | ||
# && mkdir -p /usr/local/sbin \ | ||
# && PREFIX=/usr/local/sbin make install \ | ||
# && rm -rf /tmp/api-gateway-zmq-adaptor-* | ||
# ------------------ | ||
|
||
COPY Docker-init.sh /etc/init-container.sh | ||
ONBUILD COPY init.sh /etc/init-container.sh | ||
|
||
# volume to expose IPC sockets | ||
# http://api.zeromq.org/4-1:zmq-ipc | ||
VOLUME /var/run/api-gateway-zmq-adaptor | ||
|
||
ENTRYPOINT ["/etc/init-container.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters