Changes for page XWiki (Helm)

Last modified by Itzhak Daniel on 2024/04/29 16:35

From version 4.1
edited by Itzhak Daniel
on 2024/04/28 16:19
Change comment: There is no comment for this version
To version 9.1
edited by Itzhak Daniel
on 2024/04/28 21:16
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,7 +1,15 @@
1 +(% class="row" %)
2 +(((
3 +(% class="col-xs-12 col-sm-8" %)
4 +(((
1 1  == About ==
2 2  
3 3  **XWiki** is a [[free>>url:https://en.wikipedia.org/wiki/Free_software]] [[wiki software>>url:https://en.wikipedia.org/wiki/Wiki_software]] platform written in [[Java>>url:https://en.wikipedia.org/wiki/Java_(programming_language)]] with a design emphasis on extensibility. As an [[application wiki>>url:https://en.wikipedia.org/wiki/Application_wiki]], XWiki allows for the storing of structured data and the execution of server side script within the wiki interface. Scripting languages including [[Velocity>>url:https://en.wikipedia.org/wiki/Jakarta_Velocity]], [[Apache Groovy>>url:https://en.wikipedia.org/wiki/Groovy_(programming_language)]], [[Python>>url:https://en.wikipedia.org/wiki/Python_(programming_language)]], [[Ruby>>url:https://en.wikipedia.org/wiki/Ruby_(programming_language)]] and [[PHP>>url:https://en.wikipedia.org/wiki/PHP]] can be written directly into wiki pages using wiki [[macros>>url:https://en.wikipedia.org/wiki/Macro_(computer_science)]]. XWiki code is licensed under the [[GNU Lesser General Public License>>url:https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License]] and hosted on [[GitHub>>url:https://en.wikipedia.org/wiki/GitHub]] where everyone is free to [[fork>>url:https://en.wikipedia.org/wiki/Fork_(software_development)]] the source code and develop changes in their own repository. While most of the active developers are funded by commercial support company XWiki [[SAS>>url:https://en.wikipedia.org/wiki/Soci%C3%A9t%C3%A9_par_actions_simplifi%C3%A9e]], XWiki SAS maintains a strict boundary between itself and the XWiki free software project. ~[[[source>>https://en.wikipedia.org/wiki/XWiki]]]
4 4  
9 +=== Security ===
10 +
11 +XWiki is running as root by default, we had to rebuild the image in order to enable us to run it as an unprivileged user (uid/gid: 30001). With MySQL we didn't go to the same effort, but in that case we're running the process as uid/gid: 30001:0, which is far from perfect, but much better than running as the user root.
12 +
5 5  == Background ==
6 6  
7 7  [[Behemoth LTD>>https://www.behemoth.co.il/]] was in a search for a 'knowledge base' software, a central place to collect and collaborate on documents which hold information, instructions, guide, etc. The requirement was simple, it required to be able to run on Kubernetes without too much customization, building, testing and other complex CI/CD prerequisite.
... ... @@ -12,17 +12,77 @@
12 12  
13 13  Here is the list of things you need to have:
14 14  
15 -* Kubernetes 1.27 (probably will work with later versions as well).
16 -** Automatic storage provisioner (Behemoth LTD special case).
17 -* Helm 3.12 (probably will work with later versions as well).
23 +* Kubernetes 1.27+.
24 +** Automatic storage provisioner.
25 +** Ingress-nginx.
26 +** Cert-manager.
27 +* Helm 3.12+.
28 +* XWiki 16.2.0.
29 +** Custom Image (non-root).
18 18  
19 -== Deploying ==
20 -
21 -We're going to deploy XWiki as a [[statefulset>>https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/]], the Database (MySQL) and the App, each will have a volume to store their content.
22 -
23 23  === Note about Storage ===
24 24  
25 -Behemoth LTD is running an on-prem Kubernetes solutions, we (currently?) don't have any shared storage solution ([[ceph>>https://docs.ceph.com/]], [[nfs>>https://github.com/kubernetes-csi/csi-driver-nfs]], [[...>>https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner]]) , which require two things:
33 +Behemoth LTD is running an on-prem Kubernetes solution, we (currently?) don't have any shared storage solution ([[ceph>>https://docs.ceph.com/]], [[nfs>>https://github.com/kubernetes-csi/csi-driver-nfs]], [[...>>https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner]]) , which require two things:
26 26  
27 27  1. Creating the path/loop device prior of creating PV.
28 28  1. The PV is manually created.
37 +
38 +You may not need that if your cluster knows to provision storage by itself.
39 +
40 +== CI/CD ==
41 +
42 +At the beginning we tried to avoid making any custom changes to the images in question (XWiki and Bitnami's MySQL). But XWiki running as root, didn't fly. So we had to create a custom image with minor changes to enable it to run as a unprivileged uid/gid: 30001.
43 +
44 +=== Building and Publish ===
45 +
46 +You will need to perform the following actions:
47 +
48 +{{code language="sh" layout="LINENUMBERS" title="# Clone the repository"}}
49 +git clone --depth 1 --branch master https://github.com/xwiki/xwiki-docker.git
50 +{{/code}}
51 +
52 +Once you have the repo locally, modify the //Dockerfile// as shown below:
53 +
54 +{{code language="git" title="# Diff"}}
55 +@@ -89,6 +89,11 @@ COPY xwiki/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
56 + # across runs)
57 + VOLUME /usr/local/xwiki
58 +
59 ++# Added by Behemoth LTD - Apr 28th, 2024
60 ++# Fixing permissions error when using non-root user/group (30001:30001) to start the app
61 ++RUN chown -R 30001:30001 /usr/local/tomcat/webapps
62 ++USER 30001:30001
63 ++
64 + # At this point the image is done and what remains below are the runtime configuration used by the user to configure
65 + # the container that will be created out of the image. Namely the user can override some environment variables with
66 + # docker run -e "var1=val1" -e "var2=val2" ...
67 +
68 +{{/code}}
69 +
70 +Once the changes have been made, build and push it to your repository.
71 +
72 +{{code language="sh" layout="LINENUMBERS" title="# Docker"}}
73 +cd ./16/mysql-tomcat/
74 +docker build -t behemothil/xwiki-mysql-tomcat-nonroot:16.2.0-2 .
75 +docker login
76 +docker push behemothil/xwiki-mysql-tomcat-nonroot:16.2.0-2
77 +{{/code}}
78 +
79 +{{code language="sh" layout="LINENUMBERS" title="# Podman"}}
80 +cd ./16/mysql-tomcat/
81 +buildah build -f Dockerfile -t behemothil/xwiki-mysql-tomcat-nonroot:16.2.0-2
82 +docker push --creds=[Username:[Password]] behemothil/xwiki-mysql-tomcat-nonroot:16.2.0-2
83 +{{/code}}
84 +
85 +=== Deploy ===
86 +
87 +We're going to deploy XWiki as a [[statefulset>>https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/]], the Database (MySQL) and the App, each will have a volume to store their content.
88 +)))
89 +
90 +(% class="col-xs-12 col-sm-4" %)
91 +(((
92 +{{box title="**Contents**"}}
93 +{{toc numbered="true"/}}
94 +{{/box}}
95 +)))
96 +)))