Skip to content

Commit

Permalink
Creating docker compose for the whole suite, replacing Kafka image.
Browse files Browse the repository at this point in the history
  • Loading branch information
rootpd committed Jun 8, 2017
1 parent da6c9c6 commit 617d7ca
Show file tree
Hide file tree
Showing 21 changed files with 183 additions and 179 deletions.
95 changes: 0 additions & 95 deletions Beam/docker-compose.yml

This file was deleted.

21 changes: 0 additions & 21 deletions Beam/docker/kafka/Dockerfile

This file was deleted.

17 changes: 0 additions & 17 deletions Beam/docker/nginx/nginx.conf

This file was deleted.

15 changes: 0 additions & 15 deletions Beam/docker/telegraf/Dockerfile

This file was deleted.

Binary file not shown.
20 changes: 0 additions & 20 deletions Campaign/Dockerfile

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions Campaign/docker/php/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
xdebug.remote_enable=on
xdebug.remote_autostart=on
xdebug.remote_connect_back=off
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/var/www/html"
xdebug.remote_port=9000
11 changes: 11 additions & 0 deletions Docker/kafka/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM spotify/kafka

RUN apt-get update

RUN apt-get -y install net-tools

ADD create-topics.sh .

ADD kafka-start.sh .

CMD ["./kafka-start.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ START_TIMEOUT=600
start_timeout_exceeded=false
count=0
step=10
while netstat -lnt | awk '$4 ~ /:'$KAFKA_ADVERTISED_PORT'$/ {exit 1}'; do
while netstat -lnt | awk '$4 ~ /:'$ADVERTISED_PORT'$/ {exit 1}'; do
echo "waiting for kafka to be ready"
sleep $step;
count=$(expr $count + $step)
Expand All @@ -20,8 +20,8 @@ if $start_timeout_exceeded; then
exit 1
fi

if [[ -n $KAFKA_CREATE_TOPICS ]]; then
IFS=','; for topicToCreate in $KAFKA_CREATE_TOPICS; do
if [[ -n $CREATE_TOPICS ]]; then
IFS=','; for topicToCreate in $CREATE_TOPICS; do
echo "creating topics: $topicToCreate"
IFS=':' read -a topicConfig <<< "$topicToCreate"
if [ ${topicConfig[3]} ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

echo "Starting kafka"
create-topics.sh &
/start.sh
./create-topics.sh &
supervisord -n
33 changes: 33 additions & 0 deletions Docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
server {
listen 80;
server_name campaign.remp.app;

root /var/www/html/Campaign/public;

location / {
try_files $uri /index.php$is_args$args;
}

location ~ ^/.+\.php(/|$) {
fastcgi_pass campaign:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

server {
listen 80;
server_name mailer.remp.app;

root /var/www/html/Mailer/www;

location / {
try_files $uri /index.php$is_args$args;
}

location ~ ^/.+\.php(/|$) {
fastcgi_pass mailer:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
9 changes: 8 additions & 1 deletion Beam/Dockerfile → Docker/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ FROM php:7.1-fpm
RUN apt-get update && apt-get install -y git libzip-dev \
&& docker-php-ext-install -j$(nproc) pdo_mysql bcmath mbstring iconv zip

ADD docker/php/log.conf /usr/local/etc/php-fpm.d/zz-log.conf
RUN pecl install xdebug
ENV XDEBUGINI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
RUN echo "zend_extension="`find /usr/local/lib/php/extensions/ -iname 'xdebug.so'` > $XDEBUGINI_PATH
COPY xdebug.ini /tmp/xdebug.ini
RUN cat /tmp/xdebug.ini >> $XDEBUGINI_PATH
RUN echo "xdebug.remote_host="`/sbin/ip route|awk '/default/ { print $3 }'` >> $XDEBUGINI_PATH

ADD log.conf /usr/local/etc/php-fpm.d/zz-log.conf

ENV COMPOSER_HOME /composer

Expand Down
2 changes: 2 additions & 0 deletions Docker/php/log.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
php_admin_flag[log_errors] = on
php_flag[display_errors] = off
7 changes: 7 additions & 0 deletions Docker/php/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
xdebug.remote_enable=on
xdebug.remote_autostart=on
xdebug.remote_connect_back=off
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/var/www/html"
xdebug.remote_port=9000
5 changes: 5 additions & 0 deletions Docker/telegraf/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM telegraf:1.3

ADD dockerize-alpine-linux-amd64-v0.4.0.tar.gz .

CMD ["./dockerize", "-timeout", "1m", "-wait-retry-interval", "10s", "-wait", "tcp://kafka:2181", "-wait", "tcp://kafka:9092", "telegraf"]
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

[[inputs.kafka_consumer]]
topics = ["beam_events"]
zookeeper_peers = ["zookeeper:2181"]
zookeeper_peers = ["kafka:2181"]
zookeeper_chroot = ""
consumer_group = "beam_consumers"
offset = "oldest"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Restarting Telegraf after topic is ready (it's created automatically) helps.
are able to work with shared volumes properly.

```
VBoxManage.exe sharedfolder add default --automount --name "d/gospace" --hostpath "\\?\d:\gospace"
VBoxManage.exe sharedfolder add default --automount --name "cygdrive/d/gospace" --hostpath "\\?\d:\gospace"
VBoxManage.exe sharedfolder add default --automount --name 'd/gospace' --hostpath '\\?\d:\gospace'
VBoxManage.exe sharedfolder add default --automount --name 'cygdrive/d/gospace' --hostpath '\\?\d:\gospace'
```

The first command has to be run always. The second needs to be used only when you want to use CygWin instead of default MinGW.
38 changes: 36 additions & 2 deletions after.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,48 @@
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.

echo "Adding extra sources"
if [ ! -f /etc/apt/sources.list.d/influxdb.list ]; then
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update
fi
if ! grep "apt.dockerproject.org" -r /etc/apt > /dev/null; then
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
fi

echo "Verifying Docker installation"
if ! type docker > /dev/null; then
sudo apt-get install -y docker-engine
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker $(whoami) # vyzera, ze nefunguje dobre
fi

echo "Verifying InfluxDB installation"
if ! type influx > /dev/null; then
sudo apt-get -y install influxdb
sudo systemctl enable influxd
sudo systemctl start influxd
fi

echo "Verifying Kafka installation"
if ! dir /usr/local/kafka > /dev/null
then
if ! dir /usr/local/kafka > /dev/null; then
sudo apt-get update
sudo apt-get -y install default-jre zookeeperd
wget http://tux.rainside.sk/apache/kafka/0.10.2.0/kafka_2.12-0.10.2.0.tgz
tar xvf kafka_2.12-0.10.2.0.tgz
sudo mv kafka_2.12-0.10.2.0 /usr/local/kafka
echo "/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties" | tee /home/vagrant/kafka-start.sh
chmod +x /home/vagrant/kafka-start.sh
fi

echo "Verifying Telegraf installation"
if ! type telegraf > /dev/null; then
sudo apt-get -y install telegraf
sudo systemctl enable telegraf
sudo systemctl start telegraf
fi
Loading

0 comments on commit 617d7ca

Please sign in to comment.