Page
Create The Stones system
Create The Stones system
Now it's time to create The Stones system. To create this system, we will do the following:
- Create a MariaDB database instance.
- Build and populate the database.
- Create The Stones data access layer.
- Create The Stones web application.
Create a MariaDB instance
Run the following command to create an ephemeral instance of a MariaDB 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 --labels=app.kubernetes.io/part-of=thestones,systemname=thestones,tier=database,database=mariadb,thestones=database,sandbox=labels,dbtype=persistent
Because this instance is persistent, all tables and data will not be destroyed when the pod is scaled to zero, the opposite of an ephemeral instance.
Build and populate the database
Move into your ‘rsalbums’ directory and run the following command:
If using a Bash shell
./build_and_populate.sh
If using Powershell:
./build_and_populate.ps1
You should expect output much like this:
C:\rsalbums> .\build_and_populate.ps1
True
Copying files to pod…
Creating tables…
Populating tables…
Proof query…
Create The Stones data access layer
Run the following commands to create the data access app:
oc new-app --image=quay.io/rhdevelopers/rsgetalbumslist:latest --name=rsgetalbumslist --labels=app.kubernetes.io/part-of=thestones,systemname=thestones,tier=dataaccess,language=python3,thestones=dataaccess,sandbox=labels
Create The Stones web app
Run the following commands to create the web app:
oc new-app openshift/nginx:1.20-ubi8~https://github.com/redhat-developer-demos/thestones --labels=app.kubernetes.io/part-of=thestones,systemname=thestones,tier=frontend,language=html,thestones=frontend,sandbox=labels
oc expose service/thestones
Congratulations. The Stones system is up and running. Next up? The Countries system.