Deploy to Kubernetes

Kubernetes is a powerful open-source platform for orchestrating containerized applications, automating their deployment, scaling, and management. In this guide, we’ll leverage Helm, Kubernetes’ package manager, to streamline our deployment process.

Technical Overview

Deploy Univer backend services on Kubernetes involves several key components:

  • Kubernetes Cluster: The environment where your app resides.
  • Helm: The deployment and management tool for apps on Kubernetes. Require Helm 3.
  • Database and Messaging: PostgreSQL and RabbitMQ services.

Installing Helm

Head over to the Helm installation guide to get started. Once installed, confirm Helm’s presence by executing:

helm version

Deployment Steps

Kubernetes Cluster Setup

Make sure you have an active Kubernetes cluster. For cloud providers like Google Kubernetes Engine (GKE) or Amazon Elastic Kubernetes Service (EKS), adhere to their specific instructions for cluster creation.

Deploy Univer services

  1. Use Helm to deploy Univer services:
helm install univer --create-namespace \
--set global.istioNamespace=univer \
oci://univer-acr-registry.cn-shenzhen.cr.aliyuncs.com/helm-charts/univer-stack
 
kubectl rollout restart deployment/collaboration-server -n univer
kubectl rollout restart deployment/universer -n univer
  1. To check if your deployment is up and running:
kubectl get pods
  1. Deploy observability component
helm upgrade --install -n univer-observability --create-namespace \
--set global.univerNamespace="univer" \
univer-observability oci://univer-acr-registry.cn-shenzhen.cr.aliyuncs.com/helm-charts/univer-observability

Deployment Verification

# For quick testing, you might edit your local hosts file to map the domain.
# Default domain: univer.example.com
 
Visit: http://univer.example.com/sheet/

Offline Deployment

If you need to deploy in an offline environment, we also provide an offline installation package.

Download the offline installation package

Click here to download the offline installation package and extract it on your server.

tar -xvf installation-package.tar # Replace 'installation-package' with the actual file name

Upload image to privite registry

Remember, you need to login to the private container image registry before running the script.

bash load-image.sh --registry ${YOUR_REGISTRY} --namespace ${YOUR_IMAGE_NAMESPACE}

Install univer service

The script need helm and kubectl.

bash install.sh

Verify that the service is available.

# For quick testing, you might edit your local hosts file to map the domain.
# Default domain: univer.example.com
 
Visit: http://univer.example.com/sheet/

How to uninstall

bash uninstall.sh

Custom config

See https://github.com/dream-num/helm-charts for default helm chart values config, or you can run helm show values oci://univer-acr-registry.cn-shenzhen.cr.aliyuncs.com/helm-charts/univer-observability to get it.

Cross helm guidance, you can write a values.yaml to change the default config and use helm upgrade --values values.yaml ... to update univer service.

USIP

universer:
  config:
    usip:
      enabled: true
      uri:
        userinfo: "http://192.168.1.100:8080/userinfo"
        collaborators: "http://192.168.1.100:8080/collaborators"
        role: "http://192.168.1.100:8080/role"
        credential: "http://192.168.1.100:8080/credential"

Database

Change database to use self host.

universer:
  config:
    database:
      driver: postgresql
      host: 192.168.1.100
      port: 5432
      dbname: univer
      username: postgres
      password: postgres
 
temporal:
  server:
    config:
      persistence:
        default:
          driver: "sql"
          sql:
            driver: "postgres12"
            host: 192.168.1.100
            port: 5432
            database: temporal
            user: postgres
            password: postgres
 
        visibility:
          driver: "sql"
          sql:
            driver: "postgres12"
            host: 192.168.1.100
            port: 5432
            database: temporal_visibility
            user: postgres
            password: postgres
 
postgresql:
  enabled: false # do not create a postgresql in k8s

Redis

To use self host redis.

universer:
  config:
    redis:
      poolSize: 100
      # if use redis cluster, use comma to separate multiple redis servers
      # for example: 192.168.1.100:6379,192.168.1.101:6379
      addr: 192.168.1.100:6379
      read_timeout: 1s
      write_timeout: 1s
      db: 0
      username: ""
      password: ""
 
redis:
  enabled: false

S3

To use self host object storage.

universer:
  config:
    s3:
      accessKeyID: admin
      accessKeySecret: minioadmin
      region: "us-east-1"
      endpoint: http://192.168.1.100:9000
      endpointPublic: ""
      usePathStyle: true
      defaultBucket: univer
 
minio:
  enabled: false

RabbitMQ

To use self host rabbitmq.

universer:
  config:
    rabbitmq:
      cluster:
        enabled: true
        # use comma to separate multiple addresses
        # for example: RABBITMQ_CLUSTER_ADDR=192.168.1.2:5672,192.168.1.5:5672,192.168.1.7:5672
        addr: "192.168.1.2:5672"
        username: "admin"
        password: "rabbitmq"
        vhost: "/"
        schema: amqp
 
rabbitmq:
  enabled: false

Troubleshooting

If your service isn’t launching, verify the status of your Kubernetes Pods and consult the logs for clues.

If you’re still having issues, feel free to contact us for assistance.

Can not download oci ?

The helm require version >= 3, if version is less than 3.8, it should set enviroment export HELM_EXPERIMENTAL_OCI=1 to open OCI feature. See helm document.