Skip to content

Commit

Permalink
fix(n8n): fix n8n preprod deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
cberthou committed Oct 14, 2021
1 parent b818f03 commit ce89989
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 221 deletions.
2 changes: 1 addition & 1 deletion .github/preprod.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SOCIALGOUV_BASE_DOMAIN=dev2.fabrique.social.gouv.fr
SOCIALGOUV_BASE_DOMAIN=dev.fabrique.social.gouv.fr
REACT_APP_SEARCH_KEY=search-rrd6p1xcar27szk43fdwkqu8
REACT_APP_SEARCH_ENGINE_NAME=fce
REACT_APP_SEARCH_ENDPOINT_BASE=https://appsearch-fce-ppd.fabrique.social.gouv.fr
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/build-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ jobs:
cd ./src/client
CI=false npm run build
- name: Build docker image
run: |
cd ./src/client
docker build -t fce-client .
- id: docker_meta
uses: "crazy-max/ghaction-docker-meta@2e1a5c7fa42123697f82d479b551a1bbdb1bef88"
with:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build
on:
push:
branches:
- 'build-*'
- '**'

concurrency:
cancel-in-progress: true
Expand Down Expand Up @@ -355,17 +355,12 @@ jobs:
env:
SHA: ${{ github.sha }}
SOCIALGOUV_CONFIG_PATH: ${{ github.workspace }}/.socialgouv/config.json
SOCIALGOUV_KUBE_INGRESS_BASE_DOMAIN: ${{ env.SOCIALGOUV_KUBE_INGRESS_BASE_DOMAIN }}

- name: Generate k8s namespace
run: yarn -s k8s generate:dev _namespace > namespace.yml
env:
SHA: ${{ github.sha }}
SOCIALGOUV_CONFIG_PATH: ${{ github.workspace }}/.socialgouv/config.json
SOCIALGOUV_KUBE_INGRESS_BASE_DOMAIN: ${{ env.SOCIALGOUV_KUBE_INGRESS_BASE_DOMAIN }}

- name: Control manifests
run: cat manifests.yml

