liveBook · Manning

OpenShift Sandbox

As explained in Quarkus in Action

OpenShift Sandbox is a hosted OpenShift environment that provides temporary access to an OpenShift cluster for experimentation and testing.

OpenShift Sandbox is a free, shared OpenShift cluster for testing and development. It provides 14 GB of RAM and 40 GB of storage for 30 days, with the facilities needed to try a cloud deployment already installed. You can use it to move a Quarkus microservice application from local development into OpenShift without setting up a local cluster. section 11.6 section 11.3.4

To connect your workstation to the Sandbox:

  • Start the Sandbox from the Red Hat Developer site and sign in with a Red Hat Developer account. Creating an account is free and does not require a credit card. section 11.6.1
  • In the Hybrid Cloud Console, launch OpenShift and sign in with the DevSandbox account. Your assigned project is named <your-username>-dev; an OpenShift project is a namespace. section 11.6.1
  • Download the oc client for your operating system from the OpenShift console and place it on an executable path. From your profile, choose Copy login command, authenticate again, display the token, and run the provided command locally. section 11.6.1
$ oc login --token=TOKEN --server=SERVER
Logged into "SERVER" as "<username>" using the token provided.

The copied oc login command supplies a token and the Sandbox cluster’s server address; a successful response confirms local access. section 11.6.1

A Quarkus service needs the quarkus-openshift extension to generate OpenShift deployment resources. Add it with `quarkus ext add openshift` in each service being deployed. Configure OpenShift as the container-image builder, disable ServiceMonitor generation, and expose a route when the service must be reachable from outside the cluster. The s2i profile clears container-image registry, group, and tag settings for that build path. section 11.6.3 section 11.3.4

%s2i.quarkus.container-image.registry=
%s2i.quarkus.container-image.group=
%s2i.quarkus.container-image.tag=

quarkus.container-image.builder=openshift
quarkus.openshift.prometheus.generate-service-monitor=false
quarkus.openshift.route.expose=true

This configuration shows the shared settings applied to the car-rental services, including the s2i profile and public route. section 11.6.3

Before deploying several services together, replace `localhost` URLs: workloads communicate through OpenShift Service names. In the car-rental deployment, a call to the Reservation service uses `http://reservation-service`, because its Service maps the container port to external port 80. Set service URLs, database addresses, messaging hosts, and other environment-specific values through `quarkus.openshift.env.vars` so the generated manifests supply them at runtime. Applications used by a browser must reach Keycloak through its public route. section 11.6.3

Deploying the car-rental system

The deployment progresses from an Inventory service to five Quarkus car-rental services. Available scripts include `deploy-car-rental-s2i.sh` and `deploy-car-rental-oc.sh`; the full resource manifest can be applied with `oc apply -f car-rental/car-rental-full.yml`. After experimenting, remove the car-rental resources with `oc delete -f car-rental/car-rental-full.yml`; if s2i left build resources, clean those up with `oc delete all --all`. section 11.6.3 section 11.3.4

How Quarkus in Action covers it

How deep it goes
Walks through account access, oc login, service configuration, deployment, and cleanup, without detailing cluster administration.
Examples
Uses an Inventory service and a five-service car-rental deployment, with login, configuration, deployment, and cleanup commands.
What it assumes
Requires a Red Hat Developer account and a local oc executable; introduces the Sandbox login procedure before deploying prepared Quarkus services.
What you can do after
Operate/configure it to log in locally and deploy connected Quarkus services to the Sandbox.
How it connects
Connects OpenShift projects, the oc client, Quarkus OpenShift extension, Services, routes, and environment variables.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.