-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/Add OpenTelemetry Collector & DevOps Sales Portal (#18)
* Add docs/operations.md * Add Devpro Sales Portal Helm chart * Minor changes in docs * Add OpenTelemetry Collector chart * Enable Opentelemetry in SalesPortal * Bump HobbyFarm chart & fix lint issue
- Loading branch information
Showing
19 changed files
with
505 additions
and
8 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
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,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/ |
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,6 @@ | ||
dependencies: | ||
- name: mongodb | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 13.9.4 | ||
digest: sha256:40f660c388f3965695fbf9ad9f5b36b59f7a7c1ff166cf15cae957c5988d5c72 | ||
generated: "2023-04-18T15:32:14.627874569+02:00" |
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,15 @@ | ||
apiVersion: v2 | ||
name: devpro-salesportal | ||
description: Helm chart for Devpro Sales Portal | ||
type: application | ||
version: 0.1.0 | ||
appVersion: "1.0.0" | ||
dependencies: | ||
- name: mongodb | ||
version: 13.9.4 # MongoDB 6.0.5 | ||
repository: https://charts.bitnami.com/bitnami | ||
alias: mongodb | ||
condition: mongodb.enabled | ||
maintainers: | ||
- name: devpro | ||
email: bertrand@devpro.fr |
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,87 @@ | ||
# Helm chart for Devpro Sales Portal | ||
|
||
This Helm chart will install [Devpro Sales Portal](https://github.com/devpro/sales-portal) on a Kubernetes cluster. | ||
|
||
## Usage | ||
|
||
[Helm](https://helm.sh) must be installed to use the charts. Once correctly setup, add the repository: | ||
|
||
```bash | ||
helm repo add devpro https://devpro.github.io/helm-charts | ||
``` | ||
|
||
If you had already added this repo earlier, run `helm repo update` to retrieve the latest versions of the packages. You can then run `helm search repo sales-portal` to see the charts. | ||
|
||
To install the chart: | ||
|
||
```bash | ||
helm upgrade --install sales-portal devpro/sales-portal --create-namespace --namespace sales-portal | ||
``` | ||
|
||
To uninstall the chart and clean-up the cluster: | ||
|
||
```bash | ||
helm delete sales-portal | ||
kubectl delete ns sales-portal | ||
``` | ||
|
||
## Development | ||
|
||
### Update chart dependencies | ||
|
||
Make sure to run `../../scripts/add_helm_repos.sh` and look at available version with with `helm search repo -l mongodb --versions`. | ||
|
||
Every time you update `Chart.yaml`, run `helm dependency update` to update `Chart.lock`. | ||
|
||
### Linting | ||
|
||
Run `helm lint` to check the chart. | ||
|
||
### Reviewing generated chart | ||
|
||
Run `helm template sales-portal . -f values.yaml > temp.yaml` to look at what is generated. | ||
|
||
## Examples | ||
|
||
### Installation with MongoDB | ||
|
||
```bash | ||
# installs or updates the Helm release | ||
helm upgrade --install sales-portal-beta . -f values.yaml --create-namespace \ | ||
--set mongodb.enabled=true,mongodb.auth.rootPassword=admin \ | ||
--set data.db.connectionString=mongodb://root:admin@sales-portal-beta-mongodb:27017/sales-portal-beta?authSource=admin \ | ||
--set data.db.databaseName=sales-portal-beta \ | ||
--namespace sales-portal-beta | ||
|
||
# (optional) forwards MongoDB port for local access | ||
kubectl port-forward service/sales-portal-beta-mongodb 27017:27017 -n sales-portal-beta | ||
|
||
# forwards port for local access | ||
kubectl port-forward service/salesportal-wasmapp-svc 3001:80 -n sales-portal-beta | ||
|
||
# accesses with http://localhost:3001/ | ||
curl http://localhost:3001/ | ||
|
||
# cleans up | ||
helm delete sales-portal-beta -n sales-portal-beta | ||
kubectl delete ns sales-portal-beta | ||
``` | ||
|
||
### Installation with MongoDB, cert-manager, Let's Encrypt & NGINX Ingress Controller | ||
|
||
```bash | ||
# retrieves public IP | ||
NGINX_PUBLIC_IP=`kubectl get service -n ingress-nginx ingress-nginx-controller --output jsonpath='{.status.loadBalancer.ingress[0].ip}'` | ||
|
||
# applies the manifest (add "--debug > output.yaml" in case of issue) | ||
helm upgrade --install sales-portal-beta . -f values.yaml --create-namespace \ | ||
--set mongodb.enabled=true,mongodb.auth.rootPassword=admin \ | ||
--set data.db.connectionString=mongodb://root:admin@sales-portal-beta-mongodb:27017/sales-portal-beta?authSource=admin \ | ||
--set data.db.databaseName=sales-portal-beta \ | ||
--set ingress.enabled=true,ingress.className=nginx,ingress.annotations.'cert-manager\.io/cluster-issuer'=letsencrypt-prod \ | ||
--set front.host=sales-portal.${NGINX_PUBLIC_IP}.sslip.io,front.tls.secretName=sales-portal-tls \ | ||
--set adapter.host=crm-adapter.${NGINX_PUBLIC_IP}.sslip.io,adapter.tls.secretName=crm-adapter-tls \ | ||
--set data.host=crm-data.${NGINX_PUBLIC_IP}.sslip.io,data.tls.secretName=crm-data-tls \ | ||
--set dotnet.environment=Development,dotnet.enableSwagger=true,dotnet.enableOpenTelemetry=true \ | ||
--namespace sales-portal-beta | ||
``` |
File renamed without changes.
Empty file.
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,93 @@ | ||
{{- $applications := list .Values.front .Values.adapter .Values.data -}} | ||
{{ range $applications }} | ||
{{- $name := .name -}} | ||
{{- if .enabled -}} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .name }} | ||
labels: | ||
app: {{ .name }} | ||
app.kubernetes.io/name: {{ .name }} | ||
spec: | ||
replicas: {{ .replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: {{ .name }} | ||
app.kubernetes.io/name: {{ .name }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ $name }} | ||
app.kubernetes.io/name: {{ $name }} | ||
{{- if .additionalPodLabels }} | ||
{{- toYaml .additionalPodLabels | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: "kubernetes.io/arch" | ||
operator: In | ||
values: ["amd64"] | ||
containers: | ||
- name: {{ .name }} | ||
image: {{ .image }}:{{ .tag }} | ||
imagePullPolicy: Always | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: {{ .healthEndpoint }} | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: {{ .healthEndpoint }} | ||
port: http | ||
resources: | ||
{{- toYaml .resources | nindent 12 }} | ||
{{- $api := .api -}} | ||
{{- $db := .db -}} | ||
{{- with .env }} | ||
env: | ||
- name: HOST_IP | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: status.hostIP | ||
# TODO: only add this variables when needed and manage http calls | ||
- name: ASPNETCORE_ENVIRONMENT | ||
value: "{{ $.Values.dotnet.environment }}" | ||
- name: AllowedOrigins__0 | ||
value: "https://{{ $.Values.front.host }}" | ||
- name: AllowedOrigins__1 | ||
value: "https://{{ $.Values.adapter.host }}" | ||
- name: CrmDataWebApi__Url | ||
value: "https://{{ $.Values.data.host }}" | ||
{{- if $.Values.dotnet.enableSwagger }} | ||
- name: Application__IsSwaggerEnabled | ||
value: "true" | ||
{{- end }} | ||
{{- if $.Values.dotnet.enableOpenTelemetry }} | ||
- name: Application__IsOpenTelemetryEnabled | ||
value: "true" | ||
- name: OpenTelemetry__CollectorEndpoint | ||
value: "http://$(HOST_IP):4317" | ||
{{- end }} | ||
{{- if $db }} | ||
- name: ConnectionStrings__MongoDb | ||
value: {{ $db.connectionString }} | ||
- name: MongoDb__ConnectionStringName | ||
value: "MongoDb" | ||
- name: MongoDb__DatabaseName | ||
value: {{ $db.databaseName }} | ||
{{- end }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- end }} | ||
{{ 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,50 @@ | ||
{{- $applications := list .Values.front .Values.adapter .Values.data -}} | ||
{{ range $applications }} | ||
{{- $name := .name -}} | ||
{{- if and $.Values.ingress.enabled .enabled -}} | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $name }}-ingress | ||
{{- with $.Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if $.Values.ingress.className }} | ||
ingressClassName: {{ $.Values.ingress.className }} | ||
{{- end }} | ||
rules: | ||
- host: {{ .host }} | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: {{ $name }}-svc | ||
port: | ||
number: 80 | ||
{{- range .ingressExtraHosts }} | ||
- host: {{ .host | quote }} | ||
http: | ||
paths: | ||
{{- range .paths }} | ||
- path: {{ .path }} | ||
pathType: {{ .pathType }} | ||
backend: | ||
service: | ||
name: {{ $name }}-svc | ||
port: | ||
number: 80 | ||
{{- end }} | ||
{{- end }} | ||
{{- if .tls }} | ||
tls: | ||
- hosts: | ||
- {{ .host | quote }} | ||
secretName: {{ .tls.secretName }} | ||
{{- end }} | ||
{{- end }} | ||
{{ 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,23 @@ | ||
{{- $applications := list .Values.front .Values.adapter .Values.data -}} | ||
{{ range $applications }} | ||
{{- if .enabled -}} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: {{ .name }} | ||
app.kubernetes.io/name: {{ .name }} | ||
name: {{ .name }}-svc | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 80 | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app: {{ .name }} | ||
app.kubernetes.io/name: {{ .name }} | ||
{{- end }} | ||
{{ end }} |
Oops, something went wrong.