Skip to content

Commit b3980e7

Browse files
authored
♻️(ci) add feature app environment
Add a special environment to prepare feature app deployment
1 parent e3b2fdb commit b3980e7

File tree

5 files changed

+318
-67
lines changed

5 files changed

+318
-67
lines changed

.github/workflows/docker-hub.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
images: lasuite/impress-backend
3232
-
3333
name: Login to DockerHub
34-
if: github.event_name != 'pull_request'
34+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview')
3535
uses: docker/login-action@v3
3636
with:
3737
username: ${{ secrets.DOCKER_HUB_USER }}
@@ -49,7 +49,7 @@ jobs:
4949
context: .
5050
target: backend-production
5151
build-args: DOCKER_USER=${{ env.DOCKER_USER }}:-1000
52-
push: ${{ github.event_name != 'pull_request' }}
52+
push: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview') }}
5353
tags: ${{ steps.meta.outputs.tags }}
5454
labels: ${{ steps.meta.outputs.labels }}
5555

@@ -67,7 +67,7 @@ jobs:
6767
images: lasuite/impress-frontend
6868
-
6969
name: Login to DockerHub
70-
if: github.event_name != 'pull_request'
70+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview')
7171
uses: docker/login-action@v3
7272
with:
7373
username: ${{ secrets.DOCKER_HUB_USER }}
@@ -88,7 +88,7 @@ jobs:
8888
build-args: |
8989
DOCKER_USER=${{ env.DOCKER_USER }}:-1000
9090
PUBLISH_AS_MIT=false
91-
push: ${{ github.event_name != 'pull_request' }}
91+
push: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview') }}
9292
tags: ${{ steps.meta.outputs.tags }}
9393
labels: ${{ steps.meta.outputs.labels }}
9494

@@ -106,7 +106,7 @@ jobs:
106106
images: lasuite/impress-y-provider
107107
-
108108
name: Login to DockerHub
109-
if: github.event_name != 'pull_request'
109+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview')
110110
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USER }}" --password-stdin
111111
-
112112
name: Run trivy scan
@@ -122,7 +122,7 @@ jobs:
122122
file: ./src/frontend/servers/y-provider/Dockerfile
123123
target: y-provider
124124
build-args: DOCKER_USER=${{ env.DOCKER_USER }}:-1000
125-
push: ${{ github.event_name != 'pull_request' }}
125+
push: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview') }}
126126
tags: ${{ steps.meta.outputs.tags }}
127127
labels: ${{ steps.meta.outputs.labels }}
128128

