Deploy application on OpenShift cluster
Deploy application on OpenShift cluster
Deploying the application via OC CLI
In this section, we will try to deploy a multier application to OpenShift Cluster. The application architecture is as follows

- Create a cluster admin account
rosa create admin -c rosa-lab
Note: Please save this account information to use login to OpenShift cluster through Red Hat HybridCloud Console

- Open the cluster and open Open console to login with the created cluster account.

- Select **Log in with htpasswd1

- Complete login

- Login to cluster on CLI
oc login [CLUSTER_URL] --username [ADMIN_USER] --password [ADMIN_PASSWORD]

- Check project list
oc projects

- Use git clone Repository

- Create new application via CLI
oc new-project rosa-voting-app

- Allow the default service account of the rosa-voting-app project to run the container without root privileges
- In this example, we will run with the user with uid=1001
oc adm policy add-scc-to-user nonroot -z default -n rosa-voting-app

- Create a temporary PostgreSQL database (ephemeral)
oc process postgresql-ephemeral -n openshift \
-p DATABASE_SERVICE_NAME=db \
-p POSTGRESQL_USER=postgres \
-p POSTGRESQL_PASSWORD=postgres \
-p POSTGRESQL_DATABASE=postgres | oc apply -f - -n rosa-voting-app

- Create a temporary Redis server (ephemeral)
oc process redis-ephemeral -n openshift \
-p REDIS_PASSWORD=redis | oc apply -f - -n rosa-voting-app

- Deploy services, routes, and image streams available in the example source code
oc apply -f openshift-specifications/ -n rosa-voting-app

- Create DeploymentConfig and BuildConfig using Dockerfile
oc apply -f openshift-specifications/with-dockerfile -n rosa-voting-app

- Run the following commands to build the image. DeploymentConfig will be triggered when the build is complete.
oc start-build result
oc start-build vote
oc start-build worker

- Check the status of the created services and try to access the service vote and result
oc status

- Submit your choice in the service vote…

- Corresponding changes will be viewable in the service result

- View project on the console.
