Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.5 #5

Open
wants to merge 26 commits into
base: 2.2.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: MAXSCALE CI
on:
push:
branches: 2.2.5
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
-
name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push to GHCRIO
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/comdata/maxscale:2.2.5
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>docker-maxscale</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM asosso/maxscale:2.2.5
FROM asosso/maxscale:1.4.5
MAINTAINER [email protected]

# Setup for Galera Service (GS), not for Master-Slave environments
Expand All @@ -21,12 +21,19 @@ ENV MAX_THREADS=4 \

# We copy our config creator script to the container
COPY docker-entrypoint.sh /
COPY getbackendservers.sh /
COPY healthcheck.sh /
#RUN chmod +x /getbackendservers.sh /healthcheck.sh


# We expose our set Listener Ports
EXPOSE $SPLITTER_PORT $ROUTER_PORT $CLI_PORT

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

HEALTHCHECK --interval=5s CMD /healthcheck.sh

# We startup MaxScale as default command
CMD ["/usr/bin/maxscale","--nodaemon"]
CMD ["/usr/bin/maxscale", "--nodaemon"]
#"--log=stdout",
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/toughiq/maxscale.svg)](https://hub.docker.com/r/toughiq/maxscale/)
[![](https://images.microbadger.com/badges/image/toughiq/maxscale.svg)](https://microbadger.com/images/toughiq/maxscale "Get your own image badge on microbadger.com")

# docker-maxscale
Dockerized MaxScale for Galera Cluster Backend.
Can be used in combination with https://github.com/toughIQ/docker-mariadb-cluster.

## Branches & Tags
There are 2 branches available, which feature __MaxScale1__ and __MaxScale2__ versions.

Since MaxScale1 is __free to use__, but MaxScale2 __needs a license from MariaDB__ in some setups, I will keep the __master__ branch with version 1.4.5 for now. This also applies to the __:latest__ tag in Docker.

| Version | Branch | Docker Tag |
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2'
services:
maxscale:
image: toughiq/maxscale:2
image: toughiq/maxscale:1
ports:
- 3306:3306
- 3307:3307
Expand Down
5 changes: 4 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

set -e


# if service discovery was activated, we overwrite the BACKEND_SERVER_LIST with the
# results of DNS service lookup
if [ -n "$DB_SERVICE_NAME" ]; then
BACKEND_SERVER_LIST=`getent hosts tasks.$DB_SERVICE_NAME|awk '{print $1}'|tr '\n' ' '`
BACKEND_SERVER_LIST=`/getbackendservers.sh`
fi

echo $BACKEND_SERVER_LIST >> /tmp/configuredbackservers


# We break our IP list into array
IFS=', ' read -r -a backend_servers <<< "$BACKEND_SERVER_LIST"

echo "Starting for backends: $BACKEND_SERVER_LIST"

config_file="/etc/maxscale.cnf"

Expand Down
2 changes: 2 additions & 0 deletions getbackendservers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
getent hosts tasks.$DB_SERVICE_NAME|awk '{print $1}'|sort|tr '\n' ' '
12 changes: 12 additions & 0 deletions healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

BACKEND_SERVER_LIST=`/getbackendservers.sh|xargs`
CONFIGURED_SERVER_LIST=`cat /tmp/configuredbackservers|xargs`

if [[ "$BACKEND_SERVER_LIST" == "$CONFIGURED_SERVER_LIST" ]]
then
exit 0
else
echo "$BACKEND_SERVER_LIST - $CONFIGURED_SERVER_LIST"
exit 1
fi