1. Home
  2. /
  3. News
  4. /
  5. Install WikiJS in OpenShift

WikiJS installation on OpenShift / OKD 4

Install WikiJS in OpenShift / OKD 4 with Crunchy PostgreSQL

At Binero Group, we work every day to improve software delivery. The company has Open Source in its veins, and therefore we try to give back to our clients and customers as much as possible of what we develop.

In the search for a Kubernetes-based Wiki, we came across WikiJS, a modern Wiki that supports markdown files and multiple storage backends such as git and PostgreSQL.
The website provides information about installation on Kubernetes, but OpenShift has some additional security features that must be considered when installing software on it.

If you prefer to go straight to the code and a brief explanation, you can find the Git repo here with a reference to the author who started the project, but please read on if you want to know more about the background of the setup.

First, we want to use products that have a large installation base and a high level of automation, so that the efforts to maintain the software are kept to a minimum: we want to focus as much as possible on efficient use and take advantage of the opportunities Kubernetes offers for this. For that reason, we choose to use Crunchy Data Postgres Operator to install PostgreSQL as the storage backend for WikiJS, as it is the best supported.

Next, we show how to build a docker image that can be added to an internal registry if needed and used for so-called sideloading mode, which means that the files that the installation requires are packaged in the container, so no internet connection is needed to pull the files during initialization. The image is publicly available on Docker Hub and is currently updated manually – this may change in the future, we recommend setting up the build yourself to have the latest required version.

Let's get started!

WikiJS in Openshift / OKD 4

How to install WikiJS in Openshift 4 (using sideloading mode)

Prerequisites:

  • running Openshift or OKD cluster with configured persistent storage
    The examples apply to all OKD or OpenShift 4 clusters, screenshots are taken from OKD running on CRC (now OpenShift local) as described here
1. Create a project:
oc new-project wikijs

Or go to https://console-openshift-console.apps-crc.testing/k8s/cluster/projects and click Create Project and name it wikijs

2. Install Crunchy Postgres for the Kubernetes operator from OperatorHub or follow the instructions here:

https://access.crunchydata.com/documentation/postgres-operator/v5/quickstart/

Select all namespaces if you want it to be used in more than one, otherwise use the wikijs namespace we created earlier

3. Install the postgres DB as follows and ensure that your oc command uses the correct context. Change the values if needed - currently it is 20GB.
oc apply -f postgres.yaml
4. You should now have a PostgresCluster CR under the installed operators tab:

You should be able to connect from the local machine with psql like this (make sure psql is installed):

PG_CLUSTER_PRIMARY_POD=$(oc get pod -n wikijs -o name -l postgres-operator.crunchydata.com/cluster=wikijs,postgres-operator.crunchydata.com/role=master)

kubectl -n wikijs port-forward "${PG_CLUSTER_PRIMARY_POD}" 5432:5432 &

PG_CLUSTER_USER_SECRET_NAME=wikijs-pguser-wikijs
PGPASSWORD=$(kubectl get secrets -n wikijs "${PG_CLUSTER_USER_SECRET_NAME}" -o go-template='{{.data.password | base64decode}}') PGUSER=$(kubectl get secrets -n wikijs "${PG_CLUSTER_USER_SECRET_NAME}" -o go-template='{{.data.user | base64decode}}') PGDATABASE=$(kubectl get secrets -n wikijs "${PG_CLUSTER_USER_SECRET_NAME}" -o go-template='{{.data.dbname | base64decode}}') psql -h localhost

You should get a shell that shows the connection is using TLS, which is the default with this operator.

5. For me, it did not work to have WikiJS connected to PostgreSQL with SSL, I needed to add the CA certificate as described in the documentation:

(DB_SLL_CA - The database CA certificate content, as a single line string (without spaces or new lines), without prefix and suffix lines. (optional, requires 2.3+))

This is stored in the pgo-root-cacert secret, run the script to get it in the correct format:

./getPsqlRootCAString.sh

It will provide something similar to:

