diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb58dee --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +data diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..8444737 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +read -p "\$DATA directory: " DATA_DIRECTORY +REALDIR=$(readlink -f "${DATA_DIRECTORY}") +mkdir -p "${DATA_DIRECTORY}" +mkdir "${DATA_DIRECTORY}/conf" "${DATA_DIRECTORY}/cert" "${DATA_DIRECTORY}/mysql" +chown 1001:1001 "${DATA_DIRECTORY}/cert" "${DATA_DIRECTORY}/mysql" +docker run --rm -v "${REALDIR}"/cert:/cert percona/percona-xtradb-cluster:8.0 mysql_ssl_rsa_setup -d /cert diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..08ec416 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +--- +services: + percona: + image: percona/percona-xtradb-cluster:${PERCONA_VERSION} + restart: unless-stopped + environment: + - CLUSTER_NAME=${PERCONA_CLUSTER_NAME} + - MYSQL_ROOT_PASSWORD=${PERCONA_ROOT_PASSWORD} + hostname: ${PERCONA_HOSTNAME} + ports: + - 3306:3306/tcp + - 4444:4444/tcp + - 4567:4567/tcp + - 4567:4567/udp + - 4568:4568/tcp + volumes: + - ${PERCONA_DATA}/cert:/cert + - ${PERCONA_DATA}/config:/etc/percona-xtradb-cluster.conf.d + - ${PERCONA_DATA}/mysql:/var/lib/mysql diff --git a/example.custom.cnf b/example.custom.cnf new file mode 100644 index 0000000..615126c --- /dev/null +++ b/example.custom.cnf @@ -0,0 +1,15 @@ +[mysqld] +ssl-ca = /cert/ca.pem +ssl-cert = /cert/server-cert.pem +ssl-key = /cert/server-key.pem + +[client] +ssl-ca = /cert/ca.pem +ssl-cert = /cert/client-cert.pem +ssl-key = /cert/client-key.pem + +[sst] +encrypt = 4 +ssl-ca = /cert/ca.pem +ssl-cert = /cert/server-cert.pem +ssl-key = /cert/server-key.pem diff --git a/example.env b/example.env new file mode 100644 index 0000000..14f6024 --- /dev/null +++ b/example.env @@ -0,0 +1,5 @@ +PERCONA_VERSION=8.0 +PERCONA_DATA=./data +PERCONA_HOSTNAME=pcx +PERCONA_CLUSTER_NAME=percona +PERCONA_ROOT_PASSWORD=r00t diff --git a/example.mysqld.cnf b/example.mysqld.cnf new file mode 100644 index 0000000..59c6fe4 --- /dev/null +++ b/example.mysqld.cnf @@ -0,0 +1,6 @@ +wsrep_provider=/usr/lib/galera4/libgalera_smm.so +wsrep_cluster_name=percona +wsrep_cluster_address=gcomm://192.168.10.11,192.168.10.12,192.168.10.13 +wsrep_node_name=pxc1 +wsrep_node_address=192.168.10.11 +pxc_strict_mode=ENFORCING