https://github.com/redhat-developer-demos/quotemysql
MariaDB database of Quotes to be run inside Kubernetes; part of Kubernetes By Example on Developer Sandbox for Red Hat OpenShift
https://github.com/redhat-developer-demos/quotemysql
Last synced: about 1 year ago
JSON representation
MariaDB database of Quotes to be run inside Kubernetes; part of Kubernetes By Example on Developer Sandbox for Red Hat OpenShift
- Host: GitHub
- URL: https://github.com/redhat-developer-demos/quotemysql
- Owner: redhat-developer-demos
- License: apache-2.0
- Created: 2021-06-03T14:58:20.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-09T15:53:37.000Z (over 1 year ago)
- Last Synced: 2025-04-08T06:51:09.997Z (over 1 year ago)
- Language: PowerShell
- Size: 17.6 KB
- Stars: 1
- Watchers: 2
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
To create the mariadb database:
`kubectl apply -f mysql-secret.yaml`
`kubectl apply -f mysqlvolume.yaml`
`kubectl apply -f mysql-deployment.yaml`
To create and populate the table "quotes":
PowerShell:
`$a = (kubectl get pods | select-string 'mysql') -match 'mysql([^\s]+)'; $podname = $matches[0]`
`kubectl cp ./create_database_quotesdb.sql ${podname}:/tmp/create_database_quotesdb.sql`
`kubectl cp ./create_database.sh ${podname}:/tmp/create_database.sh`
`kubectl exec deploy/mysql -- /bin/bash ./tmp/create_database.sh`
`kubectl cp ./create_table_quotes.sql ${podname}:/tmp/create_table_quotes.sql`
`kubectl cp ./create_tables.sh ${podname}:/tmp/create_tables.sh`
`kubectl exec deploy/mysql -- /bin/bash ./tmp/create_tables.sh`
`kubectl cp ./populate_table_quotes.sql ${podname}:/tmp/populate_table_quotes_POWERSHELL.sql`
`kubectl cp ./quotes.csv ${podname}:/tmp/quotes.csv`
`kubectl cp ./populate_tables.sh ${podname}:/tmp/populate_tables_POWERSHELL.sh`
`kubectl exec deploy/mysql -- /bin/bash ./tmp/populate_tables.sh`
`kubectl cp ./query_table_quotes.sql ${podname}:/tmp/query_table_quotes.sql`
`kubectl cp ./query_table_quotes.sh ${podname}:/tmp/query_table_quotes.sh`
`kubectl exec deploy/mysql -- /bin/bash ./tmp/query_table_quotes.sh`
(or simply run ./build_database.ps1)
Bash:
`export PODNAME=$(a=$(kubectl get pods | grep 'mysql') && set -- $a && echo $1)`
`kubectl cp ./create_database_quotesdb.sql $PODNAME:/tmp/create_database_quotesdb.sql`
`kubectl cp ./create_database.sh $PODNAME:/tmp/create_database.sh`
`kubectl exec deploy/mysql -- /bin/bash ./tmp/create_database.sh`
`kubectl cp ./create_table_quotes.sql $PODNAME:/tmp/create_table_quotes.sql`
`kubectl cp ./create_tables.sh $PODNAME:/tmp/create_tables.sh`
`kubectl exec deploy/mysql -- /bin/bash ./tmp/create_tables.sh`
`kubectl cp ./populate_table_quotes.sql $PODNAME:/tmp/populate_table_quotes_BASH.sql`
`kubectl cp ./quotes.csv $PODNAME:/tmp/quotes.csv`
`kubectl cp ./populate_tables.sh $PODNAME:/tmp/populate_tables_BASH.sh`
`kubectl exec deploy/mysql -- /bin/bash ./tmp/populate_tables.sh`
`kubectl cp ./query_table_quotes.sql $PODNAME:/tmp/query_table_quotes.sql`
`kubectl cp ./query_table_quotes.sh $PODNAME:/tmp/query_table_quotes.sh`
`kubectl exec deploy/mysql -- /bin/bash ./tmp/query_table_quotes.sh`