Page
Create the Countries system
Now let's create the countries system.
Create the Countries system
Create the Countries system using the following steps:
- Create a MariaDB database instance.
- Build and populate the database.
- Create the Countries data access layer.
- Create Country Viewer web app.
Create a MariaDB database instance
Run the following command to create an ephemeral instance of a MariaDB database:
oc new-app --template=mariadb-persistent --param DATABASE_SERVICE_NAME=countries --param MYSQL_USER=countries --param MYSQL_PASSWORD=countries --param MYSQL_DATABASE=countries --param MYSQL_ROOT_PASSWORD=countries --labels=app.kubernetes.io/part-of=countries,systemname=countries,tier=database,database=mariadb,countries=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 countriesdb
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:\rsalbumsdb> .\build_and_populate.ps1
True
Copying files to pod
Creating tables
Populating tables
Proof query
Create the Countries data access layer
oc new-app https://github.com/redhat-developer-demos/getcountrieslist --labels=app.kubernetes.io/part-of=countries,systemname=countries,tier=dataaccess,language=go,countries=dataaccess,sandbox=labels
Create the Countries Viewer web application
oc new-app --image=quay.io/rhdevelopers/countryui:latest --name=countryui --labels=app.kubernetes.io/part-of=countries,systemname=countries,tier=frontend,language=rails,countries=frontend,sandbox=labels
oc expose service/countryui
Congratulations. You have created the Countries system. It's time to move to the last lesson in this path: 4 Systems and 13 parts