-
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.
added glitchtip service to manage issues from errors in core-engine
- Loading branch information
Andrea Petrucci
committed
Dec 5, 2023
1 parent
5a3fb20
commit 1a7dadf
Showing
12 changed files
with
307 additions
and
3 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,80 @@ | ||
# Documentation: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsuses | ||
name: glitchtip-workflow | ||
run-name: glitchtip workflow | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "glitchtip" | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- prod | ||
paths: | ||
- .github/actions/execute-command-on-kubernetes-cluster/action.yml | ||
- .github/workflows/glitchtip.yml | ||
- core-engine/kubernetes/glitchtip.config-map.yml | ||
- core-engine/kubernetes/glitchtip.deployment.yml | ||
- core-engine/kubernetes/glitchtip.ingress.yml | ||
- core-engine/kubernetes/glitchtip.service.yml | ||
- core-engine/kubernetes/glitchtip.pvc.yml | ||
|
||
pull_request: | ||
paths: | ||
- .github/actions/execute-command-on-kubernetes-cluster/action.yml | ||
- .github/workflows/glitchtip.yml | ||
- core-engine/kubernetes/glitchtip.config-map.yml | ||
- core-engine/kubernetes/glitchtip.deployment.yml | ||
- core-engine/kubernetes/glitchtip.ingress.yml | ||
- core-engine/kubernetes/glitchtip.service.yml | ||
- core-engine/kubernetes/glitchtip.pvc.yml | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
# Only run on main | ||
if: success() && github.ref == 'refs/heads/main' | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Prepare configuration files | ||
shell: bash | ||
working-directory: glitchtip/kubernetes | ||
env: | ||
HOST: https://monitor-swiss-ai-center.kube.isc.heia-fr.ch | ||
ENABLE_USER_REGISTRATION: False | ||
DATABASE_URL: ${{ secrets.GLITCHTIP_DATABASE_URL }} | ||
SECRET_KEY: ${{ secrets.GLITCHTIP_SECRET_KEY }} | ||
PORT: "8000" | ||
EMAIL_URL: ${{ secrets.GLITCHTIP_SMTP_CONFIG }} | ||
GLITCHTIP_DOMAIN: https://monitor-swiss-ai-center.kube.isc.heia-fr.ch | ||
DEFAULT_FROM_EMAIL: "[email protected]" | ||
CELERY_WORKER_AUTOSCALE: "1,3" | ||
CELERY_WORKER_MAX_TASKS_PER_CHILD: "10000" | ||
run: | | ||
# Set Glitchtip configuration (ConfigMap) | ||
yq '.data = (.data | to_entries | map({"key": .key, "value": "${" + .key + "}"}) | from_entries)' glitchtip.config-map.yml | envsubst > new-glitchtip.config-map.yml && mv new-glitchtip.config-map.yml glitchtip.config-map.yml | ||
# Set Glitchtip configuration (Ingress) | ||
yq ".spec.rules[0].host = \"${HOST#*://}\"" glitchtip.ingress.yml > new-glitchtip.ingress.yml && mv new-glitchtip.ingress.yml glitchtip.ingress.yml | ||
yq ".spec.tls[0].hosts[0] = \"${HOST#*://}\"" glitchtip.ingress.yml > new-glitchtip.ingress.yml && mv new-glitchtip.ingress.yml glitchtip.ingress.yml | ||
- name: Deploy Glitchtip on the Kubernetes cluster | ||
uses: ./.github/actions/execute-command-on-kubernetes-cluster | ||
with: | ||
kube-config: ${{ secrets.KUBE_CONFIG_DEV }} | ||
kube-namespace: swiss-ai-center-dev | ||
kubectl-context: ./glitchtip/kubernetes | ||
kubectl-args: | | ||
apply \ | ||
-f glitchtip.config-map.yml \ | ||
-f glitchtip.pvc.yml \ | ||
-f glitchtip.deployment.yml \ | ||
-f glitchtip.service.yml \ | ||
-f glitchtip.ingress.yml |
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,19 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: glitchtip-config | ||
labels: | ||
app: glitchtip | ||
data: | ||
ENABLE_USER_REGISTRATION: False | ||
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres | ||
SECRET_KEY: change_me | ||
PORT: "8000" | ||
EMAIL_URL: "smtp://email:password@smtp_url:465" | ||
GLITCHTIP_DOMAIN: http://localhost:8000 | ||
DEFAULT_FROM_EMAIL: "[email protected]" | ||
CELERY_WORKER_AUTOSCALE: "1,3" | ||
CELERY_WORKER_MAX_TASKS_PER_CHILD: "10000" | ||
POSTGRES_DB: postgres | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres |
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,52 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: glitchtip | ||
labels: | ||
app: glitchtip | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: glitchtip | ||
template: | ||
metadata: | ||
labels: | ||
app: glitchtip | ||
spec: | ||
containers: | ||
- name: glitchtip | ||
image: glitchtip/glitchtip | ||
ports: | ||
- containerPort: 8000 | ||
envFrom: | ||
- configMapRef: | ||
name: glitchtip-config | ||
volumeMounts: | ||
- name: uploads | ||
mountPath: /code/uploads | ||
- name: glitchtip-worker | ||
image: glitchtip/glitchtip | ||
command: ./bin/run-celery-with-beat.sh | ||
envFrom: | ||
- configMapRef: | ||
name: glitchtip-config | ||
volumeMounts: | ||
- name: uploads | ||
mountPath: /code/uploads | ||
- name: glitchtip-migrate | ||
image: glitchtip/glitchtip | ||
command: ./manage.py migrate | ||
envFrom: | ||
- configMapRef: | ||
name: glitchtip-config | ||
volumeMounts: | ||
- name: uploads | ||
mountPath: /code/uploads | ||
- name: redis | ||
image: redis | ||
volumes: | ||
- name: uploads | ||
persistentVolumeClaim: | ||
claimName: uploads-pvc | ||
|
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,20 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: glitchtip-ingress | ||
namespace: pet-via-adv-da-ba23 | ||
spec: | ||
rules: | ||
- host: monitor-swiss-ai-center.kube.isc.heia-fr.ch | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: glitchtip | ||
port: | ||
number: 80 | ||
path: / | ||
pathType: Prefix | ||
tls: | ||
- hosts: | ||
- monitor-swiss-ai-center.kube.isc.heia-fr.ch |
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,10 @@ | ||
apiVersion: apps/v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: uploads-pvc | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi |
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,35 @@ | ||
apiVersion: apps/v1 | ||
kind: Service | ||
metadata: | ||
name: glitchtip | ||
spec: | ||
selector: | ||
app: glitchtip | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 8000 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Service | ||
metadata: | ||
name: postgres | ||
spec: | ||
selector: | ||
app: glitchtip | ||
ports: | ||
- protocol: TCP | ||
port: 5432 | ||
targetPort: 5432 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Service | ||
metadata: | ||
name: redis | ||
spec: | ||
selector: | ||
app: glitchtip | ||
ports: | ||
- protocol: TCP | ||
port: 6379 | ||
targetPort: 6379 |
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
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