Git Product home page Git Product logo

wikijs-openshift4's Introduction

Wiki.js in Openshift 4

How to install Wiki.js in Openshift 4 (using sideloading mode)

Prerequisites:

  • running Openshift or OKD cluster with persistant storage setup
  1. Create a project:

    oc new-project wikijs
  2. Install the Crunchy Postgres for Kubernete operator from OperatorHub or following the instructions here: https://access.crunchydata.com/documentation/postgres-operator/v5/quickstart/

    Choose all namespaces if you want it to be usuable in more than one, if not use the wikijs one that we created before.

  3. Install the postgres DB as follows, making sure your oc command is using the right context. Change the values if needed - currently it's 20GB.

    oc apply -f postgres.yaml
  4. Now you should have a PostgresCluster CR under the tab under installed operators. You should be able to connect from the local machine with psql like so (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 shoud 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 Wiki.js connect to PostgreSQL with SSL, I needed to add the CA cert as described in the docs:

    https://docs.requarks.io/install/docker (DB_SLL_CA - Database CA certificate content, as a single line string (without spaces or new lines), without the 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 right format:

    ./getPsqlRootCAString.sh 

    It will give something like :

    MIIBgTCCASegAwIBAgIQFlUx8CFOhxtbNv8baQQh7jAKBggqhkjOPQQDAzAfMR0wGwYDVQQDExRwb3N0Z3Jlcy1vcGVyYXRvci1jYTAeFw0yMjExMjUxMjM1NDNaFw0zMjExMjIxMzM1NDNaMB8xHTAbBgNVBAMTFHBvc3RncmVzLW9wACBhdG9yLWNhMFkwEwNHKoZIzj0CAQYIKoZIzj0DAQcDQgAElokygIJH/U06gVTTQRZB0B1cdSV8bP/HWVJ7BYOhcuOUymQsPnKDg27DgQSa9zVVLADHf24vuMg8Uo/NDfjaf6NFMEMwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFN/HmCEkp7HKceaU/QACugp4tu/LMAoGCCqGSM49BAMDA0gAMEUCIQC/qZJx55pqzB0QmSRL6UmhnSeUl85rf2+X3eods2miKgIgM3swV3UuTMgdDm8scsW1aDwhkPpCkwOXbaM0mX2jDvM=

    Add this to the deploymentConfig.yaml, snippet:

        - name: DB_SSL_CA
          value: MIIBgTCCASegAwIBAgIQFlUx8CFOhxtbNv8baQQh7jAKBggqhkjOPQQDAzAfMR0wGwYDVQQDExRwb3N0Z3Jlcy1vcGVyYXRvci1jYTAeFw0yMjExMjUxMjM1NDNaFw0zMjExMjIxMzM1NDNaMB8xHTAbBgNVBAMTFHBvc3RncmVzLW9wACBhdG9yLWNhMFkwEwNHKoZIzj0CAQYIKoZIzj0DAQcDQgAElokygIJH/U06gVTTQRZB0B1cdSV8bP/HWVJ7BYOhcuOUymQsPnKDg27DgQSa9zVVLADHf24vuMg8Uo/NDfjaf6NFMEMwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFN/HmCEkp7HKceaU/QACugp4tu/LMAoGCCqGSM49BAMDA0gAMEUCIQC/qZJx55pqzB0QmSRL6UmhnSeUl85rf2+X3eods2miKgIgM3swV3UuTMgdDm8scsW1aDwhkPpCkwOXbaM0mX2jDvM=

    Now we are ready to deploy it.

  6. The deployment file contains a reference to the docker image the author of the mentioned reference made. As mentioned, this can be build from the Dockerfile which is included.

For convenience we can use that image, to user your own, build the image and tag it: docker build -t yourusername/repository-name . I used docker hub : bash docker build -t vgerris/wikijs:2 . then push it to your registry of choice and update the reference in the deployment file more info : https://docs.docker.com/engine/reference/commandline/push/ bash docker push vgerris/wikijs:2

Now apply the deployment:
```bash
oc apply -f deploymentConfig.yaml 
```
  1. Now that the app is deployed we can add a service and a route te expose it.

    Update the route file with your server URL:

    oc apply -f service.yaml
    oc apply -f route.yaml

    You should have the application running and exposed on the route now, you can finish setting it up. Enjoy Wiki.js !

Based on this tutorial that uses a PostgreSQL app template:

http://www.lucadentella.it/2022/04/20/installare-wiki-js-in-openshift-4/

and references:

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

https://docs.requarks.io/install/docker

https://docs.docker.com/engine/reference/commandline/push/

wikijs-openshift4's People

Contributors

lucadentella avatar vgerris avatar

Watchers

 avatar

Forkers

binerogroup

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.