Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elastic install #147

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ jobs:
parameters:
serviceName: planera
subPath: planera
- template: .azure-pipelines/templates/build-service.job.yaml
parameters:
serviceName: elasticsearch
subPath: elasticsearch
5 changes: 5 additions & 0 deletions charts/elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: elasticsearch
apiVersion: v2
version: 0.0.1
appVersion: 0.0.0-dev
10 changes: 10 additions & 0 deletions charts/elasticsearch/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: v1
data:
FOO: bar
kind: ConfigMap
metadata:
annotations: {}
labels:
app: elasticsearch
name: environment
22 changes: 22 additions & 0 deletions charts/elasticsearch/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- envFrom:
- configMapRef:
name: environment
image: {{ .Values.image | default "scouterna.azurecr.io/elasticsearch" }}:{{ .Chart.AppVersion }}
imagePullPolicy: Always
name: app
26 changes: 26 additions & 0 deletions charts/elasticsearch/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
kubernetes.io/tls-acme: "true"
plugins.konghq.com: office-oauth
kubernetes.io/ingress.class: "kong"
name: elasticsearch
spec:
rules:
{{ range .Values.domains }}
- host: {{ . }}
http:
paths:
- path: /
backend:
serviceName: elasticsearch
servicePort: 9200
{{- end }}
tls:
- hosts:
{{ range .Values.domains }}
- {{ . }}
{{- end }}
secretName: elasticsearch-tls
13 changes: 13 additions & 0 deletions charts/elasticsearch/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
spec:
ports:
- port: 80
protocol: TCP
targetPort: 9200
selector:
app: elasticsearch
type: ClusterIP
9 changes: 9 additions & 0 deletions charts/elasticsearch/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
image: scouterna.azurecr.io/wiki
domains:
- localhost
storage:
data:
capacity: 10Gi
images:
capacity: 1Gi
4 changes: 4 additions & 0 deletions charts/elasticsearch/values/dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
image: elasticsearch
domains:
- elasticsearch.localhost
3 changes: 3 additions & 0 deletions charts/elasticsearch/values/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
domains:
- elasticsearch.production.webservices.scouterna.net
3 changes: 3 additions & 0 deletions charts/elasticsearch/values/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
domains:
- elasticsearch.staging.webservices.scouterna.net
41 changes: 41 additions & 0 deletions elasticsearch/.azure-pipelines/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
parameters:
serviceName: ''
subPath: ''
steps:
- bash: |
${{ format('docker build . -t scouterna.azurecr.io/{0}:{1}-{2}', parameters.serviceName, '$BUILD_SOURCEBRANCHNAME', '$BUILD_SOURCEVERSION') }}
displayName: Build docker image
condition: and(succeeded(), eq(variables.updated, 'true'))
workingDirectory: ${{ parameters.supPath }}
- task: Docker@2
inputs:
containerRegistry: 'acr'
repository: ${{ parameters.serviceName }}
command: 'push'
tags: '$(Build.SourceBranchName)-$(Build.SourceVersion)'
displayName: Push docker image
condition: or(and(succeeded(), eq(variables.updated, 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/master')), eq(variables.forcerebuild, 'true'))
- task: HelmInstaller@1
displayName: Install Helm
inputs:
helmVersionToInstall: latest
- task: HelmDeploy@0
displayName: Helm package
inputs:
command: package
chartPath: ${{ format('charts/{0}', parameters.serviceName) }}
destination: $(Build.ArtifactStagingDirectory)
arguments: '--app-version $(Build.SourceBranchName)-$(Build.SourceVersion)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: ${{ format('{0}-chart', parameters.serviceName) }}
publishLocation: 'Container'
condition: or(and(succeeded(), eq(variables.updated, 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/master')), eq(variables.forcerebuild, 'true'))
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: ${{ format('charts/{0}/values/', parameters.serviceName) }}
ArtifactName: ${{ format('{0}-chartvalues', parameters.serviceName) }}
publishLocation: 'Container'
condition: or(and(succeeded(), eq(variables.updated, 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/master')), eq(variables.forcerebuild, 'true'))
22 changes: 22 additions & 0 deletions elasticsearch/.k8s/elasticsearch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- envFrom:
- configMapRef:
name: environment
image: {{ .Values.image | default "scouterna.azurecr.io/template" }}:{{ .Chart.AppVersion }}
imagePullPolicy: Always
name: app
3 changes: 3 additions & 0 deletions elasticsearch/.k8s/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
domains:
- template.production.webservices.scouterna.net
4 changes: 4 additions & 0 deletions elasticsearch/.k8s/values/dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
image: template
domains:
- template.localhost
3 changes: 3 additions & 0 deletions elasticsearch/.k8s/values/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
domains:
- template.production.webservices.scouterna.net
3 changes: 3 additions & 0 deletions elasticsearch/.k8s/values/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
domains:
- template.staging.webservices.scouterna.net
8 changes: 8 additions & 0 deletions elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM docker.elastic.co/elasticsearch/elasticsearch:6.5.4

LABEL maintainer="[email protected]"

COPY --chown=elasticsearch:elasticsearch elasticsearch.yml /usr/share/elasticsearch/config/

EXPOSE 9200
EXPOSE 9300
18 changes: 18 additions & 0 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Elasticsearch install

# Service directory template

When creating a new service, you can use this directory as a template. For a
basic Golang service, three steps are required:

1. Copy this directory. You can put the new directory anywhere in this repo
2. Copy the `charts/template` directory. The new chart should be `charts/[name
of your new service]`
3. Add your new service to `.azure-pipelines.yml` - use the entry for the
`template` service as guidance.

If you're using another programming language, or you need a more complex build:
Update or replace the `Dockerfile` to suit your needs. The only requirement is
that the app should listen to ports `8080` for http or `8443` for https - if
you need another setup, you need to make the corresponding changes to your chart
in `charts`.
1 change: 1 addition & 0 deletions elasticsearch/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## stuff goes here
7 changes: 7 additions & 0 deletions wiki/LocalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@
$wgGroupPermissions['masseditregexeditor']['masseditregex'] = true;
$wgGroupPermissions['sysop']['masseditregex'] = true;

# Install CirrusSearch, Elastica and configure them
wfLoadExtension( 'Elastica' );
wfLoadExtension( 'CirrusSearch' );
$wgCirrusSearchClusters = [ # what is the correct url to the cluster?
'dc-elastic' => [ 'elasticsearch' ], # _only placeholder_
];

wfLoadSkin( 'MinervaNeue' );
$wgMFDefaultSkinClass = 'SkinMinerva';

Expand Down
13 changes: 13 additions & 0 deletions wiki/vendor/CirrusSearch/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"root": true,
"extends": [
"wikimedia/server",
"wikimedia/mediawiki"
],
"ignorePatterns": [
"tests/**/fixtures/**/*"
],
"rules": {
"no-useless-escape": "warn"
}
}
12 changes: 12 additions & 0 deletions wiki/vendor/CirrusSearch/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.svn
*~
*.kate-swp
.*.swp
.indexed
node_modules/
vendor/
composer.lock
.eslintcache
/tests/selenium/log
log
.idea
7 changes: 7 additions & 0 deletions wiki/vendor/CirrusSearch/.gitreview
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gerrit]
host=gerrit.wikimedia.org
port=29418
project=mediawiki/extensions/CirrusSearch.git
track=1
defaultrebase=0
defaultbranch=master
26 changes: 26 additions & 0 deletions wiki/vendor/CirrusSearch/.phan/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';

$cfg['directory_list'] = array_merge(
$cfg['directory_list'],
[
'profiles/',
'../../extensions/Elastica',
'../../extensions/BetaFeatures',
'../../extensions/SiteMatrix',
]
);

$cfg['exclude_analysis_directory_list'] = array_merge(
$cfg['exclude_analysis_directory_list'],
[
'../../extensions/Elastica',
'../../extensions/BetaFeatures',
'../../extensions/SiteMatrix',
]
);

$cfg['enable_class_alias_support'] = true;

return $cfg;
35 changes: 35 additions & 0 deletions wiki/vendor/CirrusSearch/.phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
<exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" />
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
</rule>
<rule ref="MediaWiki.NamingConventions.ValidGlobalName">
<properties>
<property name="ignoreList" type="array" value="$IP" />
</properties>
</rule>
<rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
<properties>
<property name="ignoreList" type="array" value="main,curl_init_pooled" />
</properties>
</rule>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="140" />
</properties>
<exclude-pattern>tests/phpunit/resources/wmf</exclude-pattern>
</rule>
<file>.</file>
<arg name="extensions" value="php"/>
<arg name="encoding" value="UTF-8"/>
</ruleset>
10 changes: 10 additions & 0 deletions wiki/vendor/CirrusSearch/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "stylelint-config-wikimedia",
"rules": {
"no-descending-specificity": null,
"function-url-quotes": null,
"selector-attribute-brackets-space-inside": null,
"unit-disallowed-list": null,
"declaration-property-unit-disallowed-list": null
}
}
1 change: 1 addition & 0 deletions wiki/vendor/CirrusSearch/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct).
Loading