Skip to main content
Version: 6.1.0

Docker & Kubernetes

Nodesource provides N|Solid Docker images based on both Alpine and Debian, supporting LTS versions: hydrogen (Node.js 18), iron (Node.js 20), and jod (Node.js 22). These images are available on Docker Hub.


Docker Images

Alpine-based Image

nodesource/nsolid:alpine-latest

Debian-based Image

nodesource/nsolid:latest

Using N|Solid Docker Images

Pulling the Images

The default image is Debian-based:

docker pull nodesource/nsolid:latest

Connecting to N|SOLID UI

To connect the containerized process to N|SOLID UI, you must set the NSOLID_SAAS environment variable.

important

Use a vault to securely store your secrets.

Examples

Command Line

docker run -it \
-e NSOLID_APPNAME="Sample App" \
-e NSOLID_TAGS="production,nextjs,nsolid-jod" \
-e NSOLID_SAAS=${NSOLID_TOKEN} \
nodesource/nsolid:latest

Docker Compose

version: "3.8"
services:
nsolid:
image: nodesource/nsolid:latest
restart: always
environment:
- NSOLID_APPNAME=Sample App
- NSOLID_TAGS=production,nextjs,nsolid-hydrogen
- NSOLID_SAAS=${NSOLID_TOKEN}
ports:
- "3000:3000"

Deploying on Kubernetes

In addition to using Docker directly or via Docker Compose, you can deploy N|Solid in a Kubernetes cluster. A comprehensive example, including a Next.js application build and basic Kubernetes configuration to deploy the N|Solid Enterprise version of Node.js, is available in the nsolid-kubernetes repository.

Kubernetes Deployment Overview

The Kubernetes configuration includes:

  • Deployment YAML: Defines the N|Solid deployment with environment variables and secrets.
  • Service YAML: Exposes the deployment within the cluster.
  • Ingress YAML: Provides external access to the service.
  • Secrets: Manage sensitive values (such as NSOLID_SAAS).

Sample Kubernetes Deployment Manifest

apiVersion: apps/v1
kind: Deployment
metadata:
name: nsolid-deployment
labels:
app: nsolid
spec:
replicas: 2
selector:
matchLabels:
app: nsolid
template:
metadata:
labels:
app: nsolid
spec:
securityContext:
runAsNonRoot: true
containers:
- name: nsolid
image: nodesource/nsolid:latest
ports:
- containerPort: 3000
env:
- name: NSOLID_APPNAME
value: "Sample App"
- name: NSOLID_TAGS
value: "production,nextjs,nsolid-jod"
- name: NSOLID_SAAS
valueFrom:
secretKeyRef:
name: nsolid-saas-secret
key: nsolid_saas
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 10
periodSeconds: 5
terminationGracePeriodSeconds: 30

Creating the Kubernetes Secret

Before deploying, create a secret for the NSOLID_SAAS value:

kubectl create secret generic nsolid-saas-secret --from-literal=nsolid_saas=${NSOLID_TOKEN}

How to Deploy

  1. Build Your Docker Image:
    Use GitHub Actions or build locally.

  2. Push the Image:
    Push the image to your container registry if deploying to a cloud cluster.

  3. Apply Kubernetes Manifests:
    Navigate to your Kubernetes configuration directory and apply the manifests:

    kubectl apply -f k8s/
  4. Monitor the Deployment:
    Verify the pods are running:

    kubectl get pods --namespace=default