mariadb clean setup
This commit is contained in:
48
.idea/dataSources.xml
generated
48
.idea/dataSources.xml
generated
@@ -2,18 +2,13 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
<data-source source="LOCAL" name="sql.xai-corp.net" uuid="50d1cd4d-852c-4d57-bd9b-ccf70b0f652a">
|
<data-source source="LOCAL" name="sql.xai-corp.net" uuid="50d1cd4d-852c-4d57-bd9b-ccf70b0f652a">
|
||||||
<driver-ref>mysql.8</driver-ref>
|
<driver-ref>mariadb</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<remarks>nextcloud</remarks>
|
<remarks>nextcloud</remarks>
|
||||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
<jdbc-url>jdbc:mysql://sql.xai-corp.net:3306/nextcloud2</jdbc-url>
|
<jdbc-url>jdbc:mariadb://sql.xai-corp.net:3306/nextcloud2</jdbc-url>
|
||||||
<driver-properties>
|
<driver-properties>
|
||||||
<property name="autoReconnect" value="true" />
|
<property name="autoReconnect" value="true" />
|
||||||
<property name="zeroDateTimeBehavior" value="CONVERT_TO_NULL" />
|
|
||||||
<property name="tinyInt1isBit" value="false" />
|
|
||||||
<property name="characterEncoding" value="utf8" />
|
|
||||||
<property name="characterSetResults" value="utf8" />
|
|
||||||
<property name="yearIsDateType" value="false" />
|
|
||||||
</driver-properties>
|
</driver-properties>
|
||||||
</data-source>
|
</data-source>
|
||||||
<data-source source="LOCAL" name="xaicorp_default@sql.xai-corp.net" uuid="24a224c6-845c-41ce-9c9d-fa5d54f7b87e">
|
<data-source source="LOCAL" name="xaicorp_default@sql.xai-corp.net" uuid="24a224c6-845c-41ce-9c9d-fa5d54f7b87e">
|
||||||
@@ -23,5 +18,42 @@
|
|||||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||||
<jdbc-url>jdbc:postgresql://sql.xai-corp.net:5432/xaicorp_default</jdbc-url>
|
<jdbc-url>jdbc:postgresql://sql.xai-corp.net:5432/xaicorp_default</jdbc-url>
|
||||||
</data-source>
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="xaicorp_default@sql.xai-corp.net local" uuid="2dd6b8bb-81be-4efe-85d5-3e791d168891">
|
||||||
|
<driver-ref>postgresql</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<remarks>production postgres database</remarks>
|
||||||
|
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:postgresql://localhost:5432/xaicorp_default</jdbc-url>
|
||||||
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="sql.xai-corp.net local" uuid="b398ddb0-97ff-48d5-9ed0-8001beaf3957">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<remarks>nextcloud</remarks>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://localhost:3306/nextcloud2</jdbc-url>
|
||||||
|
<driver-properties>
|
||||||
|
<property name="autoReconnect" value="true" />
|
||||||
|
</driver-properties>
|
||||||
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="sql.xai-corp.net local [root]" uuid="389f3c5e-cdad-4cff-b51e-8ae7a354efbc">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<remarks>nextcloud</remarks>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://localhost:3306/</jdbc-url>
|
||||||
|
<driver-properties>
|
||||||
|
<property name="autoReconnect" value="true" />
|
||||||
|
</driver-properties>
|
||||||
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="mariadb: sql.xai-corp.net [root]" uuid="5962de05-d06a-473e-9b19-c373fe78f3fa">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<remarks>root connection to mariadb</remarks>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://localhost:3307/</jdbc-url>
|
||||||
|
<driver-properties>
|
||||||
|
<property name="autoReconnect" value="true" />
|
||||||
|
</driver-properties>
|
||||||
|
</data-source>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -18,7 +18,7 @@ fstab:
|
|||||||
# path: "/opt/shared"
|
# path: "/opt/shared"
|
||||||
# state: mounted
|
# state: mounted
|
||||||
- name: mariadb
|
- name: mariadb
|
||||||
path: "/opt/mariadb"
|
path: "/opt/data/db"
|
||||||
state: mounted
|
state: mounted
|
||||||
|
|
||||||
helm:
|
helm:
|
||||||
@@ -38,11 +38,19 @@ apps:
|
|||||||
stash:
|
stash:
|
||||||
state: present
|
state: present
|
||||||
namespace: stashapp
|
namespace: stashapp
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
enabled: false
|
|
||||||
namespace: mariadb
|
|
||||||
gitea:
|
|
||||||
enabled: true
|
enabled: true
|
||||||
|
namespace: mariadb
|
||||||
|
pvc: data-mariadb-0
|
||||||
|
state: present
|
||||||
|
secrets:
|
||||||
|
password: faj48290q2u58vy8qphqtqj
|
||||||
|
root_password: q4890qhhfgq9pfg3q4uyg33
|
||||||
|
replication_password: 4q389hq7gf8qo47gq8374g
|
||||||
|
|
||||||
|
gitea:
|
||||||
|
enabled: false
|
||||||
namespace: gitea
|
namespace: gitea
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,37 @@
|
|||||||
---
|
---
|
||||||
# mariadb values file
|
# Bitnami chart
|
||||||
|
# https://github.com/bitnami/charts/blob/main/bitnami/mariadb/values.yaml
|
||||||
secondary:
|
|
||||||
replicaCount: 0
|
|
||||||
|
|
||||||
|
architecture: standalone
|
||||||
image:
|
image:
|
||||||
# repository: mariadb
|
registry: docker.io
|
||||||
# tag: 10.5
|
repository: bitnami/mariadb
|
||||||
|
tag: 10.9
|
||||||
|
digest: ""
|
||||||
|
## Specify a imagePullPolicy
|
||||||
|
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||||
|
## ref: https://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||||
|
##
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
|
||||||
|
## MariaDB Authentication parameters
|
||||||
|
##
|
||||||
auth:
|
auth:
|
||||||
rootPassword: "aifuoqibcqobcqb3"
|
## @param auth.rootPassword Password for the `root` user. Ignored if existing secret is provided.
|
||||||
# existingSecret: ''
|
## ref: https://github.com/bitnami/containers/tree/main/bitnami/mariadb#setting-the-root-password-on-first-run
|
||||||
|
##
|
||||||
#primary:
|
# rootPassword: ""
|
||||||
# persistence:
|
## @param auth.database Name for a custom database to create
|
||||||
# existingClaim: mariadb-pv-claim
|
## ref: https://github.com/bitnami/containers/blob/main/bitnami/mariadb/README.md#creating-a-database-on-first-run
|
||||||
|
##
|
||||||
|
database: test
|
||||||
|
## @param auth.username Name for a custom user to create
|
||||||
|
## ref: https://github.com/bitnami/containers/blob/main/bitnami/mariadb/README.md#creating-a-database-user-on-first-run
|
||||||
|
##
|
||||||
|
username: "test"
|
||||||
|
## @param auth.password Password for the new user. Ignored if existing secret is provided
|
||||||
|
##
|
||||||
|
# password: ""
|
||||||
|
## @param auth.existingSecret Use existing secret for password details (`auth.rootPassword`, `auth.password`, `auth.replicationPassword` will be ignored and picked up from this secret). The secret has to contain the keys `mariadb-root-password`, `mariadb-replication-password` and `mariadb-password`
|
||||||
|
##
|
||||||
|
existingSecret: "mariadb-secrets"
|
||||||
|
|||||||
@@ -2,29 +2,43 @@
|
|||||||
#https://github.com/bitnami/charts/tree/master/bitnami/mariadb
|
#https://github.com/bitnami/charts/tree/master/bitnami/mariadb
|
||||||
|
|
||||||
|
|
||||||
- name: "todo: deploy mariadb"
|
|
||||||
debug:
|
|
||||||
msg: "TODO: write deployment tasks"
|
|
||||||
|
|
||||||
- name: Create a namespace for mariadb
|
- name: Create a namespace for mariadb
|
||||||
k8s:
|
k8s:
|
||||||
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
|
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
|
||||||
name: mariadb
|
name: "{{apps.mariadb.namespace}}"
|
||||||
api_version: v1
|
api_version: v1
|
||||||
kind: Namespace
|
kind: Namespace
|
||||||
state: present
|
state: "{{apps.mariadb.state}}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: create persistent volume resources
|
- name: create persistent volume resources
|
||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
|
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
|
||||||
state: present
|
state: "{{apps.mariadb.state}}"
|
||||||
definition: "{{ lookup('template', item) | from_yaml }}"
|
definition: "{{ lookup('template', item) | from_yaml }}"
|
||||||
loop:
|
loop:
|
||||||
- mariadb/pv.yaml
|
- mariadb/pv.yaml
|
||||||
- mariadb/pv-claim.yaml
|
- mariadb/pv-claim.yaml
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
|
- name: create secret for mariadb
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
|
||||||
|
state: "{{apps.mariadb.state}}"
|
||||||
|
definition:
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
type: Opaque
|
||||||
|
metadata:
|
||||||
|
name: mariadb-secrets
|
||||||
|
namespace: "{{apps.mariadb.namespace}}"
|
||||||
|
stringData:
|
||||||
|
mariadb-password: "{{apps.mariadb.secrets.password}}"
|
||||||
|
mariadb-root-password: "{{apps.mariadb.secrets.root_password}}"
|
||||||
|
mariadb-replication-password: "{{apps.mariadb.secrets.replication_password}}"
|
||||||
|
become: true
|
||||||
|
|
||||||
- name: Install mariadb globally available
|
- name: Install mariadb globally available
|
||||||
block:
|
block:
|
||||||
- name: Add mariadb chart helm repo
|
- name: Add mariadb chart helm repo
|
||||||
@@ -41,9 +55,9 @@
|
|||||||
- name: Install mariadb Release
|
- name: Install mariadb Release
|
||||||
local_action:
|
local_action:
|
||||||
module: kubernetes.core.helm
|
module: kubernetes.core.helm
|
||||||
release_state: present
|
release_state: "{{apps.mariadb.state}}"
|
||||||
name: "{{apps.mariadb.namespace}}"
|
name: mariadb
|
||||||
namespace: mariadb
|
namespace: "{{apps.mariadb.namespace}}"
|
||||||
create_namespace: yes
|
create_namespace: yes
|
||||||
update_repo_cache: True
|
update_repo_cache: True
|
||||||
chart_ref: bitnami/mariadb
|
chart_ref: bitnami/mariadb
|
||||||
|
|||||||
@@ -16,8 +16,9 @@
|
|||||||
- name: deploy stash
|
- name: deploy stash
|
||||||
include_tasks: deployments/stash.yaml
|
include_tasks: deployments/stash.yaml
|
||||||
|
|
||||||
#- name: deploy mariadb
|
- name: deploy mariadb
|
||||||
# include_tasks: deployments/mariadb.yaml
|
include_tasks: deployments/mariadb.yaml
|
||||||
|
when: apps.mariadb.enabled
|
||||||
|
|
||||||
- name: deploy gitea
|
- name: deploy gitea
|
||||||
include_tasks: deployments/gitea.yaml
|
include_tasks: deployments/gitea.yaml
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: "{{apps.mariadb.namespace}}"
|
name: "{{apps.mariadb.pvc}}"
|
||||||
namespace: mariadb
|
namespace: "{{apps.mariadb.namespace}}"
|
||||||
spec:
|
spec:
|
||||||
storageClassName: manual
|
storageClassName: manual
|
||||||
accessModes:
|
accessModes:
|
||||||
@@ -13,5 +13,5 @@ spec:
|
|||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
hostPath:
|
hostPath:
|
||||||
path: "/opt/mariadb"
|
path: "/opt/data/db/mariadb-10.9"
|
||||||
|
|
||||||
@@ -9,7 +9,8 @@ services:
|
|||||||
mysql:
|
mysql:
|
||||||
image: "mariadb:10.5"
|
image: "mariadb:10.5"
|
||||||
volumes:
|
volumes:
|
||||||
- /opt/mariadb/data:/var/lib/mysql
|
- /opt/data/mariadb/data:/var/lib/mysql
|
||||||
|
# - /opt/mariadb/data:/var/lib/mysql
|
||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
environment:
|
environment:
|
||||||
@@ -38,5 +39,5 @@ services:
|
|||||||
fluentd-async-connect: 'true'
|
fluentd-async-connect: 'true'
|
||||||
tag: mariadb
|
tag: mariadb
|
||||||
|
|
||||||
networks:
|
# networks:
|
||||||
- prod_db
|
# - prod_db
|
||||||
|
|||||||
Reference in New Issue
Block a user