- name: Archive k8s manifests
uses: actions/upload-artifact@v2
Expand Down
65 changes: 2 additions & 63 deletions .k8s/__tests__/__snapshots__/dev.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,13 @@ spec:
volumeMounts:
- name: downloads
mountPath: /tmp/download
- mountPath: /home/node/.n8n
name: n8n-db
envFrom:
- secretRef:
name: n8n-env
- configMapRef:
name: n8n-env
volumes:
- name: downloads
- name: n8n-db
persistentVolumeClaim:
claimName: n8n-db
---
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
Expand Down Expand Up @@ -331,6 +326,8 @@ spec:
AgA5yfdvG0fGNmiFmzeFtRwLEJ8c2QPGT/04TWyNanjKOHedOk/yQpnJ/s3r14iYYzHTkeNtvjYaBsB8xwPIKX5bn+vHsM4i2poqnP2UrmIDspOdkbYnwpamkOZpD5f6Y8tCpJukym4F0D6XYmaimtbnUUepz9ipAgp/iPtBi2aU1bYL9zqW3fzkV51O0U11xbeiVaTD+ClClnt+Ehpwxu05454uIRuAkW3EqRi4DAH8CRWPAvAUHNUKYTYj4mhR+kiCwc4sR44jtCMTT2STlbu4bgW/Kj/aTrQYcL8AakVzWl/fyA+drrrGYdPTGnl1nNEPHmdG9neigN6Bkn500gA5tNA4clpKWiJoTWKv0YElsPwpDA5lsNGqP/bZtP71WngwyFwsQHrkbjNhPJ6bEeT+deSNCtKgA/Rtpxi6J8D7/uIpCCU/BhgMeBCg1NTfd2K9x5/zFU83MZ74+4E02WMFBHYGgBJO9tP7ex8qNWevpO9GXNyH09cpR9QWcpCfdRAZcgCcQmMkYcrWHzd6kVoEl1yr3Agh2RFDdSYcSz1XKUV8VJzhg/Vq28Jsx3Ci9jXExrQm5cDF4YmRu/Ox+E+5DFcCHLIjqLteZqWLx9x2TMkgK32o/q2WnU6T5Bi5Si0lGb/zLn7/Gf4QrW477ePDrkRyOCH4Rxxw+y8M3A19/vfkEj3E/w7v8bJefLTxobpKQAE=
N8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sI3j73ds0PSysW/smZSojEFN8xTS/erwNwOrT6Z2Vx4hp2JgfMG6kJbiFtzW3Irekihy7llEDHRfUzr5DB/WLKKH6qzSiNro6egb1oljIczpG6ohnVSn+TJw77PHKS+6R3//zstPw7WAg==
PG_DATABASE: >-
Expand Down Expand Up @@ -460,64 +457,6 @@ spec:
- n8n-fce-mybranch.dev2.fabrique.social.gouv.fr
secretName: wildcard-crt
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: n8n-db
annotations:
app.github.com/job: '5678'
app.github.com/ref: refs/heads/mybranch
app.github.com/repo: socialgouv/fce
app.github.com/run: '1234'
app.github.com/sha: '0123456'
labels:
application: fce
component: fce
owner: fce
team: fce
cert: wildcard
namespace: fce-mybranch
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
selector:
matchLabels:
usage: fce-n8n-db
storageClassName: ''
---
apiVersion: v1
kind: PersistentVolume
metadata:
labels:
usage: fce-n8n-db
application: fce
component: fce
owner: fce
team: fce
cert: wildcard
name: fce-n8n-db
annotations:
app.github.com/job: '5678'
app.github.com/ref: refs/heads/mybranch
app.github.com/repo: socialgouv/fce
app.github.com/run: '1234'
app.github.com/sha: '0123456'
namespace: fce-mybranch
spec:
accessModes:
- ReadWriteMany
azureFile:
secretName: azure-fce-volume
secretNamespace: fce-mybranch
shareName: n8n-db
capacity:
storage: 1Gi
persistentVolumeReclaimPolicy: Delete
storageClassName: ''
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
64 changes: 3 additions & 61 deletions .k8s/__tests__/__snapshots__/prod.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,13 @@ spec:
volumeMounts:
- name: downloads
mountPath: /tmp/download
- mountPath: /home/node/.n8n
name: n8n-db
envFrom:
- secretRef:
name: n8n-env
- configMapRef:
name: n8n-env
volumes:
- name: downloads
- name: n8n-db
persistentVolumeClaim:
claimName: n8n-db
---
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
Expand Down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FqhBuYAhvn4orMIOVlbkRXsiV6q28De7lEeCHaMhJYU08y/fTyEm49D7BsT6+vBmbMNyCWblLVm74jR+2JSNtMBMgEecp0MOW6Gp/8oeVUqS76b4+hIa4GXHB+nUYUYw==
PG_HOST: >-
AgB/kRibDKhYUdHIbFW8N1nE3pQOvdbZfnix4FEfR0CkPqp0DkLtjWAhVUg+sZzckKjN88VcNX4Kc9YZEe2E0aiw80x9eaBgnaVgOceIDjGw6Hm8mifCRET9AdzvavbdBb6uRF/bWv1W5oGJB5tGe5WG5mRSh7Hx/TjpxrVMMB2O6GTjaPVzB0tM+aNfAv4+zuwbedQ5yw9I5J83g0XJxG4QyHDrgG3QvY6zUZJwx3VSJOAqF/nBSFqccvlavjLGvnMCRCjxJK69vPDNVznu6ILQLJrYlJzWD7Qf8HcRxu4Tb/ea+oiSOq9ayLumfdz0pJu8is7Z6t/CfTb3kD3mN09m4tgtbUISpPI8p96ufPweLnBBwC4UqKP0k6xh6T94ykqmJDIZBf0E3oW1XZD+el+Ametzz9HuTtz4mlq9MP9ebDZ0bgtrhHZbxSD1RYpw+TPk24Sa11zZjo6WD0HiRIz/bzlKxg04ebkV7XFca0AzhfyAlHtjLGQRfW9CvP2SAGfMSgHIZGXDlHzTeaB1ZVFi213ISgKW/ShgfXQR7EDAhgddVEVU2NPu5iFlOFxoAesl+u7sadckEQQ9z4w6C4efsY+sI2+EvA7svVToAmOB1BKMIF92iwjLO3Pu3IO4EATd6MvR2u81QxUt8/OE5fTKNdmHv7x33dEGnuRMaF+J4ktli7w8EljBcPh7vyxYqiMN85hRfFyW31eQD7K6xgdP2uc5Wx1WfaqJIaHtXoXzeI1wop3hhw==
PG_DATABASE: >-
Expand Down Expand Up @@ -426,62 +423,6 @@ spec:
- n8n-fce.fabrique.social.gouv.fr
secretName: n8n-crt
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: n8n-db
annotations:
app.github.com/job: '5678'
app.github.com/ref: v1.2.3
app.github.com/repo: socialgouv/fce
app.github.com/run: '1234'
app.github.com/sha: '0123456'
labels:
application: fce
component: fce
owner: fce
team: fce
namespace: fce
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
selector:
matchLabels:
usage: fce-n8n-db
storageClassName: ''
---
apiVersion: v1
kind: PersistentVolume
metadata:
labels:
usage: fce-n8n-db
application: fce
component: fce
owner: fce
team: fce
name: fce-n8n-db
annotations:
app.github.com/job: '5678'
app.github.com/ref: v1.2.3
app.github.com/repo: socialgouv/fce
app.github.com/run: '1234'
app.github.com/sha: '0123456'
namespace: fce
spec:
accessModes:
- ReadWriteMany
azureFile:
secretName: azure-fce-volume
secretNamespace: fce
shareName: n8n-db
capacity:
storage: 1Gi
persistentVolumeReclaimPolicy: Delete
storageClassName: ''
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -676,6 +617,7 @@ data:
MINIO_ARCHIVE_FILES: '1'
MATOMO_ID_SITE: '8'
MATOMO_URL: https://matomo.fabrique.social.gouv.fr
JWT_EXPIRE_BEFORE: '1634130400'
---
apiVersion: v1
kind: Service
Expand Down
87 changes: 3 additions & 84 deletions .k8s/components/n8n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import env from "@kosko/env";
import { create } from "@socialgouv/kosko-charts/components/app";
import { getGithubRegistryImagePath } from "../utils/getGithubRegistryImagePath";
import {Probe, Volume, VolumeMount} from "kubernetes-models/v1";
import {azureProjectVolume} from "@socialgouv/kosko-charts/components/azure-storage/azureProjectVolume";

