0

I have a NodeJS API that sits behind a Nginx reverse proxy and connects to a Redis instance. To deploy this on to OpenShift cluster, I need the following:

I am not sure if OpenShift Operators and Helm Charts are the right choice - they sound like an overkill (or, are they?). Then, there are YAML based installations e.g. Strimzi on OpenShift.

Given a OpenShift cluster with oc installed, perhaps, there is yet another way; where, all of the following commands are wrapped in a shell script.

git clone https://github.com/me/nodejsapi
oc new-project awesome
# Trigger S2I for NodeJS
cd nodejsapi
oc new-app .
# New applications with nginx image
oc import ...
# New applications with redis image
oc import ...
# New config map set-up through [OpenShift APIs][6]
curl ...

Can you please advise the suitable approach to install the NodeJS application and others?

cogitoergosum
  • 2,309
  • 4
  • 38
  • 62

2 Answers2

1

If you ask me creating an Operator for this is overkill. Using a Helm chart is more of the correct abstraction. The easiest solution on OpenShift is to to use a Template.

bjartek
  • 929
  • 1
  • 5
  • 11
  • Thanks for the endorsement! ;-) The helm chart would still have to be hosted on `helm.sh` is it? If you won't mind, can you please help me with an example of OpenShift Template? This example (https://docs.openshift.com/container-platform/4.2/openshift_images/using-templates.html#templates-writing_using-templates) isn't very easy to understand. :-D – cogitoergosum Oct 19 '19 at 02:21
  • I think you can use a local helmchart as well. No need to host them on helm.sh if you do not want to. As for a template for your example: nginx: https://github.com/omarmohsen/openshift-nginx-template/blob/master/nginx-template-rhel7.yaml nodejs: https://github.com/sclorg/nodejs-ex/blob/master/openshift/templates/nodejs.json redis: https://github.com/openshift/origin/blob/master/examples/db-templates/redis-persistent-template.json Try to combine all these into a single template, if you really need there to be only a single template. – bjartek Oct 19 '19 at 13:37
  • 1
    I would advice you to read that page you linked to from start to finish to learn more about templates. A Template will replace all ${VALUE} placeholders with values from the parameters that you send in. Note that a parameter can be generated for you or it can have a default value. – bjartek Oct 19 '19 at 13:48
0

For me if your app need many pods with different technologies, the right choice is helm chart. But, if you don’t want use it, an alternative is to use a deployment file in yaml or json. Here an example for SQL Server 2019 https://github.com/chauuy/sqlserver.git

Note: a template file is also available to add SQL Server ephemeral (without persistent storage) as new component like MySQL etc...

Chris Hess
  • 129
  • 3