nextjs

by Mhm0ud114

Helm chartv0.2.3App 1.0.0MITVerified publisher

A Helm chart for Kubernetes

About this chart

moleculer helm package

This package will help you simply deploy yor moleculer app on GKE.

This chart bootstraps an moleculer app deployment on a GKE cluster using the Helm package manager.

Prerequisites

  • GKE cluster v1.19+
  • Global static IP name
  • DNS point to the IP address that created before, you can create a DNS record if you host your domain name in GCloud using the following steps
  • Your app image URL that you want to deploy

Get Repo Info

helm repo add moleculer https://mhm0ud.github.io/helm-charts
helm repo update

Install Chart

Important: only helm3 is supported

helm install [RELEASE_NAME] helm-charts/moleculer

The command deploys moleculer on the Kubernetes cluster in the default configuration.

See configuration below.

See helm install for command documentation.

Uninstall Chart

helm uninstall [RELEASE_NAME]

This removes all the Kubernetes components associated with the chart and deletes the release.

See helm uninstall for command documentation.

Upgrading Chart

helm upgrade [RELEASE_NAME] [CHART] --install

See helm upgrade for command documentation.

Configuration

See Customizing the Chart Before Installing. To see all configurable options with detailed comments, visit the chart's values.yaml, or run these configuration commands:

helm show values helm-charts/moleculer

Container Name

You'll need to set the following value:

container.name

Static IP Name Key

GlobalStaticIPNameKey tells the Ingress controller to use a specific GCE static ip for its forwarding rules.

You'll need to set the following value:

ingress.annotations."kubernetes\.io/ingress\.global-static-ip-name"="STATIC_IP_NAME"

and it's will annotate the ingress as shown in the gce-ingress:

kind: 'Ingress'
metadata:
  name: 'ingress'
  labels:
    name: ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: 'STATIC_IP_NAME'

Domain Name

Hosts tells the Ingress controller to use a specific DNS ip for its forwarding rules.

You'll need to set the following value:

ingress.hosts[0].host="api.example.com"

Image Repository URL

This will define your application image repo URL.

You'll need to set the following value:

image.repository

P.S. image.repository="mhm0ud/moleculer"

Image Tag

You'll need to set the following value:

image.tag

P.S. image.tag="latest"

Service Name

You shaould include which services you need to deploy in this conatiner.

P.S. you have four services (api, service1, service2, service3), then you'll need to set the following value:

container.services="{api,service1,service2,service3}"

CRON Job Configuration

If you have a cron and you need to run it, you need to specify it in this value:

cron.enabled

P.S. You have one cron job, you need to set the following values:

cron.enabled=true cron.list[0].name=cron1 cron.list[0].schedule="*/5 * * * *" cron.list[0].command=products.updateAll

This feature is disabled by default since 0.1.9

Secrets

If you need to add secrets to your cluster, you'll need to set the following value:

environment.secret.[YOUR_SECRET_NAME]

P.S. environment.secret.MONGO_URI=MONGO_URL

Environment Variables

If you need to add environment variables to your cluster, you'll need to set the following value:

environment.env.[YOUR_ENVIRONMENT_VARIABLES_NAME]

P.S. environment.env.NAMESPACE="NAMESPACE"

Deploy nextjs with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nextjs 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 chartnextjs is pinned at v0.2.3 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