Now we want to containerize the Gochat app. If you are using the CLI on your own computer, you could use the docker command. However, if you are in the Wetty terminal, remember you are actually in a container. We could have exposed the container socket on the host to your Wetty container. However, this would break the security model.
Fortunately we can build from a Dockerfile using the oc command line tool. For those on your own computer, we recommend trying it this way as well.
Create a new project for your containerized gochat application.
oc new-project gochat-container-userYOUR#
Start a new build from the Dockerfile in the gochat-container repository.
oc new-build https://github.com/kevensen/gochat-client-container -e CHAT_SERVER=gochat-server.gochat-server.svc.cluster.local:8080
Watch the deployment
oc logs -f bc/gochat-client-container
Then ctrl-c once you’ve had enough.
oc new-app gochat-client-container
oc expose svc gochat-client-container
As in the previous lab, we must annotate the service account for the Gochat Client to communicate to the OpenShift API for user credential verification.
oc annotate sa/default serviceaccounts.openshift.io/oauth-redirectreference.1='{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"gochat-client-container"}}' --overwrite
oc annotate sa/default serviceaccounts.openshift.io/oauth-redirecturi.1=auth/callback/openshift --overwrite
Go back to the OpenShift WebUI and click on the “gochat” URL.
Click the blue “Login” button.
Log in to the app with your OpenShift credentials. The workshop moderator will provide you with the URL, your username, and password.Send a message.
Yay
Domain | ||
Workshop | ||
Student ID |