OpenShift
This tutorial refers to a version of Alf.io (1.x) which is now EOL. Please help us updating it!
Your OpenShift instance
To get started, just locally install minishift from the OpenShift community edition OKD.io - it’s great for testing! (You may want to slightly increase resources from the default via minishift config set memory 4096; minishift config set cpus 4
.)
Alternatively, use the Container Development Kit (CDK) from Red Hat or Get Started and Create a FREE ;-) Account on OpenShift.com Online, or use an OpenShift Partner’s cloud.
Obtain the OC CLI
Whatever your OpenShift cluster is, it’s easiest to use the oc
CLI Client tool to deploy Alf.io; it’s available e.g. on okd.io/download.
Deploy Alf.io on OpenShift using OC
Once you have oc
locally available, and you have obtained an OpenShift Login Token from the Copy Login Command on the menu in the upper right corner under your name in the OpenShift Console’s UI, you only have to do the following simple steps to deploy Alf.io:
oc login https://... --token=...
oc new-project alf-io
oc apply -f https://raw.githubusercontent.com/alfio-event/alf.io/1.x-maintenance/etc/OpenShift/openshift.yaml
oc start-build alfio
oc logs -f bc/alfio
When this Build (bc
) is finished, the Deployment (dc
) of a Pod with the Container will automatically start.
You’ll then need to check its log to find the generated admin credentials and get the URL via oc status
.
When using Minishift it will be ...nip.io
so you’ll open https://alfio-demo.192.168.42.145.nip.io/admin#/.
oc logs dc/alfio
oc status
NB: This uses OpenShift’s PostgreSQL (from here), but does NOT use the Alf.io container images from DockerHub. Instead it builds a container from source using OpenShift’s S2I Java Builder feature, thanks to this project’s configuration in .s2i/. Check out this blog post (which is also here) to learn more about how to use S2I with Java 11 & Gradle on OpenShift.
HTTPS Security
To use TLS on a Route with a custom Hostname, use openshift-acme which will automagically add a Cert from Let’s Encrypt as soon as you add the metadata: annotations: kubernetes.io/tls-acme: "true"
to your Route.
Postgres database alternative
Instead of the containerized Postgres which the YAML (above) sets up on your OpenShift, you could also consider using an external managed Postgres as a Service, e.g. from https://www.elephantsql.com. (You’ll want to deploy your ElephantSQL instance as close as possible to your OpenShift cluster in order to reduce latency.)
Credits
this tutorial has been written by vorburger