Wiki.js (official website) is a very good wiki portal developed in Node.js. It is possible to install it on several platforms and it supports different DB servers as backend.
Recently I needed to install it in Openshift 4. Even if an helm chart is available, I faced a couple of issues that prevent you to use it with Openshift:
- containers are executed with root privileges (by default not allowed by Openshift and in any case not recommended)
- it requires a direct access (proxy is not supported) to the Internet to download language packs (locales)
I collected in this blog post and in a Github repository the steps and the files required to complete the installation successfully.
1. Project
First I created a new project for the new Wiki.js instance and its database:
oc new-project wikijs
2. Postgres
I chose to use PostgreSQL as backend.
Openshift provides two templates for running a PostgreSQL instance, one with persistent storage (the one I will use) and one with ephemeral storage (= data is lost every time the POD is restarted).
Using the GUI, you can find the template from the Developer Portal:
Using the shell, I created a new application from the postgresql-persistent template with the following command:
oc new-app --template postgresql-persistent -p VOLUME_CAPACITY=10Gi -p POSTGRESQL_VERSION=10-el8
I asked the template to create a 10Gb persistent volume and to use version 10 for PostgreSQL, based on RHEL8.
You can list all the parameters a template supports as it follows:
oc process --parameters -n openshift postgresql-persistent
The template automatically creates a deploymentConfig, a persistentVolumeClaim, a service and a secret. The secret in particular contains all the information needed for connecting to the database:
I’m going to use this secret in the Wiki.js configuration in the next paragraph.
3. Wiki.js
An official docker image is available for Wiki.js, but it has the two issues listed in the beginning of this post.
I therefore prepared a Dockerfile which modifies the image by changing the user (from root to uid 1001) and uses the sideloading mode to already include in the image the necessary locales that would normally be downloaded from the Internet during the setup process.
If you cannot build the image by yourself, I made it available on DockerHub:
docker push lucadentella/wikijs-ocp4-sideload:2.5
I prepared a deploymentConfig which uses that image to create the Wiki.js application POD.
To configure the connection to the database, I use the same secret created by the template in the previous paragraph, in order to automatically retrieve all the data:
Once the deploymentConfig has been applied, it is possible to verify from the logs that Wiki.js is running correctly and is able to connect to the DB:
As a final step, I created a service (on port TCP/3000) and a route (https) to expose the application outside the cluster and to be able to connect using a browser to complete the setup:
thanks, I built on it to use Crunchy PostgreSQL which has TLS enabled, the apps needs the CA to be setup.
I can make a PR if you like, documented/scripted some commands too.
PR made : https://github.com/lucadentella/wikijs-openshift4/pull/1PR made : https://github.com/lucadentella/wikijs-openshift4/pull/1