Deploy Wikijs using Helm

This article was last updated on: July 24, 2024 am

Use Helm to deploy wiki .js

๐Ÿ“š๏ธ Reference Documentation:

Wiki.js Official documentation - Installation - Kubernetes

Wiki.js is installed using Helm

Wiki.js Official documentation - installation - sideloading

Official tutorials

Kubernetes

Get started with Helm Chart and install on Kubernetes

prerequisite
  • Kubernetes clusters
  • Helm
  • PostgreSQL database
โ—๏ธ Significant.
  • **You must deploy a single instance before you can set up the application. **Once set up, you can increase the number of replicas to any number.
  • Although wikis .js support other database engines, multiple copies require mandatory usePostgreSQLใ€‚
Install Helm Chart

For detailed installation instructions, refer to wiki.js helm repoใ€‚

introduce

This chart usesHelmThe package manager is inKubernetesStart a wiki .js deployment on the cluster.

It also optionally convertsPostgreSQLPackaged as a database, but you are free to bring your own database.

prerequisite
  • If you want data persistence, you need to be supported by the PV vendor in your infrastructure (with persistent storage enabled)
Install Chart

To install the stripmy-release For the publication name of the chart, please see here (helm) directory runs the following:

๐Ÿ“š๏ธ Reference Documentation:

Wiki.js helm chart git repository

You need to clone the Git repository first, and jump to (helm) directory, and then execute the following command.

Use Helm3:

$ helm install my-release .

Using Helm2:

$ helm install --name my-release . 

The command is on a Kubernetes clusterdefault Deploy wiki .js in your tenant. The [[Deploying Wikijs# Configuration with Helm] section lists the parameters that can be configured during installation.

prompt:usehelm listList all versions

Uninstall Chart

Uninstall/removemy-releaseDeploy:

$ helm delete my-release

The command deletes all Kubernetes components associated with the chart and deletes the release.

warn: PVCs for databases are not automatically deleted. They need to be deleted manually

$ kubectl delete pvc/data-wiki-postgresql-0
disposition

The following table lists the configurable parameters of Wikicharts.js and their default values.

Parameter Description Default
image.repository wiki.js image requarks/wiki
image.tag wiki.js image tag latest
imagePullPolicy Image pull policy IfNotPresent
replicacount Number of wiki.js service pods to run 1
resources.limits wiki.js service resource limits nil
resources.requests Wiki.js Service Resource Requests nil
nodeSelector wiki.js nodeSelector {}
affinity wiki.js Affinity settings for pod allocation {}
schedulerName wiki.js The name of the pod alternate scheduler nil
tolerations wiki.js Tolerant labels for pod assignments []
ingress.enabled Enable Ingress Controller Resources false
ingress.annotations Ingress Comments {}
ingress.hosts Ingress Rule List [{"host": "wiki.local", "paths": ["/"]}]
ingress.tls Ingress TLS configuration []
postgresql.enabled Whether to deploy PostgreSQL (see below) true
postgresql.postgresqlDatabase PostgreSQL database name wiki
postgresql.postgresqlUser Postgresql username postgres
postgresql.postgresqlHost Postgresql host nil
postgresql.postgresqlPassword Postgresql password nil
postgresql.postgresqlPort Postgresql port 5432
postgresql.persistence.enabled Use PVC to enable postgresql persistence true
postgresql.persistence.existingClaim Provides postgresql with an existing onePersistentVolumeClaim nil
postgresql.persistence.storageClass Postgresql PVC storage class (for example:nfs) nil
postgresql.persistence.size PostgreSQL PVC storage size requirements 8Gi

use--set key=value[,key=value]Parameters are specified to each parameter helm installใ€‚ For example

$ helm install --name my-release \
  --set postgresql.persistence.enabled=false \
   . 

Alternatively, you can provide a YAML file that specifies the above parameter values when you install the chart. For example

$ helm install --name my-release -f values.yaml . 

prompt: You can use the defaultvalues.yaml

PostgreSQL

By default, PostgreSQL is installed as part of Chart.

Use an external PostgreSQL server

To use an external PostgreSQL server, set uppostgresql.enabledforfalseThen setpostgresql.postgresqlHostandpostgresql.postgresqlPasswordใ€‚ Other optionspostgresql.postgresqlDatabaseใ€postgresql.postgresqlUser(and)postgresql.postgresqlPortYou may also need to change from its default value.

You also need to add the following Helm templates to your deployment:

kind: Secret
apiVersion: v1
metadata:
  name: {{ template "wiki.postgresql.secret" . }}
data:
  {{ template "wiki.postgresql.secretKey" . }}: "{{ .Values.postgresql.postgresqlPassword | b64enc }}"
Persistence

PVCs are used to persist data throughout the deployment. See the [[Deploying Wikijs# Configuration with Helm] section to configure PVC or disable persistence.

Ingress

This Chart provides support for Ingress resources. If you have an ingress controller available, such as Nginx or Traefik, you may want to set it upingress.enabledis true, and choose one for the URLingress.hostnameใ€‚ You should then be able to access the installation using that address.

Use Helm to deploy wiki .js in an offline environment

๐Ÿ“š๏ธ Reference Documentation:

Wiki.js Official documentation - Installation - Kubernetes

Wiki.js is installed using Helm

Wiki.js Official documentation - installation - sideloading

overview

According to the official documentation and analysis of GitHub issues. In an offline environment, you need to sideload the data downloaded from the Internet.

This is done by manually downloading a set of files and putting themA specific directory placed in a wiki installationto achieve. These files will be in the During initializationImport.

In the wiki.js path of the installation folder data/sideloadCreate a new folder.

For example, if your wiki is installed in the path/wiki (The wiki installation path in the docker image of wikijs is.) /wiki), then you need in the path/wiki/data/sideload Create a folder.

Locales

In order to install the locale package, you need:Main locale file+ At least oneLocale package fileใ€‚

i๏ธ Information:

These files can be downloaded from https://github.com/Requarks/wiki-localization. These archives are up-to-date every night.

Master file

Master filelocales.json Contains information about all available languages, andHave toInstallation.

Place this file in the one you created earliersideload folder.

Locale package

The locale package filexx.json orxx-zz.json Contains all translations for the selected language. You can load any number of locales at the same time.

โš ๏ธ Warn:

English packen.json is required because this is the default language during installation. After that you can change the language.

Place the file in the previously created onesideload next to the main file in the folder. Now, you should have it in your folderlocales.json๏ผŒen.jsonand any other language.

Sideload

โš ๏ธ Warn:

You must first modify the wiki.js configuration file: config.yml. Add the following line: offline: true

Run the wiki .js (or restart the process if it is already running), autoload atdata/sideload files in the folder.

steps

๐Ÿ“ Remark:

Due to the lack of time, I will not integrate the extra steps into the helm chart.

The following steps assume that:

  1. Installed helm
  2. A git repository that has clone wikijs
  3. Jumped to helm/ directory
  1. Pass helm Install wiki.js and postgresql:

    1
    helm install wikijs . -n wiki --set image.tag=2,postgresql.persistence.storageClass=nfs-fast

    The configuration description is as follows, after creating the helm there will be a related success prompt, it can be used at this time, but the locale language pack cannot be loaded. The next step is to load the language pack via sideload.

    1. atwiki Install under the tenant;
    2. The image version tag for wiki.js is 2, guaranteed not because of the choicelatest tag, causing wiki.js to suddenly upgrade from 2 to 3, resulting in service exceptions;
    3. PostgreSQL is a persistent storestorageClassfornfs-fast, through which storage is automatically applied.
  2. Because sideload is required. Needs to be modifiedconfig.yml, modify it by ConfigMap as follows. The steps are as follows:

    1. Create a ConfigMap as follows - wiki-config, only one line has been added compared to the default:

      image-20210227232511340

    2. In the deployment of wikijs, make the following changes to mount the above ConfigMap to the specified location through SubPath

      image-20210227233052680

  3. Because a sideload is needed, it needs to be created data/sideload folder, and place the locales file in that directory. Implemented via PVC

    1. Apply for a PVC of about 50M - sideload-data (Steps omitted)

    2. Mount the PVC to the wikijs Deployment directory:

      image-20210227233052680

    3. Then download the good onelocales.json, en.jsonandzh.jsonSpecify the directory to place in the container: /wiki/data/sideload. As follows:

      image-20210227234116239

  4. After wikijs Deployment restarts, you can go to the page to install. Fill in separately:

    1. Administrator mailbox
    2. Administrator Password, confirm the administrator password again
    3. The URL of the wikijs site
    4. The installation configuration will be completed automatically.
  5. Once inside, you can configure Chinese here:

    image-20210227233926145

  6. At this point, deploying the wiki using Helm in an offline environment .js complete. ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

summary

Compared to the online environment, the following steps are added:

  1. ConfigMap mounts wiki.js configuration files in SubPath config.yml, the configuration file has one more sentence: offline: true
  2. Apply for a new PVC, mount to/wiki/data/sideload, and put locales-related files in.

Deploy wiki .js using Helm in OpenShift

i๏ธ Information:

OpenShift 4.4+ supports Helm3

OpenShift, the requirements for permissions are strict, and the simplest adaptation step is to release the ServiceAccount permissions used by wiki.js.

Compared to the previous section, the specific operations that are excessive, or have adjustments are as follows:

  1. Pass helm3 Installation:

    1
    helm install wikijs . -n wiki --set image.tag=2.5,postgresql.serviceAccount.enabled=true,postgresql.serviceAccount.name=wikijs,postgresql.persistence.storageClass=nfs-fast

    i๏ธ The instructions are as follows:

    1. Wikijs is used when it is installed wikijs This ServiceAccount, in order to simplify the permission step, PostgreSQL also uses this ServiceAccount
    2. The specific parameters are: postgresql.serviceAccount.enabled=true,postgresql.serviceAccount.name=wikijs
  2. To givewikijs This user empowers the SCC: anyuid: oc adm policy add-scc-to-user anyuid -z wikijs -n wiki

  3. All other steps are consistent with the previous section.

summary

Through the introduction of this article, it can be seen that the Wiki.js function is still very powerful and worth using.

Deploy with helm in Kubernetes, directly use the official simplest command;

Deploying with helm in Kubernetes in an offline environment requires 2 more steps:

  1. ConfigMap mounts wiki.js configuration files in SubPath config.yml, the configuration file has one more sentence: offline: true
  2. Apply for a new PVC, mount to/wiki/data/sideload, and put locales-related files in.

Deploying with helm in OpenShift in an offline environment, due to strict permission restrictions, it is necessary to adjust the ServiceAccount and grant higher privileges.

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰


Deploy Wikijs using Helm
https://e-whisper.com/posts/2261/
Author
east4ming
Posted on
August 10, 2021
Licensed under