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
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:use
helm list
List all versions
Uninstall Chart
Uninstall/removemy-release
Deploy:
$ 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.enabled
forfalse
Then setpostgresql.postgresqlHost
andpostgresql.postgresqlPassword
ใ Other optionspostgresql.postgresqlDatabase
ใpostgresql.postgresqlUser
(and)postgresql.postgresqlPort
You 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.enabled
is 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
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/sideload
Create 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 pack
en.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.json
and 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:
- Installed
helm
- A git repository that has clone wikijs
- Jumped to
helm/
directory
-
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.
- at
wiki
Install under the tenant; - 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; - PostgreSQL is a persistent store
storageClass
fornfs-fast
, through which storage is automatically applied.
- at
-
Because sideload is required. Needs to be modified
config.yml
, modify it by ConfigMap as follows. The steps are as follows:-
Create a ConfigMap as follows -
wiki-config
, only one line has been added compared to the default: -
In the deployment of wikijs, make the following changes to mount the above ConfigMap to the specified location through SubPath
-
-
Because a sideload is needed, it needs to be created
data/sideload
folder, and place the locales file in that directory. Implemented via PVC-
Apply for a PVC of about 50M -
sideload-data
(Steps omitted) -
Mount the PVC to the wikijs Deployment directory:
-
Then download the good one
locales.json
,en.json
andzh.json
Specify the directory to place in the container:/wiki/data/sideload
. As follows:
-
-
After wikijs Deployment restarts, you can go to the page to install. Fill in separately:
- Administrator mailbox
- Administrator Password, confirm the administrator password again
- The URL of the wikijs site
- The installation configuration will be completed automatically.
-
Once inside, you can configure Chinese here:
-
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:
- ConfigMap mounts wiki.js configuration files in SubPath
config.yml
, the configuration file has one more sentence:offline: true
- 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:
-
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:
- Wikijs is used when it is installed
wikijs
This ServiceAccount, in order to simplify the permission step, PostgreSQL also uses this ServiceAccount - The specific parameters are:
postgresql.serviceAccount.enabled=true,postgresql.serviceAccount.name=wikijs
- Wikijs is used when it is installed
-
To give
wikijs
This user empowers the SCC:anyuid
:oc adm policy add-scc-to-user anyuid -z wikijs -n wiki
-
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:
- ConfigMap mounts wiki.js configuration files in SubPath
config.yml
, the configuration file has one more sentence:offline: true
- 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.
๐๐๐