Skip to content

Commit

Permalink
Merge pull request #1524 from GiganticMinecraft/feat/init-sql-dump
Browse files Browse the repository at this point in the history
feat: DBのinitContainerで本番環境のダンプファイルを取得して適用する
  • Loading branch information
inductor authored Dec 17, 2023
2 parents 8aefe40 + 3d24f86 commit 3bccd53
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ kind: MariaDB
metadata:
name: mariadb
spec:
initContainers:
- image: mariadb:10.11.6
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: mariadb-pr-review-password
key: prod-mariadb-password
volumeMounts:
- name: sqldump-volume
mountPath: /docker-entrypoint-initdb.d
args:
- "sh"
- "-c"
- 'mysqldump -umcserver -p${DB_PASSWORD} -h192.168.2.186 --databases seichiassist flyway_managed_schema > /docker-entrypoint-initdb.d/seichiassist.sql'

rootPasswordSecretKeyRef:
name: mariadb-pr-review-password
key: root-password
Expand Down Expand Up @@ -30,5 +46,13 @@ spec:
accessModes:
- ReadWriteOnce

volumeMounts:
- name: sqldump-volume
mountPath: /docker-entrypoint-initdb.d

service:
type: ClusterIP

volumes:
- name: sqldump-volume
emptyDir: {}
1 change: 1 addition & 0 deletions terraform/onp_cluster_secrets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ resource "helm_release" "onp_minecraft__pr_review_mariadb_password" {
data:
root-password: ""
mcserver-password: ""
prod-mariadb-password: ${base64encode(var.minecraft__prod_game_db__password)}
EOS
]
}
Expand Down

0 comments on commit 3bccd53

Please sign in to comment.