-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Muller
committed
Apr 27, 2017
1 parent
bcab7b8
commit 7536fbb
Showing
6 changed files
with
123 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
mariadb-production: | ||
# don't use :latest on production deployments | ||
image: 'pukoren/mariadb-galera:latest' | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=password | ||
- MYSQL_DATABASE=db1 | ||
# use at least 3 containers for HA deployments | ||
target_num_containers: 3 | ||
deployment_strategy: high_availability | ||
# if you want to expose ports to the internet | ||
ports: | ||
- '3306:3306' | ||
# if you want to persist data on host machine | ||
volumes: | ||
- '/data/mysql:/data' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: '3' | ||
|
||
services: | ||
mariadb-production: | ||
# don't use :latest tag on production deployments | ||
image: 'pukoren/mariadb-galera:latest' | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=password | ||
- MYSQL_DATABASE=db1 | ||
deploy: | ||
# always use at least 3 containers for HA deployments | ||
replicas: 3 | ||
update_config: | ||
# there should always be at least 1 container UP until another one rejoin the cluster | ||
# otherwise you will have downtimes | ||
parallelism: 2 | ||
delay: 30s | ||
networks: | ||
- galera | ||
ports: | ||
- '3306:3306' | ||
# if you want to persist data on host machine | ||
volumes: | ||
- '/data/mysql:/data' | ||
|
||
networks: | ||
galera: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mariadb | ||
labels: | ||
app: mariadb | ||
spec: | ||
ports: | ||
- name: mariadb | ||
port: 3306 | ||
selector: | ||
app: mariadb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
apiVersion: apps/v1beta1 | ||
kind: StatefulSet | ||
metadata: | ||
name: mariadb | ||
spec: | ||
serviceName: "mariadb" | ||
# use at least 3 for HA deployments | ||
replicas: 3 | ||
template: | ||
metadata: | ||
labels: | ||
app: mariadb | ||
spec: | ||
terminationGracePeriodSeconds: 30 | ||
containers: | ||
- name: mariadb | ||
imagePullPolicy: Always | ||
# don't use latest on production deployments | ||
image: pukoren/mariadb-galera:latest | ||
ports: | ||
- containerPort: 3306 | ||
name: mariadb | ||
volumeMounts: | ||
- name: mariadb-data | ||
mountPath: /var/lib/mysql | ||
env: | ||
# root password for the cluster | ||
- name: MYSQL_ROOT_PASSWORD | ||
value: 'password' | ||
# default database | ||
- name: MYSQL_DATABASE | ||
value: 'db1' | ||
|
||
# always redeploy one at a time | ||
readinessProbe: | ||
failureThreshold: 5 | ||
tcpSocket: | ||
port: 3306 | ||
initialDelaySeconds: 30 | ||
periodSeconds: 10 | ||
livenessProbe: | ||
tcpSocket: | ||
port: 3306 | ||
initialDelaySeconds: 30 | ||
periodSeconds: 10 | ||
volumes: | ||
- name: mariadb-data | ||
emptyDir: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters