This project containerizes the Media Wiki application along with Mariadb under Centos 7.
Following are the prerequisite before going forward:
You can use my docker hub images, else you can create you own image beofre create run docker login.
$ docker pull ksingh3/mediawiki:deploy
$ docker pull ksingh3/mediawiki:db
If you want to create you own image login to docker hub before proceeding and complete the authentication
$ docker login
$ git clone https://github.com/ksingh3/MediaWiki.git
$ cd MediaWiki/Docker/Application
$ docker build -t ksingh3/mediawiki:deploy .
$ cd /MediaWiki/Docker/Database
$ docker build -t ksingh3/mediawiki:db .
$ kubectl create ns wm
$ cd MediaWiki/Charts/mywiki-db
$ helm upgrade --install mywiki-db -f values.yaml . -n wm
Login to Database pod
$ export POD_NAME=$(kubectl get pods --namespace wm -l "app.kubernetes.io/name=mywiki-db,app.kubernetes.io/instance=mywiki-db" -o jsonpath="{.items[0].metadata.name}")
$ kubectl exec -it $POD_NAME -n wm bash
Open mysql terminal
$ mysql
Run to give perms to root user
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES;
Exit from the pod.
mywiki-db.wm.svc.cluster.local
$ cd MediaWiki/Charts/mywiki
$ helm upgrade --install mywiki -f values.yaml . -n wm
$ export POD_NAME=$(kubectl get pods --namespace wm -l "app.kubernetes.io/name=mywiki,app.kubernetes.io/instance=mywiki" -o jsonpath="{.items[0].metadata.name}")
$ kubectl --namespace wm port-forward $POD_NAME 8080:80
Open the application on http://localhost:8080
update the hostname to mywiki-db.wm.svc.cluster.local
Update config property in File: Values.yaml using the downloaded LocalSettings.php.
helm upgrade --install mywiki -f values.yaml . -n wm --set upgrade=Yes
This time it will mount LocalSettings.php file under /var/www/html/
using config map.
To automate rolling update, we can make use of secrets under Settings and making use of following Action: https://github.com/marketplace/actions/helm-3
name: Deploy
on:
release:
types: [created]
jobs:
deployment:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v1
- name: Deploy
uses: WyriHaximus/github-action-helm3@v2
with:
exec: helm upgrade --install mywiki -f values.yaml . -n wm --set upgrade=Yes
kubeconfig: '${{ secrets.KUBECONFIG }}'
secrets.KUBECONFIG is kubeconfig saved inside github secrets.