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

MySQL galera (petset for OCP 3.4) #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
49 changes: 49 additions & 0 deletions plugins.d/mysql-galera.local.plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

__mysql_galera_project=mysql-galera
__mysql_user=user
__mysql_password=password
__mysql_database=userdb
__mysql_root_password=secret

function mysql-galera.describe {
echo "Instance a mysql-galera on a sample project"
}

function mysql-galera.help {
:
}

function mysql-galera.install {

oc new-project ${__mysql_galera_project} --description='MySQL Galera Project' --display-name='mysql-galera'

for __template in mariadb-galera-ephemeral-template.yml mariadb-galera-persistent-template.yml
do
oc create -f https://raw.githubusercontent.com/adfinis-sygroup/openshift-mariadb-galera/master/${__template} -n ${__mysql_galera_project}
done

oc new-app --template mariadb-galera-persistent \
-p NUMBER_OF_GALERA_MEMBERS=3 \
-p MYSQL_USER=${__mysql_user} \
-p MYSQL_PASSWORD=${__mysql_password} \
-p MYSQL_DATABASE=${__mysql_database} \
-p MYSQL_ROOT_PASSWORD=${__mysql_root_password}

oc new-app adminer
oc expose svc/adminer

__adminer_url=$(oc get route adminer -o jsonpath='http://{.spec.host}')

echo "now access to "${__adminer_url}"?server=galera with user=root and password="${__mysql_root_password}" to manage galera cluster"

}

function mysql-galera.uninstall {

oc delete project ${__mysql_galera_project}

}

mysql-galera.describe