nodejs

by joaquinito2051

Helm chartv0.0.2

A Helm chart to build and deploy Node.js applications

About this chart

Node.js Helm Chart

A Helm chart for building and deploying a Node.js application on OpenShift.

Prerequisites

Below are prerequisites that may apply to your use case.

Push Secret

You will need to create a push secret if you want to push your image to an external registry. Use the following command as a reference to create your push secret:

oc create secret docker-registry my-push-secret --docker-server=$SERVER_URL --docker-username=$USERNAME --docker-password=$PASSWORD --docker-email=$EMAIL

You can use this secret by passing --set build.output.pushSecret=my-push-secret and --set build.output.kind=DockerImage to helm install, or you can configure these in a values file:

build:
  output:
    kind: DockerImage
    pushSecret: my-push-secret

Values

This section describes the Values used to configure this chart.

Below is a table the values used to configure this chart.

ValueDescriptionDefaultAdditional Information
image.nameName of the image you want to build/deployDefaults to the Helm release name.The chart will create/reference an ImageStream based on this value.
image.tagTag that you want to build/deploylatestThe chart will create/reference an ImageStreamTag based on the name provided
build.enabledDetermines if build-related resources should be created.trueSet this to false if you want to deploy a previously built image. Leave this set to true if you want to build and deploy a new image.
build.uriGit URI that references your git repohttps://github.com/nodeshift-starters/nodejs-rest-httpThis value defaults to a sample application. Be sure to override this if you want to build and deploy your own application.
build.refGit ref containing the application you want to buildmain-
build.contextDirThe sub-directory where the application source code exists--
build.output.kindDetermines if the image will be pushed to an ImageStreamTag or a DockerImage (external registry)ImageStreamTagMore information: More information: https://docs.openshift.com/container-platform/4.6/builds/managing-build-output.html
build.output.pushSecretPush secret name-Used only if build.output.kind == 'DockerImage'
build.pullSecretImage pull secret-More information: https://docs.openshift.com/container-platform/4.6/openshift_images/managing_images/using-image-pull-secrets.html
build.envFreeform env stanza-More information: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
build.resourcesFreeform resources stanza-More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
deploy.replicasNumber of pod replicas to deploy1-
deploy.resourcesFreeform resources stanza-More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
deploy.serviceTypeType of service to createClusterIPMore information: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
deploy.portsFreeform service ports stanza.See values.yamlMore information: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
deploy.route.enabledDetermines if a Route should be createdtrueAllows clients outside of OpenShift to access your application
deploy.route.targetPortThe port that the Route should target traffic tohttp-
deploy.route.tls.enabledDetermines if the Route should be TLS-encryptedtrueMore information: https://docs.openshift.com/container-platform/4.6/networking/routes/secured-routes.html
deploy.route.tls.terminationDetermines the type of TLS termination to useedgeOptions: edge, reencrypt, passthrough
deploy.route.tls.insecureEdgeTerminationPolicyDetermines if insecure traffic should be redirectedRedirectOptions: "Allow", "Disable", "Redirect"
deploy.route.tls.keyProvides key file contents-This is a secret. Do not check this value into git.
deploy.route.tls.caCertificateProvides the cert authority certificate contents--
deploy.route.tls.certificateProvides certificate contents--
deploy.route.tls.destinationCACertificateProvides the destination CA Certificate for reencrypt routes--
deploy.livenessProbeFreeform livenessProbe stanza.See values.yamlMore information: https://docs.openshift.com/container-platform/4.6/applications/application-health.html#application-health-about_application-health
deploy.readinessProbeFreeform readinessProbe stanza.See values.yamlMore information: https://docs.openshift.com/container-platform/4.6/applications/application-health.html#application-health-about_application-health
deploy.envFreeform env stanza-More information: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
deploy.envFromFreeform envFrom stanza-More information: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables
deploy.volumeMountsFreeform volume mounts-More information: https://kubernetes.io/docs/concepts/storage/volumes/
deploy.volumesFreeform volumes-More information: https://kubernetes.io/docs/concepts/storage/volumes/
deploy.initContainersFreeform init containers-More information: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
deploy.extraContainersFreeform containers-More information: https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates
global.nameOverrideOverrides the release name-Resources are named after the release name. Set this value if you want to override the release name.

Deploy nodejs with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nodejs on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartnodejs is pinned at v0.0.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply