seafile

by datamate

Helm chartv0.6.0App 11.0.20Verified publisher

A Helm chart for Seafile. Seafile is an open source file sync and share platform, focusing on reliability and performance.

About this chart

Seafile Helm Chart

A Helm chart to install Seafile on Kubernetes

Seafile is an open source file sync and share platform, focusing on reliability and performance.

Introduction

This chart will do the following:

  • Install Deployments for Seafile. Mainly one Seafile-Backend-Server and multiple Seafile-Frontend-Server
  • Install Elasticsearch, Memcached, MariaDB & Minio (optional) as requirements

Be aware that the Seafile Helm chart version is different from the actual Seafile version.

[!IMPORTANT]
Be aware that the Seafile Helm chart is provided by datamate, the primary support and sales partner in Europe. Currently this Helm Chart is still a Beta version. Only use this if you are familiar with Kubernetes and Helm

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.2.0+
  • Cluster with at least 4GB of free RAM

Create a Namespace

kubectl create namespace seafile

Create a Secret for Your License

Note: If you don't have a license, create an empty seafile-license.txt file. This will allow you to try out Seafile (3 users max).

kubectl create secret generic seafile-license --from-file=seafile-license.txt=$PATH_TO_YOUR_LICENSE_FILE --namespace seafile

Create a Secret for Your Initial Admin Credentials

Note: These values are only used when the initial admin user is created.

kubectl create secret generic seafile-admin-credentials -n seafile --from-literal=email='YOUR_ADMIN_EMAIL' --from-literal=password='YOUR_ADMIN_PASSWORD'

Create a Secret for MariaDB Credentials

Note: You can use pwgen -s <LENGTH> to generate secure random strings.

These credentials are used by the Seafile pods and the Galera Cluster pods.

kubectl create secret generic seafile-mariadb-credentials --namespace seafile \
  --from-literal=mariadb-root-password='LONG_RANDOM_STRING' \
  --from-literal=mariadb-password='LONG_RANDOM_STRING' \
  --from-literal=mariadb-galera-mariabackup-password='LONG_RANDOM_STRING'

Create a Secret for the Seahub Secret Key

kubectl create secret generic seafile-seahub-secret-key --namespace seafile \
  --from-literal=secretKey='LONG_RANDOM_STRING'

Create a Secret for the Notification Server Private Key

kubectl create secret generic seafile-notification-server-private-key --namespace seafile \
  --from-literal=privateKey='LONG_RANDOM_STRING'

Create a Secret for the Storage Class Configuration

This secret contains the storage class configuration (e.g. S3 credentials).

# Create storage class configuration: https://manual.seafile.com/11.0/deploy_pro/multiple_storage_backends/#defining-storage-backends
touch seafile_storage_classes.json

kubectl create secret generic seafile-storage-classes --namespace seafile \
  --from-file=seafile_storage_classes.json=seafile_storage_classes.json

If you use the bundled MinIO chart for testing purposes, you can use the following storage class configuration:

[
    {
      "storage_id": "S3",
      "name": "S3",
      "is_default": true,
      "commits": {
        "backend": "s3",
        "host": "seafile-minio:9000",
        "use_https": "false",
        "bucket": "seafile-commits",
        "key_id": "minioadmin",
        "key": "topsecret",
        "path_style_request": true
      },
      "fs": {
        "backend": "s3",
        "host": "seafile-minio:9000",
        "use_https": "false",
        "bucket": "seafile-fs",
        "key_id": "minioadmin",
        "key": "topsecret",
        "path_style_request": true
      },
      "blocks": {
        "backend": "s3",
        "host": "seafile-minio:9000",
        "use_https": "false",
        "bucket": "seafile-blocks",
        "key_id": "minioadmin",
        "key": "topsecret",
        "path_style_request": true
      }
    }
]

Deploy an Ingress Controller (ingress-nginx)

helm upgrade --install ingress-nginx ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace ingress-nginx --create-namespace

Please refer to the ingress-nginx docs for detailed instructions.

Note: There are environment/cloud-provider-specific instructions: https://kubernetes.github.io/ingress-nginx/deploy/#cloud-deployments (e.g. for DigitalOcean)

DNS

Wait until your cloud provider has allocated an external IP address to the ingress controller:

kubectl get services -n ingress-nginx --watch

Once this is done, you can create your DNS record using this external IP address.

TLS

  1. Deploy cert-manager using Helm
  2. Configure a Let's Encrypt Issuer (inside the seafile namespace)
  3. Note down the issuer resource name

Note: On DigitalOcean (and many other cloud providers), ingress-nginx/the CCM provisions a load balancer which uses the PROXY protocol to send traffic to the ingress controller. The advantage is that all headers (e.g. for the client IP) are preserved. However, this causes problems with cert-manager, which first tries to initiate a self-check and does not support the proxy protocol (#466). ingress-nginx expects all requests to use this protocol.

There are a few possible workarounds:

  1. Deploy hairpin-proxy which uses a custom controller to modify CoreDNS Corefiles:
    kubectl apply -f https://raw.githubusercontent.com/webofmars/hairpin-proxy/v0.5.0/deploy.yml
    
  2. Use an additional DNS record and custom annotations to work arounds this issue (e.g. for DigitalOcean)
  3. Terminate TLS at the load balancer
  4. Wait for KEP 1860, which should hopefully fix this issue

Installing the Chart

Create a custom values file:

touch my-values.yaml

Make configuration changes:

seafileConfig:
  # Enter your hostname
  hostname: ""

To install the chart use the following:

helm repo add datamate https://datamate-rethink-it.github.io/seafile-helm
helm upgrade --install seafile datamate/seafile --namespace seafile --create-namespace --values my-values.yaml

Uninstalling the Chart

If you use the included mariadb-galera chart, you need to scale the StatefulSet down before removing all the pods. Otherwise the database cluster won't be able to start up again without making tedious configuration changes.

kubectl scale sts $RELEASE-mariadb-galera --namespace seafile --replicas=0

Please refer to the mariadb-galera docs for more details (#1, #2).


To remove the chart again use the following:

helm delete seafile --namespace seafile

Configuration

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

helm show values datamate/seafile

Seahub Customization

Use the following commands if you want to customize Seahub:

  1. Create a config map for your custom logo, login background image and favicon:

    kubectl create configmap seafile-customization --namespace seafile \
      --from-file=mylogo.png=$PATH_TO_YOUR_LOGO \
      --from-file=login-bg.jpg=$PATH_TO_YOUR_LOGIN_BG \
      --from-file=favicon.ico=$PATH_TO_YOUR_FAVICON
    
  2. Set seafileConfig.seahub.customizationConfigmap to seafile-customization and upgrade your deployment

Deploy seafile with OpenTenant

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