@@ -131,7 +131,7 @@ jobs:
131131
- build-and-push-frontend
132132
- build-and-push-backend
133133
runs-on: ubuntu-latest
134-
if: github.event_name != 'pull_request'
134+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview')
135135
steps:
136136
- uses: numerique-gouv/action-argocd-webhook-notification@main
137137
id: notify
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
postgres:
2+
enabled: true
3+
name: postgres
4+
#serviceNameOverride: postgres
5+
image: postgres:16-alpine
6+
username: dinum
7+
password: pass
8+
database: docs
9+
size: 1Gi
10+
redis:
11+
enabled: true
12+
name: redis
13+
image: redis:8.2-alpine
14+
username: user
15+
password: pass
16+
minio:
17+
enabled: true
18+
image: minio/minio
19+
name: minio
20+
ingress:
21+
enabled: true
22+
hostname: docs-minio.127.0.0.1.nip.io
23+
tls:
24+
enabled: true
25+
secretName: docs-tls
26+
consoleIngress:
27+
enabled: true
28+
hostname: docs-minio-console.127.0.0.1.nip.io
29+
tls:
30+
enabled: true
31+
secretName: docs-tls
32+
username: dinum
33+
password: password
34+
bucket: docs-media-storage
35+
versioning: true
36+
size: 1Gi
37+
keycloak:
38+
enabled: true
39+
image: quay.io/keycloak/keycloak:20.0.1
40+
name: keycloak
41+
#serviceNameOverride: keycloak
42+
hostname: docs-keycloak.127.0.0.1.nip.io
43+
username: admin
44+
password: pass
45+
tls:
46+
enabled: true
47+
secretName: docs-tls
48+
db:
49+
username: dinum
50+
password: pass
51+
database: keycloak
52+
size: 1Gi
53+
image: postgres:16-alpine
54+
realm:
55+
name: docs
56+
username: docs
57+
password: docs
58+
59+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
postgres:
2+
enabled: true
3+
name: postgres
4+
#serviceNameOverride: postgres
5+
image: postgres:16-alpine
6+
username: dinum
7+
password: pass
8+
database: docs
9+
size: 5Gi
10+
redis:
11+
enabled: true
12+
name: redis
13+
image: redis:8.2-alpine
14+
username: user
15+
password: pass
16+
minio:
17+
enabled: true
18+
image: minio/minio
19+
name: minio
20+
ingress:
21+
enabled: true
22+
hostname: {{ .Values.feature }}-minio.{{ .Values.domain }}
23+
tls:
24+
enabled: true
25+
secretName: docs-tls
26+
consoleIngress:
27+
enabled: true
28+
hostname: {{ .Values.feature }}-minio-console.{{ .Values.domain }}
29+
tls:
30+
enabled: true
31+
secretName: docs-tls
32+
username: dinum
33+
password: password
34+
bucket: docs-media-storage
35+
versioning: true
36+
size: 5Gi
37+
keycloak:
38+
enabled: true
39+
image: quay.io/keycloak/keycloak:20.0.1
40+
name: keycloak
41+
annotations:
42+
cert-manager.io/cluster-issuer: letsencrypt
43+
#serviceNameOverride: keycloak
44+
hostname: {{ .Values.feature }}-docs-keycloak.{{ .Values.domain }}
45+
username: admin
46+
password: pass
47+
tls:
48+
enabled: true
49+
secretName: docs-tls
50+
db:
51+
username: dinum
52+
password: pass
53+
database: keycloak
54+
size: 5Gi
55+
image: postgres:16-alpine
56+
realm:
57+
name: docs
58+
username: docs
59+
password: docs
60+
61+
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
djangoSecretKey: &djangoSecretKey "lkjsdlfkjsldkfjslkdfjslkdjfslkdjf"
2+
tag: &tag "{{ .Values.imageTag }}"
3+
djangoSuperUserEmail: [email protected]
4+
djangoSuperUserPass: admin
5+
aiApiKey: changeme
6+
aiBaseUrl: changeme
7+
oidc:
8+
clientId: impress
9+
clientSecret: ThisIsAnExampleKeyForDevPurposeOnly
10+
11+
image:
12+
repository: lasuite/impress-backend
13+
pullPolicy: Always
14+
tag: *tag
15+
16+
backend:
17+
replicas: 1
18+
envVars:
19+
COLLABORATION_SERVER_SECRET: my-secret
20+
DJANGO_CSRF_TRUSTED_ORIGINS: https://{{ .Values.feature }}-docs.{{ .Values.domain }}
21+
DJANGO_CONFIGURATION: Feature
22+
DJANGO_ALLOWED_HOSTS: {{ .Values.feature }}-docs.{{ .Values.domain }}
23+
DJANGO_SERVER_TO_SERVER_API_TOKENS: secret-api-key
24+
DJANGO_SECRET_KEY: *djangoSecretKey
25+
DJANGO_SETTINGS_MODULE: impress.settings
26+
DJANGO_SUPERUSER_PASSWORD: admin
27+
DJANGO_EMAIL_BRAND_NAME: "La Suite Numérique"
28+
DJANGO_EMAIL_HOST: "mailcatcher"
29+
DJANGO_EMAIL_LOGO_IMG: https://{{ .Values.feature }}-docs.{{ .Values.domain }}/assets/logo-suite-numerique.png
30+
DJANGO_EMAIL_PORT: 1025
31+
DJANGO_EMAIL_USE_SSL: False
32+
LOGGING_LEVEL_HANDLERS_CONSOLE: ERROR
33+
LOGGING_LEVEL_LOGGERS_ROOT: INFO
34+
LOGGING_LEVEL_LOGGERS_APP: INFO
35+
OIDC_USERINFO_SHORTNAME_FIELD: "given_name"
36+
OIDC_USERINFO_FULLNAME_FIELDS: "given_name,usual_name"
37+
OIDC_OP_JWKS_ENDPOINT: https://{{ .Values.feature }}-docs-keycloak.{{ .Values.domain }}/realms/docs/protocol/openid-connect/certs
38+
OIDC_OP_AUTHORIZATION_ENDPOINT: https://{{ .Values.feature }}-docs-keycloak.{{ .Values.domain }}/realms/docs/protocol/openid-connect/auth
39+
OIDC_OP_TOKEN_ENDPOINT: https://{{ .Values.feature }}-docs-keycloak.{{ .Values.domain }}/realms/docs/protocol/openid-connect/token
40+
OIDC_OP_USER_ENDPOINT: https://{{ .Values.feature }}-docs-keycloak.{{ .Values.domain }}/realms/docs/protocol/openid-connect/userinfo
41+
OIDC_OP_LOGOUT_ENDPOINT: https://{{ .Values.feature }}-docs-keycloak.{{ .Values.domain }}/realms/docs/protocol/openid-connect/logout
42+
OIDC_RP_CLIENT_ID: docs
43+
OIDC_RP_CLIENT_SECRET: ThisIsAnExampleKeyForDevPurposeOnly
44+
OIDC_RP_SIGN_ALGO: RS256
45+
OIDC_RP_SCOPES: "openid email"
46+
LOGIN_REDIRECT_URL: https://{{ .Values.feature }}-docs.{{ .Values.domain }}
47+
LOGIN_REDIRECT_URL_FAILURE: https://{{ .Values.feature }}-docs.{{ .Values.domain }}
48+
LOGOUT_REDIRECT_URL: https://{{ .Values.feature }}-docs.{{ .Values.domain }}
49+
DB_HOST: dev-backend-postgres
50+
DB_NAME:
51+
secretKeyRef:
52+
name: dev-backend-postgres
53+
key: database
54+
DB_USER:
55+
secretKeyRef:
56+
name: dev-backend-postgres
57+
key: username
58+
DB_PASSWORD:
59+
secretKeyRef:
60+
name: dev-backend-postgres
61+
key: password
62+
DB_PORT: 5432
63+
REDIS_URL: redis://user:pass@dev-backend-redis:6379/1
64+
DJANGO_CELERY_BROKER_URL: redis://user:pass@dev-backend-redis:6379/1
65+
AWS_S3_ENDPOINT_URL: http://dev-backend-minio.{{ .Namespace }}.svc.cluster.local:9000
66+
AWS_S3_ACCESS_KEY_ID: dinum
67+
AWS_S3_SECRET_ACCESS_KEY: password
68+
AWS_STORAGE_BUCKET_NAME: docs-media-storage
69+
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
70+
Y_PROVIDER_API_BASE_URL: http://impress-y-provider:443/api/
71+
Y_PROVIDER_API_KEY: my-secret
72+
CACHES_KEY_PREFIX: "{{ now | unixEpoch }}"
73+
migrate:
74+
command:
75+
- "/bin/sh"
76+
- "-c"
77+
- |
78+
while ! python manage.py check --database default > /dev/null 2>&1
79+
do
80+
echo "Database not ready"
81+
sleep 2
82+
done
83+
84+
echo "Database is ready"
85+
86+
python manage.py migrate --no-input
87+
restartPolicy: Never
88+
89+
command:
90+
- "gunicorn"
91+
- "-c"
92+
- "/usr/local/etc/gunicorn/impress.py"
93+
- "impress.wsgi:application"
94+
- "--reload"
95+
96+
createsuperuser:
97+
command:
98+
- "/bin/sh"
99+
- "-c"
100+
- |
101+
while ! python manage.py check --database default > /dev/null 2>&1
102+
do
103+
echo "Database not ready"
104+
sleep 2
105+
done
106+
107+
echo "Database is ready"
108+
python manage.py createsuperuser --email [email protected] --password admin
109+
restartPolicy: Never
110+
111+
# Extra volume mounts to manage our local custom CA and avoid to set ssl_verify: false
112+
extraVolumeMounts: {}
113+
114+
# Extra volumes to manage our local custom CA and avoid to set ssl_verify: false
115+
extraVolumes: {}
116+
117+
frontend:
118+
envVars:
119+
PORT: 8080
120+
NEXT_PUBLIC_API_ORIGIN: https://{{ .Values.feature }}-docs.{{ .Values.domain }}
121+
122+
replicas: 1
123+
124+
image:
125+
repository: lasuite/impress-frontend
126+
pullPolicy: Always
127+
tag: *tag
128+
129+
yProvider:
130+
replicas: 1
131+
132+
image:
133+
repository: lasuite/impress-y-provider
134+
pullPolicy: Always
135+
tag: *tag
136+
137+
envVars:
138+
COLLABORATION_BACKEND_BASE_URL: https://{{ .Values.feature }}-docs.{{ .Values.domain }}
139+
COLLABORATION_LOGGING: true
140+
COLLABORATION_SERVER_ORIGIN: https://{{ .Values.feature }}-docs.{{ .Values.domain }}
141+
COLLABORATION_SERVER_SECRET: my-secret
142+
Y_PROVIDER_API_KEY: my-secret
143+
144+
ingress:
145+
enabled: true
146+
host: {{ .Values.feature }}-docs.{{ .Values.domain }}
147+
annotations:
148+
nginx.ingress.kubernetes.io/proxy-body-size: 10m
149+
cert-manager.io/cluster-issuer: letsencrypt
150+
151+
ingressCollaborationWS:
152+
enabled: true
153+
host: {{ .Values.feature }}-docs.{{ .Values.domain }}
154+
155+
ingressCollaborationApi:
156+
enabled: true
157+
host: {{ .Values.feature }}-docs.{{ .Values.domain }}
158+
159+
ingressAdmin:
160+
enabled: true
161+
host: {{ .Values.feature }}-docs.{{ .Values.domain }}
162+
163+
posthog:
164+
ingress:
165+
enabled: false
166+
167+
ingressAssets:
168+
enabled: false
169+
170+
ingressMedia:
171+
enabled: true
172+
host: {{ .Values.feature }}-docs.{{ .Values.domain }}
173+
174+
annotations:
175+
nginx.ingress.kubernetes.io/auth-url: https://{{ .Values.feature }}-docs.{{ .Values.domain }}/api/v1.0/documents/media-auth/
176+
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Amz-Date, X-Amz-Content-SHA256"
177+
nginx.ingress.kubernetes.io/upstream-vhost: dev-backend-minio.{{ .Namespace }}.svc.cluster.local:9000
178+
nginx.ingress.kubernetes.io/rewrite-target: /docs-media-storage/$1
179+
180+
serviceMedia:
181+
host: dev-backend-minio.{{ .Namespace }}.svc.cluster.local
182+
port: 9000

0 commit comments

Comments
 (0)