const project = "fce";
const name = "n8n";
Expand All @@ -18,20 +17,6 @@ const downloadsVolumeMount = new VolumeMount({
mountPath: "/tmp/download"
});

const [persistentVolumeClaim, persistentVolume] = azureProjectVolume("n8n-db", {
storage: "1Gi"
});

const dbVolume = new Volume({
name: "n8n-db",
persistentVolumeClaim: { claimName: persistentVolumeClaim.metadata!.name! },
});

const dbVolumeMount = new VolumeMount({
mountPath: "/home/node/.n8n",
name: "n8n-db",
});

const probe = new Probe({
httpGet: {
path: "/healthz",
Expand All @@ -49,7 +34,7 @@ const createManifests = async () => {
},
deployment: {
image: getGithubRegistryImagePath(({ project, name })),
volumes: [downloadsVolume, dbVolume],
volumes: [downloadsVolume],
container: {
livenessProbe: probe,
readinessProbe: probe,
Expand All @@ -64,78 +49,12 @@ const createManifests = async () => {
memory: "1280Mi",
},
},
volumeMounts: [downloadsVolumeMount, dbVolumeMount]
volumeMounts: [downloadsVolumeMount]
},
},
});

return [...manifests, persistentVolumeClaim, persistentVolume];
return [...manifests];
}

export default createManifests;

// import env from "@kosko/env";

// import { create } from "@socialgouv/kosko-charts/components/app";
// import { getGithubRegistryImagePath } from "../utils/getGithubRegistryImagePath";
// import { Probe } from "kubernetes-models/v1";

// const project = "fce";
// const name = "n8n";

// const probe = new Probe({
// httpGet: {
// path: "/healthz",
// port: "http",
// },
// initialDelaySeconds: 60,
// });

// const createManifests = async () => {
// const manifests = await create(name, {
// env,
// config: {
// containerPort: 5678,
// subDomainPrefix: "n8n-",
// },
// deployment: {
// image: getGithubRegistryImagePath(({ project, name })),
// volumes: [{
// name: "downloads"
// }, {
// name: "n8n-db",
// azureFile: {
// readOnly: false,
// secretName: "azure-fce-volume",
// shareName: "n8n-db",
// }
// }],
// container: {
// livenessProbe: probe,
// readinessProbe: probe,
// startupProbe: probe,
// resources: {
// requests: {
// cpu: "50m",
// memory: "128Mi",
// },
// limits: {
// cpu: "500m",
// memory: "1280Mi",
// },
// },
// volumeMounts: [{
// mountPath: "/tmp/download",
// name: "downloads",
// }, {
// mountPath: "/home/node/.n8n",
// name: "n8n-db",
// }]
// },
// },
// });

// return [...manifests];
// }

// export default createManifests;
Loading

0 comments on commit ce89989

Please sign in to comment.