-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from SmartColumbusOS/migrating_chart
SMRT-157 - Moving chart from joomla-docker
- Loading branch information
Showing
11 changed files
with
331 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
library( | ||
identifier: 'pipeline-lib@4.6.1', | ||
retriever: modernSCM([$class: 'GitSCMSource', | ||
remote: 'https://github.com/SmartColumbusOS/pipeline-lib', | ||
credentialsId: 'jenkins-github-user']) | ||
) | ||
|
||
properties([ | ||
pipelineTriggers([scos.dailyBuildTrigger()]), | ||
]) | ||
|
||
def image | ||
def doStageIf = scos.&doStageIf | ||
def doStageIfRelease = doStageIf.curry(scos.changeset.isRelease) | ||
def doStageUnlessRelease = doStageIf.curry(!scos.changeset.isRelease) | ||
def doStageIfPromoted = doStageIf.curry(scos.changeset.isMaster) | ||
|
||
node ('infrastructure') { | ||
ansiColor('xterm') { | ||
scos.doCheckoutStage() | ||
|
||
|
||
doStageUnlessRelease('Deploy to Dev') { | ||
deployTo(environment: 'dev', extraArgs: '--set image.tag=development --set image.pullPolicy=Always --recreate-pods') | ||
} | ||
|
||
doStageIfPromoted('Deploy to Staging') { | ||
deployTo(environment: 'staging') | ||
scos.applyAndPushGitHubTag('staging') | ||
} | ||
|
||
doStageIfRelease('Deploy to Production') { | ||
deployTo(environment: 'prod', internal: false) | ||
scos.applyAndPushGitHubTag('prod') | ||
} | ||
} | ||
} | ||
|
||
def deployTo(params = [:]) { | ||
def environment = params.get('environment') | ||
if (environment == null) throw new IllegalArgumentException("environment must be specified") | ||
|
||
def internal = params.get('internal', true) | ||
def extraArgs = params.get('extraArgs', '') | ||
|
||
scos.withEksCredentials(environment) { | ||
|
||
def terraformOutputs = scos.terraformOutput(environment) | ||
def subnets = terraformOutputs.public_subnets.value.join(/\\,/) | ||
def allowInboundTrafficSG = terraformOutputs.allow_all_security_group.value | ||
def certificateARN = terraformOutputs.root_tls_certificate_arn.value | ||
def ingressScheme = internal ? 'internal' : 'internet-facing' | ||
def rootDnsZone = terraformOutputs.root_dns_zone_name.value | ||
|
||
sh("""#!/bin/bash | ||
set -e | ||
helm init --client-only | ||
helm upgrade --install scos-joomla ./chart \ | ||
--namespace=joomla \ | ||
--values=joomla.yaml \ | ||
--set ingress.enabled="true" \ | ||
--set ingress.scheme="${ingressScheme}" \ | ||
--set ingress.subnets="${subnets}" \ | ||
--set ingress.security_groups="${allowInboundTrafficSG}" \ | ||
--set ingress.root_dns_zone="${rootDnsZone}" \ | ||
--set ingress.certificate_arns="${certificateARN}" \ | ||
${extraArgs} | ||
""".trim()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: Joomla implementation for Smart City OS | ||
name: scos-joomla | ||
version: 0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "scos-joomla.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- 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). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "scos-joomla.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "scos-joomla.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: batch/v1beta1 | ||
kind: CronJob | ||
metadata: | ||
name: joomla-backup | ||
spec: | ||
schedule: "0 0 */1 * *" | ||
concurrencyPolicy: Forbid | ||
successfulJobsHistoryLimit: 1 | ||
failedJobsHistoryLimit: 1 | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: callout | ||
image: buildpack-deps:curl | ||
args: | ||
- /bin/sh | ||
- -ec | ||
- curl -L --max-redirs 1000 "https://www.{{ .Values.ingress.root_dns_zone }}/index.php?option=com_akeeba&view=backup&key=$BACKUP_KEY" | ||
env: | ||
- name: BACKUP_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: joomla-backup-key | ||
key: key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
namespace: {{ .Release.Namespace }} | ||
annotations: | ||
kubernetes.io/ingress.class: alb | ||
alb.ingress.kubernetes.io/scheme: {{ .Values.ingress.scheme }} | ||
alb.ingress.kubernetes.io/tags: scos.delete.on.teardown=true | ||
alb.ingress.kubernetes.io/healthcheck-path: / | ||
alb.ingress.kubernetes.io/healthcheck-path: /health_check.php | ||
alb.ingress.kubernetes.io/subnets: {{ .Values.ingress.subnets }} | ||
alb.ingress.kubernetes.io/security-groups: {{ .Values.ingress.security_groups }} | ||
alb.ingress.kubernetes.io/certificate-arn: {{ .Values.ingress.certificate_arns }} | ||
alb.ingress.kubernetes.io/actions.redirect: '{"Type": "redirect", "RedirectConfig":{"Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}' | ||
alb.ingress.kubernetes.io/actions.redirect-to-datajson: '{"Type": "redirect", "RedirectConfig":{"Protocol": "HTTPS", "Port": "443", "Host": "data.{{ .Values.ingress.root_dns_zone }}", "Path": "/api/v1/data_json", "StatusCode": "HTTP_301"}}' | ||
alb.ingress.kubernetes.io/actions.redirect-to-homepage: '{"Type": "redirect", "RedirectConfig":{"Protocol": "HTTPS", "Port": "443", "Host": "www.{{ .Values.ingress.root_dns_zone }}", "Path": "/data", "StatusCode": "HTTP_301"}}' | ||
alb.ingress.kubernetes.io/actions.redirect-api: '{"Type": "redirect", "RedirectConfig":{"Protocol": "HTTPS", "Port": "443", "Host": "data.{{ .Values.ingress.root_dns_zone }}", "StatusCode": "HTTP_301"}}' | ||
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]' | ||
spec: | ||
backend: | ||
serviceName: {{ .Values.service.name }} | ||
servicePort: {{ .Values.service.port }} | ||
rules: | ||
- host: www.{{ .Values.ingress.root_dns_zone }} | ||
http: | ||
paths: | ||
- path: /data.json | ||
backend: | ||
serviceName: redirect-to-datajson | ||
servicePort: use-annotation | ||
- path: /* | ||
backend: | ||
serviceName: redirect | ||
servicePort: use-annotation | ||
- host: {{ .Values.ingress.root_dns_zone }} | ||
http: | ||
paths: | ||
- path: /* | ||
backend: | ||
serviceName: redirect | ||
servicePort: use-annotation | ||
- host: ckan.{{ .Values.ingress.root_dns_zone }} | ||
http: | ||
paths: | ||
- path: /* | ||
backend: | ||
serviceName: redirect-to-homepage | ||
servicePort: use-annotation | ||
- host: api.{{ .Values.ingress.root_dns_zone }} | ||
http: | ||
paths: | ||
- path: /* | ||
backend: | ||
serviceName: redirect-api | ||
servicePort: use-annotation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ template "scos-joomla.fullname" . }}-storage | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
storageClassName: standard-ssd | ||
accessModes: | ||
- {{ .Values.storage.mode }} | ||
resources: | ||
requests: | ||
storage: {{ .Values.storage.size }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "scos-joomla.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "scos-joomla.name" . }} | ||
helm.sh/chart: {{ include "scos-joomla.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app.kubernetes.io/name: {{ include "scos-joomla.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ template "scos-joomla.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
component: {{ template "scos-joomla.fullname" . }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
component: {{ template "scos-joomla.fullname" . }} | ||
replicas: 1 | ||
strategy: | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
labels: | ||
component: {{ template "scos-joomla.fullname" . }} | ||
app.kubernetes.io/name: {{ include "scos-joomla.name" . }} | ||
helm.sh/chart: {{ include "scos-joomla.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
containers: | ||
- name: joomla | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
volumeMounts: | ||
- mountPath: /var/www/html | ||
name: joomla-data | ||
volumes: | ||
- name: joomla-data | ||
persistentVolumeClaim: | ||
claimName: {{ template "scos-joomla.fullname" . }}-storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Default values for scos-joomla. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
deploy: | ||
updateStrategy: | ||
type: RollingUpdate | ||
|
||
storage: | ||
size: 10Gi | ||
mode: ReadWriteOnce | ||
|
||
image: | ||
repository: 199837183662.dkr.ecr.us-east-2.amazonaws.com/scos/joomla | ||
tag: latest | ||
pullPolicy: IfNotPresent | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
service: | ||
name: scos-joomla | ||
port: 80 | ||
type: NodePort | ||
|
||
ingress: | ||
enabled: true | ||
scheme: "" | ||
subnets: "" | ||
security_groups: "" | ||
root_dns_zone: "" | ||
certificate_arns: "" | ||
|
||
resources: {} | ||
# We usually recommend not to specify default resources and to leave this as a conscious | ||
# choice for the user. This also increases chances charts run on environments with little | ||
# resources, such as Minikube. If you do want to specify resources, uncomment the following | ||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. | ||
# limits: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
# requests: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
image: | ||
tag: 1.1.0 |