Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jul 21, 2017
2 parents c7765f3 + 44a176f commit 9ab2be8
Show file tree
Hide file tree
Showing 13 changed files with 233 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install:
- .travis/gen-ssl.sh mariadb.example.com tmp
- export PROJ_PATH=`pwd`
- export SSLCERT=$PROJ_PATH/tmp
# - export SSLCERT=C:/projects/ssl
# - set SSLCERT=C:/projects/ssl
- export ENTRYPOINT=$PROJ_PATH/.travis/sql

cache:
Expand Down
10 changes: 0 additions & 10 deletions .travis/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
version: '2'
services:
maxscale:
depends_on:
- db
ports:
- 4007:4007
- 4008:4008
build:
context: .
dockerfile: maxscale/Dockerfile
db:
image: $DB
command: --max-allowed-packet=$PACKET --innodb-log-file-size=$INNODB_LOG_FILE_SIZE --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --ssl-ca=/etc/sslcert/ca.crt --ssl-cert=/etc/sslcert/server.crt --ssl-key=/etc/sslcert/server.key --bind-address=0.0.0.0
Expand All @@ -17,7 +8,6 @@ services:
volumes:
- $SSLCERT:/etc/sslcert
- $ENTRYPOINT:/docker-entrypoint-initdb.d

environment:
MYSQL_DATABASE: testj
MYSQL_ALLOW_EMPTY_PASSWORD: 1
25 changes: 25 additions & 0 deletions .travis/maxscale-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '2'
services:
maxscale:
depends_on:
- db
ports:
- 4006:4006
- 4007:4007
- 4008:4008
build:
context: .
dockerfile: maxscale/Dockerfile
args:
MAXSCALE_VERSION: $MAXSCALE_VERSION
db:
image: $DB
command: --max-allowed-packet=$PACKET --innodb-log-file-size=$INNODB_LOG_FILE_SIZE --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --ssl-ca=/etc/sslcert/ca.crt --ssl-cert=/etc/sslcert/server.crt --ssl-key=/etc/sslcert/server.key --bind-address=0.0.0.0
ports:
- 3305:3306
volumes:
- $SSLCERT:/etc/sslcert
- $ENTRYPOINT:/docker-entrypoint-initdb.d
environment:
MYSQL_DATABASE: testj
MYSQL_ALLOW_EMPTY_PASSWORD: 1
31 changes: 17 additions & 14 deletions .travis/maxscale/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
FROM asosso/maxscale:1.4.3
FROM centos:7

# bring system up2date
#RUN yum update -y
RUN yum -y install MariaDB-client
ARG MAXSCALE_VERSION
ENV MAXSCALE_VERSION ${MAXSCALE_VERSION:-2.1.4}

# We copy our config creator script to the container
COPY maxscale/docker-entrypoint.sh /
COPY maxscale/cmd.sh /usr/bin/
COPY maxscale/mariadb.repo /etc/yum.repos.d/

RUN rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB \
&& yum -y install https://downloads.mariadb.com/MaxScale/$MAXSCALE_VERSION/centos/7/x86_64/maxscale-$MAXSCALE_VERSION-1.centos.7.x86_64.rpm \
&& yum -y update

RUN yum -y install maxscale-$MAXSCALE_VERSION MariaDB-client \
&& yum clean all \
&& rm -rf /tmp/*

COPY maxscale/docker-entrypoint.sh /
RUN chmod 777 /etc/maxscale.cnf
COPY maxscale/maxscale.cnf /etc/
RUN chmod 777 /docker-entrypoint.sh
RUN chmod 777 /usr/bin/cmd.sh

# We expose our set Listener Ports
EXPOSE 4006 4007

# We define the config creator as entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 4006 4007 4008

# We startup MaxScale as default command
CMD ["/usr/bin/cmd.sh"]
ENTRYPOINT ["/docker-entrypoint.sh"]
30 changes: 0 additions & 30 deletions .travis/maxscale/cmd.sh

This file was deleted.

129 changes: 25 additions & 104 deletions .travis/maxscale/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,114 +1,35 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

config_file="/etc/maxscale.cnf"
echo 'creating configuration done'

# We start config file creation
sleep 15

cat <<EOF > $config_file
#################################################################################################
# wait for db availability for 60s
#################################################################################################
mysql=( mysql --protocol=tcp -ubob -hdb --port=3306 )
for i in {60..0}; do
if echo 'use test2' | "${mysql[@]}" &> /dev/null; then
break
fi
echo 'DB init process in progress...'
sleep 1
done

echo 'use test2' | "${mysql[@]}"
if [ "$i" = 0 ]; then
echo 'DB init process failed.'
exit 1
fi

[maxscale]
threads=2
log_messages=1
log_trace=1
log_debug=1
echo 'maxscale launching ...'

[db]
type=server
address=db
port=3306
protocol=MySQLBackend
authenticator_options=skip_authentication=true
router_options=master
tail -n 500 /etc/maxscale.cnf

[Galera Monitor]
type=monitor
module=mysqlmon
servers=db
user=boby
passwd=hey
monitor_interval=1000
/usr/bin/maxscale --nodaemon

[qla]
type=filter
module=qlafilter
options=/tmp/QueryLog
[fetch]
type=filter
module=regexfilter
match=fetch
replace=select
[hint]
type=filter
module=hintfilter
[Write Connection Router]
type=service
router=readconnroute
servers=db
user=boby
passwd=hey
router_options=master
localhost_match_wildcard_host=1
version_string=10.2.99-MariaDB-maxscale
[Read Connection Router]
type=service
router=readconnroute
servers=db
user=boby
passwd=hey
router_options=synced
localhost_match_wildcard_host=1
version_string=10.2.99-MariaDB-maxscale
[RW Split Router]
type=service
router=readwritesplit
servers=db
user=boby
passwd=hey
max_slave_connections=100%
localhost_match_wildcard_host=1
router_options=disable_sescmd_history=true
version_string=10.2.99-MariaDB-maxscale
[CLI]
type=service
router=cli
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4006
socket=/var/lib/maxscale/rwsplit.sock
[Write Connection Listener]
type=listener
service=Write Connection Router
protocol=MySQLClient
port=4007
socket=/var/lib/maxscale/writeconn.sock
[Read Connection Listener]
type=listener
service=Read Connection Router
protocol=MySQLClient
port=4008
socket=/var/lib/maxscale/readconn.sock
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
socket=/tmp/maxadmin.sock
EOF

echo 'creating configuration'
exec "$@"
cd /var/log/maxscale
ls -lrt
tail -n 500 /var/log/maxscale/maxscale.log
7 changes: 7 additions & 0 deletions .travis/maxscale/mariadb.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# MariaDB 10.2 CentOS repository list - created 2017-06-05 08:06 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Loading

0 comments on commit 9ab2be8

Please sign in to comment.