Deploy Database For Villain Microservice
Last updated
Last updated
Right click in view area then select Container image menu.
Enter following inputs as a screenshot below:
Image name from external registry: registry.redhat.io/rhel9/postgresql-13
Runtime icon: postgresql
Application: Create application
Application Name: villains-service
Name: villains-db
Scroll down to to bottom of the page, then Uncheck "Create a route" checkbox. And then click on Deployment link.
Click Add value link to add more input fields of environment variables
Enter following environment variables. Then click on Labels link.
POSTGRESQL_USER: superbad
POSTGRESQL_PASSWORD: superbad
POSTGRESQL_DATABASE: villains_database
Enter system=quarkus-super-heroes
then click Create button.
A new villains-db
PostgreSQL instance should be created. Wait for awhile unti it's up and running.
Click on the Web Terminal icon located on top right corner of web console. Wait for a few moment, you should see a terminal shows up.
Use curl
command to download SQL script.
Sample output:
Use psql
(PostgreSQL client) to connect to the villains-db
PostgreSQL server. The password is superbad
.
Sample output:
Execute the SQL script with this command:
Sample output:
Use \dt
command to check if a new table gets created.
Sample output:
Query number of rows in the table.
Sample output:
Use \q
command to disconnect from PostgreSQL server.
How to deploy PostgreSQL database service container from external container registry, in this case, Red Hat Registry (can be Docker Hub or other registries as well) with following settings:
Application icon and name
Environment variables for application container
User-defined label