https://github.com/redhat-developer-demos/rsalbums
Database to hold data about Rolling Stones albums
https://github.com/redhat-developer-demos/rsalbums
Last synced: 3 months ago
JSON representation
Database to hold data about Rolling Stones albums
- Host: GitHub
- URL: https://github.com/redhat-developer-demos/rsalbums
- Owner: redhat-developer-demos
- License: apache-2.0
- Created: 2023-09-29T15:27:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-02T17:33:19.000Z (over 1 year ago)
- Last Synced: 2025-01-23T07:47:53.659Z (5 months ago)
- Language: Shell
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Part of the Red Hat Developer learning path entitled "Using Red Hat OpenShift labels"
## Create MariaDB Persistent database
`oc new-app --template=mariadb-persistent --param DATABASE_SERVICE_NAME=rsalbums --param MYSQL_USER=rsalbums --param MYSQL_PASSWORD=rsalbums --param MYSQL_DATABASE=rsalbums --param MYSQL_ROOT_PASSWORD=rsalbums`
## Get name of pod into environment variable
### PowerShell
`(kubectl get pods | select-string '^rsalbums([^\s]+)-(?!deploy)') -match 'rsalbums([^\s]+)'; $podname = $matches[0]`## Upload file(s) to create and populate table(s)
### PowerShell
`oc cp .\create_table_rsalbums.sql ${podname}:/tmp/create_table_rsalbums.sql``oc cp .\create_table_rsalbumstracks.sql ${podname}:/tmp/create_table_rsalbumstracks.sql`
`oc cp .\create_table_rsalbums.sh ${podname}:/tmp/create_table_rsalbums.sh`
`oc cp .\create_table_rsalbumstracks.sh ${podname}:/tmp/create_tablersalbums_tracks.sh`
`oc cp .\rsalbums.csv ${podname}:/tmp/rsalbums.csv`
`oc cp .\rsalbumstracks.csv ${podname}:/tmp/rsalbumstracks.csv`
`oc cp .\populate_table_rsalbums_POWERSHELL.sql ${podname}:/tmp/populate_table_rsalbums_POWERSHELL.sql`
`oc cp .\populate_table_rsalbums_POWERSHELL.sh ${podname}:/tmp/populate_table_rsalbums_POWERSHELL.sh`
#### Execute command(s) in pod to create table(s)
`oc exec ${podname} -- /bin/bash /tmp/create_table_rsalbums.sh`
`oc exec ${podname} -- /bin/bash /tmp/create_table_rsalbumstracks.sh``oc exec ${podname} -- /bin/bash /tmp/populate_table_rsalbums_POWERSHELL.sh`
`oc exec ${podname} -- /bin/bash /tmp/populate_table_rsalbums_POWERSHELL.sh`
`oc cp .\populate_table_rsalbumstracks_POWERSHELL.sql ${podname}:/tmp/populate_table_rsalbumstracks_POWERSHELL.sql`
`oc cp .\populate_table_rsalbumstracks_POWERSHELL.sh ${podname}:/tmp/populate_table_rsalbumstracks_POWERSHELL.sh`
`oc exec ${podname} -- /bin/bash /tmp/populate_table_rsalbumstracks_POWERSHELL.sh`
`oc cp .\proof_query.sql ${podname}:/tmp/proof_query.sql`
`oc cp .\proof_query.sh ${podname}:/tmp/proof_query.sh`
`oc exec ${podname} -- /bin/bash /tmp/proof_query.sh`
#### Upload JSON file (cotaining data) to pod
#### Import data into database tables
#### Run query to prove success