Fábio Kaiser Rauber
4 years ago
11 changed files with 482 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||
# 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 |
|||
*.orig |
|||
*~ |
|||
# Various IDEs |
|||
.project |
|||
.idea/ |
|||
*.tmproj |
|||
.vscode/ |
@ -0,0 +1,24 @@ |
|||
apiVersion: v2 |
|||
name: sapl |
|||
description: Sistema de Apoio ao Processo Legislativo (SAPL) |
|||
|
|||
# A chart can be either an 'application' or a 'library' chart. |
|||
type: application |
|||
|
|||
# This is the chart version. This version number should be incremented each time you make changes |
|||
# to the chart and its templates, including the app version. |
|||
# Versions are expected to follow Semantic Versioning (https://semver.org/) |
|||
version: 0.2.0 |
|||
|
|||
# This is the version number of the application being deployed. This version number should be |
|||
# incremented each time you make changes to the application. Versions are not expected to |
|||
# follow Semantic Versioning. They should reflect the version the application is using. |
|||
appVersion: 3.1.161 |
|||
|
|||
icon: https://git.interlegis.leg.br/SEIT/rancher-charts/raw/master/images/sapl.png |
|||
|
|||
dependencies: |
|||
- name: postgresql |
|||
version: 9.8.4 |
|||
repository: https://charts.bitnami.com/bitnami |
|||
condition: postgresql.internal |
@ -0,0 +1,19 @@ |
|||
1. Get the application URL by running these commands: |
|||
{{- if .Values.ingress.enabled }} |
|||
{{- range .Values.ingress.hosts }} |
|||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} |
|||
{{- end }} |
|||
{{- else if contains "NodePort" .Values.service.type }} |
|||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "sapl.fullname" . }}) |
|||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") |
|||
echo http://$NODE_IP:$NODE_PORT |
|||
{{- else if contains "LoadBalancer" .Values.service.type }} |
|||
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 {{ include "sapl.fullname" . }}' |
|||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "sapl.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') |
|||
echo http://$SERVICE_IP:{{ .Values.service.port }} |
|||
{{- else if contains "ClusterIP" .Values.service.type }} |
|||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "sapl.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") |
|||
echo "Visit http://127.0.0.1:8080 to use your application" |
|||
kubectl port-forward $POD_NAME 8080:80 |
|||
{{- end }} |
@ -0,0 +1,58 @@ |
|||
{{/* |
|||
Expand the name of the chart. |
|||
*/}} |
|||
{{- define "sapl.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 "sapl.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 "sapl.chart" -}} |
|||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
|||
{{- end }} |
|||
|
|||
{{/* |
|||
Common labels |
|||
*/}} |
|||
{{- define "sapl.labels" -}} |
|||
helm.sh/chart: {{ include "sapl.chart" . }} |
|||
{{ include "sapl.selectorLabels" . }} |
|||
{{- if .Chart.AppVersion }} |
|||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
|||
{{- end }} |
|||
app.kubernetes.io/managed-by: {{ .Release.Service }} |
|||
{{- end }} |
|||
|
|||
{{/* |
|||
Selector labels |
|||
*/}} |
|||
{{- define "sapl.selectorLabels" -}} |
|||
app.kubernetes.io/name: {{ include "sapl.name" . }} |
|||
app.kubernetes.io/instance: {{ .Release.Name }} |
|||
{{- end }} |
|||
|
|||
{{/* |
|||
Create a default fully qualified app name for postgresql. |
|||
*/}} |
|||
{{- define "postgresql.fullname" -}} |
|||
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} |
|||
{{- end -}} |
@ -0,0 +1,121 @@ |
|||
apiVersion: apps/v1 |
|||
kind: Deployment |
|||
metadata: |
|||
name: {{ include "sapl.fullname" . }} |
|||
labels: |
|||
{{- include "sapl.labels" . | nindent 4 }} |
|||
spec: |
|||
{{- if not .Values.autoscaling.enabled }} |
|||
replicas: {{ .Values.replicaCount }} |
|||
{{- end }} |
|||
selector: |
|||
matchLabels: |
|||
{{- include "sapl.selectorLabels" . | nindent 6 }} |
|||
template: |
|||
metadata: |
|||
{{- with .Values.podAnnotations }} |
|||
annotations: |
|||
{{- toYaml . | nindent 8 }} |
|||
{{- end }} |
|||
labels: |
|||
{{- include "sapl.selectorLabels" . | nindent 8 }} |
|||
spec: |
|||
{{- with .Values.imagePullSecrets }} |
|||
imagePullSecrets: |
|||
{{- toYaml . | nindent 8 }} |
|||
{{- end }} |
|||
securityContext: |
|||
{{- toYaml .Values.podSecurityContext | nindent 8 }} |
|||
containers: |
|||
- name: {{ .Chart.Name }} |
|||
securityContext: |
|||
{{- toYaml .Values.securityContext | nindent 12 }} |
|||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
|||
imagePullPolicy: {{ .Values.image.pullPolicy }} |
|||
ports: |
|||
- name: http |
|||
containerPort: 80 |
|||
protocol: TCP |
|||
env: |
|||
- name: DATABASE_URL |
|||
value: {{ printf "postgresql://%s:%s@%s:5432/%s" .Values.postgresql.postgresqlUsername .Values.postgresql.postgresqlPassword (include "postgresql.fullname" .) .Values.postgresql.postgresqlDatabase| quote }} |
|||
- name: ADMIN_PASSWORD |
|||
value: "{{ .Values.sapl.adminPassword }}" |
|||
- name: ADMIN_EMAIL |
|||
value: "{{ .Values.sapl.adminEmail }}" |
|||
- name: EMAIL_SEND_USER |
|||
value: "{{ .Values.sapl.emailSendUser }}" |
|||
- name: DEBUG |
|||
value: "{{ .Values.sapl.debug }}" |
|||
- name: USE_TLS |
|||
value: "{{ .Values.sapl.useTls }}" |
|||
- name: EMAIL_PORT |
|||
value: "{{ .Values.sapl.emailPort }}" |
|||
- name: EMAIL_HOST |
|||
value: "{{ .Values.sapl.emailHost }}" |
|||
- name: TZ |
|||
value: "{{ .Values.sapl.timeZone }}" |
|||
- name: USE_SOLR |
|||
value: "{{ .Values.sapl.useSolr }}" |
|||
- name: SOLR_COLLECTION |
|||
value: "{{ .Values.sapl.solrCollection }}" |
|||
- name: SOLR_URL |
|||
value: "{{ .Values.sapl.solrUrl }}" |
|||
- name: NUM_SHARDS |
|||
value: "{{ .Values.sapl.solrNumShards }}" |
|||
- name: RF |
|||
value: "{{ .Values.sapl.solrReplFactor }}" |
|||
- name: MAX_SHARDS_PER_NODE |
|||
value: "{{ .Values.sapl.solrMaxShardsPerNode }}" |
|||
volumeMounts: |
|||
- mountPath: /var/interlegis/sapl/data |
|||
name: data |
|||
- mountPath: /var/interlegis/sapl/media |
|||
name: media |
|||
livenessProbe: |
|||
httpGet: |
|||
path: / |
|||
port: http |
|||
initialDelaySeconds: 60 |
|||
failureThreshold: 3 |
|||
periodSeconds: 60 |
|||
successThreshold: 1 |
|||
timeoutSeconds: 5 |
|||
readinessProbe: |
|||
httpGet: |
|||
path: / |
|||
port: http |
|||
initialDelaySeconds: 60 |
|||
failureThreshold: 3 |
|||
periodSeconds: 30 |
|||
successThreshold: 1 |
|||
timeoutSeconds: 5 |
|||
resources: |
|||
{{- toYaml .Values.resources | nindent 12 }} |
|||
volumes: |
|||
- name: data |
|||
{{- if .Values.persistence.enabled }} |
|||
persistentVolumeClaim: |
|||
claimName: data |
|||
{{- else }} |
|||
emptyDir: {} |
|||
{{- end }} |
|||
- name: media |
|||
{{- if .Values.persistence.enabled }} |
|||
persistentVolumeClaim: |
|||
claimName: media |
|||
{{- else }} |
|||
emptyDir: {} |
|||
{{- end }} |
|||
{{- with .Values.nodeSelector }} |
|||
nodeSelector: |
|||
{{- toYaml . | nindent 8 }} |
|||
{{- end }} |
|||
{{- with .Values.affinity }} |
|||
affinity: |
|||
{{- toYaml . | nindent 8 }} |
|||
{{- end }} |
|||
{{- with .Values.tolerations }} |
|||
tolerations: |
|||
{{- toYaml . | nindent 8 }} |
|||
{{- end }} |
@ -0,0 +1,28 @@ |
|||
{{- if .Values.autoscaling.enabled }} |
|||
apiVersion: autoscaling/v2beta1 |
|||
kind: HorizontalPodAutoscaler |
|||
metadata: |
|||
name: {{ include "sapl.fullname" . }} |
|||
labels: |
|||
{{- include "sapl.labels" . | nindent 4 }} |
|||
spec: |
|||
scaleTargetRef: |
|||
apiVersion: apps/v1 |
|||
kind: Deployment |
|||
name: {{ include "sapl.fullname" . }} |
|||
minReplicas: {{ .Values.autoscaling.minReplicas }} |
|||
maxReplicas: {{ .Values.autoscaling.maxReplicas }} |
|||
metrics: |
|||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }} |
|||
- type: Resource |
|||
resource: |
|||
name: cpu |
|||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} |
|||
{{- end }} |
|||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} |
|||
- type: Resource |
|||
resource: |
|||
name: memory |
|||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} |
|||
{{- end }} |
|||
{{- end }} |
@ -0,0 +1,39 @@ |
|||
{{- if .Values.ingress.enabled -}} |
|||
{{- $fullName := include "sapl.fullname" . -}} |
|||
{{- $ingressPath := .Values.ingress.path -}} |
|||
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} |
|||
apiVersion: networking.k8s.io/v1beta1 |
|||
{{- else -}} |
|||
apiVersion: extensions/v1beta1 |
|||
{{- end }} |
|||
kind: Ingress |
|||
metadata: |
|||
name: {{ $fullName }} |
|||
labels: |
|||
{{- include "sapl.labels" . | nindent 4 }} |
|||
{{- with .Values.ingress.annotations }} |
|||
annotations: |
|||
{{- toYaml . | nindent 4 }} |
|||
{{- end }} |
|||
spec: |
|||
{{- if .Values.ingress.tls }} |
|||
tls: |
|||
{{- range .Values.ingress.tls }} |
|||
- hosts: |
|||
{{- range .hosts }} |
|||
- {{ . | quote }} |
|||
{{- end }} |
|||
secretName: {{ .secretName }} |
|||
{{- end }} |
|||
{{- end }} |
|||
rules: |
|||
{{- range .Values.ingress.hosts }} |
|||
- host: {{ . | quote }} |
|||
http: |
|||
paths: |
|||
- path: {{ $ingressPath }} |
|||
backend: |
|||
serviceName: {{ $fullName }} |
|||
servicePort: http |
|||
{{- end }} |
|||
{{- end }} |
@ -0,0 +1,19 @@ |
|||
{{- if .Values.persistence.enabled }} |
|||
apiVersion: v1 |
|||
kind: PersistentVolumeClaim |
|||
metadata: |
|||
name: data |
|||
spec: |
|||
accessModes: |
|||
- {{ .Values.persistence.accessMode }} |
|||
resources: |
|||
requests: |
|||
storage: {{ .Values.persistence.size }} |
|||
{{- if .Values.persistence.storageClass }} |
|||
{{- if (eq "-" .Values.persistence.storageClass) }} |
|||
storageClassName: "" |
|||
{{- else }} |
|||
storageClassName: "{{ .Values.persistence.storageClass }}" |
|||
{{- end }} |
|||
{{- end }} |
|||
{{- end }} |
@ -0,0 +1,19 @@ |
|||
{{- if .Values.persistence.enabled }} |
|||
apiVersion: v1 |
|||
kind: PersistentVolumeClaim |
|||
metadata: |
|||
name: media |
|||
spec: |
|||
accessModes: |
|||
- {{ .Values.persistence.accessMode }} |
|||
resources: |
|||
requests: |
|||
storage: {{ .Values.persistence.size }} |
|||
{{- if .Values.persistence.storageClass }} |
|||
{{- if (eq "-" .Values.persistence.storageClass) }} |
|||
storageClassName: "" |
|||
{{- else }} |
|||
storageClassName: "{{ .Values.persistence.storageClass }}" |
|||
{{- end }} |
|||
{{- end }} |
|||
{{- end }} |
@ -0,0 +1,15 @@ |
|||
apiVersion: v1 |
|||
kind: Service |
|||
metadata: |
|||
name: {{ include "sapl.fullname" . }} |
|||
labels: |
|||
{{- include "sapl.labels" . | nindent 4 }} |
|||
spec: |
|||
type: {{ .Values.service.type }} |
|||
ports: |
|||
- port: {{ .Values.service.port }} |
|||
targetPort: http |
|||
protocol: TCP |
|||
name: http |
|||
selector: |
|||
{{- include "sapl.selectorLabels" . | nindent 4 }} |
@ -0,0 +1,117 @@ |
|||
# Default values for sapl. |
|||
# This is a YAML-formatted file. |
|||
# Declare variables to be passed into your templates. |
|||
|
|||
replicaCount: 1 |
|||
|
|||
image: |
|||
repository: interlegis/sapl |
|||
pullPolicy: IfNotPresent |
|||
# Overrides the image tag whose default is the chart appVersion. |
|||
tag: "" |
|||
|
|||
imagePullSecrets: [] |
|||
nameOverride: "" |
|||
fullnameOverride: "" |
|||
|
|||
serviceAccount: |
|||
# Specifies whether a service account should be created |
|||
create: true |
|||
# Annotations to add to the service account |
|||
annotations: {} |
|||
# The name of the service account to use. |
|||
# If not set and create is true, a name is generated using the fullname template |
|||
name: "" |
|||
|
|||
podAnnotations: {} |
|||
|
|||
podSecurityContext: {} |
|||
# fsGroup: 2000 |
|||
|
|||
securityContext: {} |
|||
# capabilities: |
|||
# drop: |
|||
# - ALL |
|||
# readOnlyRootFilesystem: true |
|||
# runAsNonRoot: true |
|||
# runAsUser: 1000 |
|||
|
|||
service: |
|||
type: ClusterIP |
|||
port: 80 |
|||
|
|||
persistence: |
|||
enabled: true |
|||
#storageClass: "" |
|||
accessMode: ReadWriteOnce |
|||
size: 500Mi |
|||
|
|||
sapl: |
|||
adminPassword: altereme |
|||
adminEmail: contato@tecnico.net |
|||
emailSendUser: no-reply@domain.net |
|||
debug: 'False' |
|||
useTls: 'False' |
|||
emailPort: 25 |
|||
emailHost: smtp.domain.net |
|||
timeZone: 'America/Sao_Paulo' |
|||
useSolr: 'True' |
|||
solrCollection: 'sapl' |
|||
solrUrl: 'http://localhost:8983' |
|||
solrNumShards: 1 |
|||
solrReplFactor: 2 |
|||
solrMaxShardsPerNode: 1 |
|||
|
|||
ingress: |
|||
enabled: true |
|||
annotations: {} |
|||
# kubernetes.io/ingress.class: nginx |
|||
# kubernetes.io/tls-acme: "true" |
|||
path: / |
|||
hosts: |
|||
- chart-example.local |
|||
tls: [] |
|||
# - secretName: chart-example-tls |
|||
# hosts: |
|||
# - chart-example.local |
|||
|
|||
postgresql: |
|||
internal: true |
|||
image: |
|||
tag: 9.6.12-r66 |
|||
pullPolicy: IfNotPresent |
|||
service: |
|||
type: ClusterIP |
|||
port: 5432 |
|||
persistence: |
|||
enabled: true |
|||
size: 10Gi |
|||
postgresqlPassword: altereme |
|||
postgresqlUsername: sapl |
|||
postgresqlDatabase: sapl |
|||
resources: |
|||
requests: |
|||
cpu: 50m |
|||
memory: 64Mi |
|||
|
|||
|
|||
resources: |
|||
# limits: |
|||
# cpu: 100m |
|||
# memory: 128Mi |
|||
requests: |
|||
cpu: 100m |
|||
memory: 330Mi |
|||
|
|||
autoscaling: |
|||
enabled: false |
|||
minReplicas: 1 |
|||
maxReplicas: 100 |
|||
targetCPUUtilizationPercentage: 80 |
|||
# targetMemoryUtilizationPercentage: 80 |
|||
|
|||
nodeSelector: {} |
|||
|
|||
tolerations: [] |
|||
|
|||
affinity: {} |
Loading…
Reference in new issue