Time to deploy the wiki

Last week, we saw how to setup our database for this wiki project, now let’s deploy the wiki page.

Still last week, I went on using the full rancher web GUI as it’s, I think, a good way to start. So this week let’s go full command line.

All the file I will refer to in this post are available on my github.

Prerequisites:

For this post, I will assume that:

  • You know how to SSH into your cluster, or that so have access to a command line.
  • You already have a working database, which is empty.
  • You have a namespace called “wiki” in your cluster.

So your lead node, clone the files using:

git clone https://github.com/HanaPoulpe/wikijs-kubernets-deploy.git
cd manifests

Setup the secrets:

On thing we want to avoid, is to store the secrets in the same place that the configuration.

Small tips here: we want to replace the ones in the secret.yaml file, and we need to encode the secrets in base64 in the file. We’ll call our friends sed and base64 that should be present in your host.

sed -i "s/<db host>/"$(echo "dbhostname"|base64)"/g" secret.yaml
sed -i "s/<db name>/"$(echo "dbname"|base64)"/g" secret.yaml
sed -i "s/<db port>/"$(echo "dbport"|base64)"/g" secret.yaml
sed -i "s/<db type>/"$(echo "postgresql"|base64)"/g" secret.yaml
sed -i "s/<db password>/"$(echo "dbpassword"|base64)"/g" secret.yaml

Check the file, there should now be values in the secret.yaml.

All that is left to do:

kubectl apply -f secret.yaml

To check that your secret are correctly applied:

kubectl get secrets -n wiki

You should see a line named “wiki-db-secret”.

Deploy wiki.js

Now we have out secrets, let’s deploy wiki.js.

One thing to know about wikijs container: it listen by default on port 3000 for http, and 3443 for https. For this wiki we won’t use https, because the deployment will be behind a load balancer (more on this later).

Let’s deploy, super simple:

kubectl apply -f deploy.yaml

To check how the deployment goes:

kubectl get pods -n wiki

You should get something like:

NAME                       READY   STATUS    RESTARTS   AGE
wiki-js-687bb967cf-crxqs   1/1     Running   0          60m

Let’s check how the deployment goes:

kubectl logs <your pod name> -n wiki

If everything goes well you should have something like:

Loading configuration from /wiki/config.yml... OK
2021-08-22T12:34:32.416Z [MASTER] info: =======================================
2021-08-22T12:34:32.418Z [MASTER] info: = Wiki.js 2.5.201 =====================
2021-08-22T12:34:32.419Z [MASTER] info: =======================================
2021-08-22T12:34:32.419Z [MASTER] info: Initializing...
2021-08-22T12:34:34.464Z [MASTER] info: Using database driver pg for postgres [ OK ]
2021-08-22T12:34:34.477Z [MASTER] info: Connecting to database...
2021-08-22T12:34:34.523Z [MASTER] info: Database Connection Successful [ OK ]
2021-08-22T12:34:35.973Z [MASTER] warn: DB Configuration is empty or incomplete. Switching to Setup mode...
2021-08-22T12:34:35.973Z [MASTER] info: Starting setup wizard...
2021-08-22T12:34:36.926Z [MASTER] info: Starting HTTP server on port 3000...
2021-08-22T12:34:36.927Z [MASTER] info: HTTP Server on port: [ 3000 ]
2021-08-22T12:34:36.934Z [MASTER] info: HTTP Server: [ RUNNING ]
2021-08-22T12:34:36.934Z [MASTER] info: πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»πŸ”»
2021-08-22T12:34:36.935Z [MASTER] info:
2021-08-22T12:34:36.935Z [MASTER] info: Browse to http://YOUR-SERVER-IP:3000/ to complete setup!
2021-08-22T12:34:36.935Z [MASTER] info:
2021-08-22T12:34:36.936Z [MASTER] info: πŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”ΊπŸ”Ί

This means your pods is ready, and wiki.js is running. Great but when you try to access the pod on port 3000 it’s obviously not working. That’s because we still need to setup the loadbalancer.

Setup the load balancer

I think you get it already, it’s one command:

kubectl apply -f service.yaml

Check that everything is fine:

kubectl get services -n wiki

Here we are, just connect to you cluster ip on port 11080.

Setup wiki.js

Everything is not working, you should see a page like this one:

Fill up the form and you’re done.

0 Replies to “Time to deploy the wiki”

Leave a Reply

Your email address will not be published. Required fields are marked *