Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Split setup into services
Browse files Browse the repository at this point in the history
Note: This patch also temporarily disables the math extension, as the
code for that is not actually checked out in the mediawiki-docker image.
  • Loading branch information
gwicke authored and d00rman committed Jun 13, 2017
1 parent 8a26146 commit 093f4cf
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 59 deletions.
213 changes: 155 additions & 58 deletions k8s-alpha.yml
@@ -1,7 +1,83 @@
# BEGIN MySQL

apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: mysql-deploy
spec:
replicas: 1
template:
metadata:
labels:
service_name: mysql
spec:
containers:
- name: mysql
image: mariadb
env:
- name: MYSQL_ROOT_PASSWORD
value: password
volumeMounts:
- name: mysql-storage
mountPath: /var/lib/mysql

volumes:
- name: mysql-storage
hostPath:
path: /var/lib/mediawiki-containers/mysql
---
apiVersion: v1
kind: Service
metadata:
name: mysql-svc
spec:
type: ClusterIP
ports:
- port: 3306
selector:
service_name: mysql

# END MySQL

---
# BEGIN MediaWiki

apiVersion: v1
kind: ConfigMap
metadata:
name: mediawiki-conf-1
data:
CustomSettings.php: |
<?php
/**
* VisualEditor
*/
wfLoadExtension( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVirtualRestConfig['modules']['restbase'] = array(
'url' => 'http://restbase-svc:7231',
'domain' => 'localhost',
'forwardCookies' => true,
'parsoidCompat' => false
);
/**
* Math
*/
#wfLoadExtension( 'Math' );
#$wgMathValidModes[] = 'mathml';
#$wgDefaultUserOptions['math'] = 'mathml';
#$wgMathFullRestbaseURL = 'http://restbase-svc:7231/localhost/';
#unset($GLOBALS['wgMathMathMLUrl']);
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: mediawiki-pod
name: mediawiki-deploy
spec:
replicas: 1
template:
Expand All @@ -11,7 +87,7 @@ spec:
spec:
containers:
- name: mediawiki
image: wikimedia/mediawiki
image: wikimedia/mediawiki:1.30.0-wmf3
ports:
- containerPort: 80
env:
Expand All @@ -27,96 +103,117 @@ spec:
value: admin
- name: MEDIAWIKI_UPDATE
value: 'true'
- name: MEDIAWIKI_DB_TYPE
value: mysql
- name: MEDIAWIKI_DB_USER
value: root
- name: MEDIAWIKI_DB_PASSWORD
value: password
- name: MEDIAWIKI_DB_HOST
value: 127.0.0.1
value: mysql-svc
- name: MEDIAWIKI_RESTBASE_URL
value: http://localhost:7231/api/rest_v1
value: http://restbase-svc:7231/localhost/v1
volumeMounts:
- name: mediawiki-storage
mountPath: /data
- name: mediawiki-conf
mountPath: /conf

volumes:
- name: mediawiki-storage
hostPath:
path: /var/lib/mediawiki-containers/mediawiki
- name: mediawiki-conf
configMap:
name: mediawiki-conf-1

---
apiVersion: v1
kind: Service
metadata:
name: mediawiki-svc
spec:
type: NodePort
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
service_name: mediawiki

# END MediaWiki
---
# BEGIN RESTBase
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: restbase-deploy
spec:
replicas: 1
template:
metadata:
labels:
service_name: restbase
spec:
containers:
- name: mediawiki-node-services
image: wikimedia/mediawiki-node-services:0.2.1
env:
- name: MEDIAWIKI_API_URL
value: http://localhost/api.php
value: http://mediawiki-svc/api.php
volumeMounts:
- name: node-services-storage
mountPath: /data

- name: mathoid
image: wikimedia/mathoid:24b660f09
ports:
- containerPort: 10044

- name: mysql
image: mariadb
env:
- name: MYSQL_ROOT_PASSWORD
value: password
volumeMounts:
- name: mysql-storage
mountPath: /var/lib/mysql

volumes:
- name: node-services-storage
hostPath:
path: /var/lib/mediawiki-containers/node-services
- name: mediawiki-storage
hostPath:
path: /var/lib/mediawiki-containers/mediawiki
- name: mysql-storage
hostPath:
path: /var/lib/mediawiki-containers/mysql
- name: mediawiki-conf
configMap:
name: mediawiki-conf-1

---
apiVersion: v1
kind: ConfigMap
kind: Service
metadata:
name: mediawiki-conf-1
data:
CustomSettings.php: |
<?php
/**
* VisualEditor
*/
require_once "/usr/src/mediawiki/extensions/VisualEditor/VisualEditor.php";
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVirtualRestConfig['modules']['restbase'] = array(
'url' => 'http://localhost:7231',
'domain' => 'localhost',
'forwardCookies' => true,
'parsoidCompat' => false
);
name: restbase-svc
spec:
type: ClusterIP
ports:
- port: 7231
protocol: TCP
selector:
service_name: restbase

/**
* Math
*/
$wgDefaultUserOptions['math'] = 'mathml';
$wgMathFullRestbaseURL = 'http://localhost:7231/localhost/';
wfLoadExtension( 'Math' );
# END RESTBase

---
# BEGIN Mathoid
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: mathoid-deploy
spec:
replicas: 1
template:
metadata:
labels:
service_name: mathoid
spec:
containers:
- name: mathoid
image: wikimedia/mathoid:24b660f09
ports:
- containerPort: 10044
---
apiVersion: v1
kind: Service
metadata:
name: mediawiki-svc
name: mathoid-svc
spec:
type: NodePort
type: ClusterIP
ports:
- port: 80
- port: 10044
protocol: TCP
targetPort: 80
selector:
service_name: mediawiki
service_name: mathoid

# END Mathoid

2 changes: 1 addition & 1 deletion mediawiki-containers
Expand Up @@ -87,8 +87,8 @@ start () {
-e MEDIAWIKI_ADMIN_PASS=$MEDIAWIKI_ADMIN_PASS \
-e MEDIAWIKI_UPDATE=true \
-e MEDIAWIKI_DB_USER=root \
-e MEDIAWIKI_DB_HOST=mysql.docker \
-e MEDIAWIKI_DB_PASSWORD=password \
-e MEDIAWIKI_DB_HOST=mysql.docker \
-e MEDIAWIKI_RESTBASE_URL=http://mediawiki-node-services.docker:7231/localhost/v1 \
--dns "$DNS" \
-p 80:80 \
Expand Down

0 comments on commit 093f4cf

Please sign in to comment.