Skip to content

Commit

Permalink
Merge pull request #16 from xwiki-contrib/dev-v1
Browse files Browse the repository at this point in the history
HELM-19  Upgrade Definitions (Helm, Kubernetes) and Dependencies (Database)
  • Loading branch information
gsautner committed May 3, 2023
2 parents 3014c8b + 6f522f8 commit d62ee8e
Show file tree
Hide file tree
Showing 45 changed files with 1,050 additions and 605 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Releases

on:
push:
branches:
- master
- dev-v1
paths:
- '.github/**'
- 'charts/**'
- '!**.md'

jobs:

validate:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.changed.outputs.result }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- id: changed
name: Changed
run: |
files_changed="$(git show --pretty="" --name-only)"
echo "$files_changed"
num_version_bumps="$(echo "$files_changed" | grep Chart.yaml | xargs git show | grep -c "+version" || true)"
if [[ "$num_version_bumps" -eq "1" ]]; then
echo "result=ok" >> $GITHUB_OUTPUT
else
echo "result=skip"
echo "::warning::Version not changed, skipping release job..."
fi
- name: Tests
if: ${{ steps.changed.outputs.result == 'ok' }}
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm plugin install https://github.com/helm-unittest/helm-unittest
for FILE in charts/*; do
helm dependency update $FILE
helm unittest $FILE
done
release:
needs: validate
if: ${{ needs.validate.outputs.result == 'ok' }}
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v3

- name: Add repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm plugin install https://github.com/helm-unittest/helm-unittest
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.5.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests

on:
push:
paths:
- '.github/**'
- 'charts/**'
- '!**.md'

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Helm
uses: azure/setup-helm@v3

- name: Add repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm plugin install https://github.com/helm-unittest/helm-unittest
- name: Run unit tests
run: |
for FILE in charts/*; do
helm dependency update $FILE
helm unittest $FILE
done
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.DS_STORE
charts/
charts/*/charts
2 changes: 1 addition & 1 deletion .helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
.project
.idea/
*.tmproj
tests/
charts/*/tests/
16 changes: 0 additions & 16 deletions Chart.yaml

This file was deleted.

47 changes: 5 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,21 @@

This is the XWiki [Helm Chart](https://helm.sh/) aiming to ease the deployment in both Local and Highly Available setups.

## Usage

Please check the [documentation](https://extensions.xwiki.org/xwiki/bin/view/Extension/XWikiHelm/) about this chart.

## Resources

* XWiki Installation Guide: https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation
* XWiki Docker : https://github.com/xwiki-contrib/docker-xwiki


## Prerequisite

* Minikube
* Kubectl cli
* helm cli

## Installation on Minikube

* First, enable ingress

```bash
minikube addons enable ingress
```

* Install chart

```bash
git clone https://github.com/xwiki-contrib/xwiki-helm
cd xwiki-helm-chart
helm dependency update
helm --debug upgrade -i --force xwiki -f ./values.yaml .
```

## Usage

Get ip address of minikube

```bash
ip=$(minikube ip)
curl $ip
```

## Test

For testing first add [unittest](https://github.com/lrills/helm-unittest#install)
```bash
helm plugin install https://github.com/lrills/helm-unittest
helm unittest xwiki-helm
```

## Project Information

* Project Lead: [Ashish Sharma](https://www.xwiki.org/xwiki/bin/view/XWiki/ashish932)
* [Documentation](https://extensions.xwiki.org/xwiki/bin/view/Extension/XWikiHelm/)
* [Issue Tracker](http://jira.xwiki.org/browse/HELM)
* Communication: [Mailing List](http://dev.xwiki.org/xwiki/bin/view/Community/MailingLists), [IRC](http://dev.xwiki.org/xwiki/bin/view/Community/IRC)
* Communication: [Forums & Mailing Lists](https://dev.xwiki.org/xwiki/bin/view/Community/Discuss), [Chat](https://dev.xwiki.org/xwiki/bin/view/Community/Chat)
* [Development Practices](http://dev.xwiki.org)
* Minimal XWiki version supported: XWiki 8.4
* License: LGPL 2.1
Expand Down
15 changes: 15 additions & 0 deletions charts/xwiki/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
version: 2.2.2
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 9.4.8
- name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 11.4.5
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.1.13
digest: sha256:eed001db0c159eb0e99d9c5c22ec579a79fe4d80c5d6ed2418f5d0472a08d9d0
generated: "2023-02-02T10:11:09.3444207-03:00"
35 changes: 35 additions & 0 deletions charts/xwiki/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: v2
description: XWiki is a free wiki software platform written in Java with a design emphasis on extensibility. XWiki is an enterprise wiki. It includes WYSIWYG editing, OpenDocument based document import/export, semantic annotations and tagging, and advanced permissions management.
name: xwiki
version: 1.0.0-Beta.3
type: application
keywords:
- xwiki
home: http://xwiki.org
icon: https://www.xwiki.org/xwiki/bin/download/Main/Logo/logo-x.png
sources:
- https://github.com/xwiki-contrib/docker-xwiki
maintainers:
- name: Ashish Sharma
email: sharma.ashish960@gmail.com
- name: Ludovic Dubost
email: ludovic@xwiki.com
- name: Guilherme Sautner
email: guilherme.sautner@xwiki.com
dependencies:
- name: "common"
repository: "https://charts.bitnami.com/bitnami"
version: "2.2.2"
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 9.4.8
condition: mysql.enabled
- name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 11.4.5
condition: mariadb.enabled
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.1.13
condition: postgresql.enabled

6 changes: 3 additions & 3 deletions templates/NOTES.txt → charts/xwiki/templates/NOTES.txt
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

{{- if contains "NodePort" .Values.service.type }}
Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "xwiki.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT/xwiki/
{{- else if contains "LoadBalancer" .Values.service.type }}
Get the application URL by running these commands:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
You can watch the status of by running 'kubectl get svc -w {{ template "xwiki.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "xwiki.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- end }}
47 changes: 47 additions & 0 deletions charts/xwiki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "xwiki.name" -}}
{{- include "common.names.name" . }}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "xwiki.fullname" -}}
{{- include "common.names.fullname" . }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "xwiki.labels" -}}
{{- include "common.labels.standard" . }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "xwiki.selectorLabels" -}}
{{- include "common.labels.matchLabels" . }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "xwiki.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "xwiki.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of init scripts configmap
*/}}
{{- define "xwiki.initScripts" -}}
{{- printf "%s-init-scripts" (include "xwiki.fullname" .) }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
{{- $fullName := include "xwiki.fullname" . -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}
name: {{ $fullName }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- include "xwiki.labels" . | nindent 4 }}
data:
{{- if .Values.solr.enabled }}
INDEX_HOST: {{ .Values.solr.host | quote }}
INDEX_PORT: {{ .Values.solr.port | quote }}
{{- end }}
{{- if .Values.mysql.enabled }}
DB_USER: {{ .Values.mysql.mysqlUser | quote }}
{{- if .Values.mariadb.enabled }}
DB_USER: {{ .Values.mariadb.auth.username | quote }}
DB_HOST: "{{ .Release.Name }}-mariadb"
DB_DATABASE: {{ .Values.mariadb.auth.database | quote }}
{{- else if .Values.mysql.enabled }}
DB_USER: {{ .Values.mysql.auth.username | quote }}
DB_HOST: "{{ .Release.Name }}-mysql"
DB_DATABASE: {{ .Values.mysql.mysqlDatabase | quote }}
DB_DATABASE: {{ .Values.mysql.auth.database | quote }}
{{- else if .Values.postgresql.enabled }}
DB_USER: {{ .Values.postgresql.postgresqlUsername | quote }}
DB_USER: {{ .Values.postgresql.auth.username | quote }}
DB_HOST: "{{ .Release.Name }}-postgresql"
DB_DATABASE: {{ .Values.postgresql.postgresqlDatabase | quote }}
DB_DATABASE: {{ .Values.postgresql.auth.database | quote }}
{{- else }}
DB_USER: {{ .Values.externalDB.user | quote }}
DB_HOST: {{ .Values.externalDB.host | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ spec:
- destination:
port:
number: {{ .Values.service.externalPort }}
host: {{ template "fullname" . }}
host: {{ template "xwiki.fullname" . }}
{{- end -}}
Loading

0 comments on commit d62ee8e

Please sign in to comment.