MIIBgTCCASegAwIBAgIQFlUx8CFOhxtbNv8baQQh7jA
KBggqhkjOPQQDAzAfMR0wGwYDVQQDExRwb3N0Z3
Jlcy1vcGVyYXRvci1jYTAeFw0yMjExMjUxMjM1NDNaFw
0zMjExMjIxMzM1NDNaMB8xHTAbBgNVBAMTFHBvc3
RncmVzLW9wACBhdG9yLWNhMFkwEwNHKoZIzj0CA
QYIKoZIzj0DAQcDQgAElokygIJH/U06gVTTQRZB0B1
cdSV8bP/HWVJ7BYOhcuOUymQsPnKDg27DgQSa9z
VVLADHf24vuMg8Uo/NDfjaf6NFMEMwDgYDVR0PAQ
H/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQAw
HQYDVR0OBBYEFN/HmCEkp7HKceaU/QACugp4tu/
LMAoGCCqGSM49BAMDA0gAMEUCIQC/qZJx55pqz
B0QmSRL6UmhnSeUl85rf2+X3eods2miKgIgM3swV3
UuTMgdDm8scsW1aDwhkPpCkwOXbaM0mX2jDvM=

Add this to deploymentConfig.yaml, excerpt:

- name: DB_SSL_CA
value:
MIIBgTCCASegAwIBAgIQFlUx8CFOhxtbNv8baQQh7jA
KBggqhkjOPQQDAzAfMR0wGwYDVQQDExRwb3N0Z3
Jlcy1vcGVyYXRvci1jYTAeFw0yMjExMjUxMjM1NDNaFw
0zMjExMjIxMzM1NDNaMB8xHTAbBgNVBAMTFHBvc3
RncmVzLW9wACBhdG9yLWNhMFkwEwNHKoZIzj0CA
QYIKoZIzj0DAQcDQgAElokygIJH/U06gVTTQRZB0B1
cdSV8bP/HWVJ7BYOhcuOUymQsPnKDg27DgQSa9z
VVLADHf24vuMg8Uo/NDfjaf6NFMEMwDgYDVR0PAQ
H/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQAw
HQYDVR0OBBYEFN/HmCEkp7HKceaU/QACugp4tu/
LMAoGCCqGSM49BAMDA0gAMEUCIQC/qZJx55pqz
B0QmSRL6UmhnSeUl85rf2+X3eods2miKgIgM3swV3
UuTMgdDm8scsW1aDwhkPpCkwOXbaM0mX2jDvM=

Now we are ready to implement it.

6. The deployment file contains a reference to the docker image created by the author of the said reference. As mentioned, this can be built from the included Dockerfile.

For convenience, we can use that image; to use your own, build the image and tag it:
docker build -t yourusername/repositoryname .

I used Docker Hub :

docker build -t vgerris/wikijs:2 .

then push it to your chosen registry and update the reference in the deployment file
more info : https://docs.docker.com/engine/reference/commandline/push/

docker push vgerris/wikijs:2

Now apply the deployment:

oc apply -f deploymentConfig.yaml
7. Now that the app is deployed, we can add a service and a route to expose it. Update the route file with your server URL:
oc apply -f service.yaml
oc apply -f route.yaml

You should now have the application running and exposed on the route, you can now complete the setup.

Enjoy WikiJS!

Optional
If you have an existing collection of Markdown files (MD) it can be useful to add them to the wiki. More information on how to set this up when it is stored in git can be found here.
The files will be indexed and added to WikiJS and can be edited directly with the Markdown editor. As a bonus, WikiJS has a diagram plugin that makes it really easy to add draw.io-based diagrams directly in the documents.

It is also quite easy to set up OpenID connect with for example Keycloak.
Under administration, go to authentication, add strategy and choose Keycloak.
Create a client in Keycloak and fill in the requirements present.
Disable the guest user if you don't want it to be public, see:
https://docs.requarks.io/groups (Private Wiki)

Binero Group delivers OKD on top of Binero cloud and also a fully supported Red Hat OpenShift Container Platform as a hosted or fully managed solution, in Swedish data centre, GDPR-compliant.

Try Binero cloud and contact us if you have any questions, we are happy to help!

Create account in Binero cloud

Share this article

Related articles

Person participates in video meeting with healthcare staff, text: "Article: Meeting the need for high-quality care".
Three Swedish football players on the pitch with the text "Nations League 2026/2027: All you need to know" overlaid.
Article

Nations League 2026/2027

Woman using touchscreen with text about cloud services and guest experience.

Want to know more?

We are driven by helping our customers achieve greater innovation and cost-effective IT. Would you also like to benefit from the latest in high-performance cloud services?