Skip to content

Commit 138e268

Browse files
Merge branch 'staging' of https://github.com/ActiveLearningStudio/ActiveLearningStudio-API into dev-to-stage-conflicts-06-03-23
2 parents 8e59e67 + b75526a commit 138e268

File tree

13 files changed

+385
-138
lines changed

13 files changed

+385
-138
lines changed

app/Http/Controllers/Api/V1/MicroSoftTeamController.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,16 @@ public function getUserPofile(GetUserProfileRequest $request)
268268
if ($accessToken && array_key_exists('access_token', $accessToken)) {
269269
$getProfile = $this->microsoftTeamRepository->getUserProfile($accessToken['access_token']);
270270

271-
return response([
272-
'profile' => $getProfile,
273-
], 200);
274-
} else {
275-
return response([
276-
'status_code' => 424,
277-
'errors' => $accessToken['error'],
278-
'message' => $accessToken['error_description']
279-
], 500);
271+
if ($getProfile && array_key_exists('displayName', $getProfile)) {
272+
return response([
273+
'profile' => $getProfile,
274+
], 200);
275+
}
280276
}
277+
278+
return response([
279+
'profile' => 'Something went wrong with the login code or token, unable to fetch user profile',
280+
], 400);
281281
}
282282

283283
/**

app/Repositories/MicrosoftTeam/MicrosoftTeamRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ private function getUserDetails($token)
418418
*/
419419
public function getUserProfile($token)
420420
{
421-
$apiURL = $this->landingUrl . '/me';
421+
$apiURL = $this->landingUrl . '/profile';
422422
$headers = [
423423
'Content-length' => 0,
424424
'Content-type' => 'application/json',

charts/curriki/templates/api-ing.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ metadata:
99
spec:
1010
tls:
1111
- hosts:
12-
- stage.currikistudio.org
12+
- {{.Values.host}}
1313
secretName: letsencrypt
1414
rules:
15-
- host: stage.currikistudio.org
15+
- host: {{.Values.host}}
1616
http:
1717
paths:
1818
- pathType: Prefix

charts/curriki/templates/api.yaml

Lines changed: 89 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,94 @@ spec:
1818
rollme: {{ randAlphaNum 5 | quote }}
1919
spec:
2020
containers:
21-
- name: api
21+
- name: nginx
22+
securityContext:
23+
{{- toYaml .Values.securityContext | nindent 12 }}
2224
image: {{ .Values.image.apirepo}} #quay.io/curriki/api:stage
2325
imagePullPolicy: Always
26+
command:
27+
- /bin/sh
28+
- -c
29+
- |
30+
export nr_name=App && \
31+
sh /usr/local/bin/entrypoint.api.sh && \
32+
php /var/www/html/artisan storage:link && \
33+
nginx -g "daemon off;"
2434
ports:
25-
- containerPort: 80
35+
- name: http
36+
containerPort: 80
37+
protocol: TCP
38+
securityContext:
39+
privileged: true
2640
readinessProbe:
27-
tcpSocket:
28-
port: 80
29-
initialDelaySeconds: 5
41+
failureThreshold: 10
42+
initialDelaySeconds: 10
3043
periodSeconds: 10
31-
livenessProbe:
44+
successThreshold: 1
3245
tcpSocket:
33-
port: 80
34-
initialDelaySeconds: 15
46+
port: 9000
47+
livenessProbe:
48+
initialDelaySeconds: 200
3549
periodSeconds: 20
50+
tcpSocket:
51+
port: 9000
52+
resources:
53+
limits:
54+
cpu: 100m
55+
memory: 100Mi
56+
requests:
57+
cpu: 50m
58+
memory: 50Mi
3659
volumeMounts:
3760
- name: api-env
3861
mountPath: /var/www/html/.env
3962
subPath: .env
4063
- name: nfs-volume
4164
mountPath: /var/www/html/storage
42-
envFrom:
43-
- secretRef:
44-
name: api-env
65+
- name: currikicert
66+
mountPath: /etc/ssl/curriki.cert
67+
subPath: curriki.cert
68+
- name: currikikey
69+
mountPath: /etc/ssl/curriki.key
70+
subPath: curriki.key
71+
- name: php-fpm
72+
securityContext:
73+
{{- toYaml .Values.securityContext | nindent 12 }}
74+
image: {{ .Values.image.apirepo}} #quay.io/curriki/api:stage
75+
imagePullPolicy: Always
76+
securityContext:
77+
privileged: true
78+
command:
79+
- /bin/sh
80+
- -c
81+
- |
82+
export nr_name=App && \
83+
sh /usr/local/bin/entrypoint.api.sh && \
84+
php /var/www/html/artisan storage:link && \
85+
php-fpm -c /etc/php/8.1/fpm/php.ini --fpm-config=/usr/local/etc/php-fpm.conf -F -O
4586
resources:
4687
limits:
4788
cpu: 600m
4889
memory: 1500Mi
4990
requests:
5091
cpu: 350m
5192
memory: 800Mi
52-
command:
53-
- /bin/sh
54-
- -c
55-
- |
56-
php /var/www/html/artisan storage:link
57-
apache2ctl -D FOREGROUND
93+
volumeMounts:
94+
- name: api-env
95+
mountPath: /var/www/html/.env
96+
subPath: .env
97+
- name: nfs-volume
98+
mountPath: /var/www/html/storage
99+
- name: currikicert
100+
mountPath: /etc/ssl/curriki.cert
101+
subPath: curriki.cert
102+
- name: currikikey
103+
mountPath: /etc/ssl/curriki.key
104+
subPath: curriki.key
105+
envFrom:
106+
- secretRef:
107+
name: api-env
108+
58109
volumes:
59110
- name: api-env
60111
secret:
@@ -64,9 +115,16 @@ spec:
64115
path: .env
65116
- name: nfs-volume
66117
nfs:
67-
server: 139.144.231.192
68-
path: /mnt/storage
118+
server: {{ .Values.nfsServer }}
119+
path: {{ .Values.volumePath }}
69120
readOnly: no
121+
- name: currikicert
122+
configMap:
123+
name: currikicert
124+
- name: currikikey
125+
configMap:
126+
name: currikikey
127+
70128

71129

72130
---
@@ -79,6 +137,12 @@ spec:
79137
ports:
80138
- port: 80
81139
targetPort: 80
140+
protocol: TCP
141+
name: http
142+
- port: 443
143+
targetPort: 80
144+
protocol: TCP
145+
name: https
82146
selector:
83147
app: {{ .Release.Name }}-api
84148

@@ -170,8 +234,8 @@ spec:
170234

171235
- name: nfs-volume
172236
nfs:
173-
server: 139.144.231.192
174-
path: /mnt/storage
237+
server: {{ .Values.nfsServer }}
238+
path: {{ .Values.volumePath }}
175239
readOnly: no
176240

177241

@@ -224,8 +288,8 @@ spec:
224288
path: .env
225289
- name: nfs-volume
226290
nfs:
227-
server: 139.144.231.192
228-
path: /mnt/storage
291+
server: {{ .Values.nfsServer }}
292+
path: {{ .Values.volumePath }}
229293
readOnly: no
230294
backoffLimit: 4
231295

@@ -277,6 +341,6 @@ spec:
277341
path: .env
278342
- name: nfs-volume
279343
nfs:
280-
server: 139.144.231.192
281-
path: /mnt/storage
344+
server: {{ .Values.nfsServer }}
345+
path: {{ .Values.volumePath }}
282346
readOnly: no

charts/curriki/templates/client.yaml

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ spec:
3737
- name: client-env-local
3838
mountPath: /usr/share/nginx/html/.env
3939
subPath: .env
40-
volumeMounts:
4140
- name: client-env-script
4241
mountPath: /usr/share/nginx/html/runtime-env.js
4342
subPath: runtime-env.js
@@ -69,21 +68,10 @@ kind: ConfigMap
6968
metadata:
7069
name: client-env
7170
data:
72-
REACT_APP_PEXEL_API: "563492ad6f91700001000001155d7b75f5424ea694b81ce9f867dddf"
73-
REACT_APP_API_URL: "https://stage.currikistudio.org/api/api"
74-
REACT_APP_RESOURCE_URL: "https://stage.currikistudio.org/api"
75-
REACT_APP_GOOGLE_CAPTCHA: "6LdImbgZAAAAAN4s1eEi53-ul7uJfLONrFuBcKS0"
76-
REACT_APP_GAPI_CLIENT_ID: "898143939834-9ioui2i9ghgrmcgmgtg0h6rsf83d0t0c.apps.googleusercontent.com"
77-
REACT_APP_HUBSPOT: "7874555"
78-
REACT_APP_API_VERSION: "v1"
79-
REACT_APP_H5P_KEY: "B6TFsmFD5TLZaWCAYZ91ly0D2We0xjLAtRmBJzQ"
80-
REACT_APP_TSUGI_SERVER_URL: "https://stage-tsugi.currikistudio.org/mod/curriki/"
81-
REACT_APP_SHARED_PROJECT_DEMO_USER: "demoaccount@gmail.com"
82-
REACT_APP_SHARED_PROJECT_DEMO_PASS: "Qwerty123"
83-
REACT_APP_SHARED_PROJECT_USERID: "1608"
84-
REACT_MS_APP_ID: "5e0ea881-693a-4f0a-94a7-dcef7b5accd6"
85-
REACT_MS_TENANT_ID: "75f881ff-c83b-44de-a964-f0f9ee64c60c"
86-
REACT_DOMAIN_URL: "https://stage.currikistudio.org/"
71+
{{- with .Values.clientEnvConfigMap }}
72+
{{- toYaml . | nindent 2}}
73+
{{- end}}
74+
8775

8876

8977
---
@@ -92,32 +80,16 @@ kind: ConfigMap
9280
metadata:
9381
name: client-env-local
9482
data:
95-
.env: |
96-
REACT_APP_PEXEL_API=563492ad6f91700001000001155d7b75f5424ea694b81ce9f867dddf
97-
REACT_APP_API_URL=https://stage.currikistudio.org/api/api
98-
REACT_APP_RESOURCE_URL=https://stage.currikistudio.org/api
99-
REACT_APP_GOOGLE_CAPTCHA=6LdImbgZAAAAAN4s1eEi53-ul7uJfLONrFuBcKS0
100-
REACT_APP_GAPI_CLIENT_ID=898143939834-9ioui2i9ghgrmcgmgtg0h6rsf83d0t0c.apps.googleusercontent.com
101-
REACT_APP_HUBSPOT=7874555
102-
REACT_APP_API_VERSION=v1
103-
REACT_APP_H5P_KEY=B6TFsmFD5TLZaWCAYZ91ly0D2We0xjLAtRmBJzQ
104-
REACT_APP_TSUGI_SERVER_URL=https://stage-tsugi.currikistudio.org/mod/curriki/
105-
REACT_APP_SHARED_PROJECT_DEMO_USER=demoaccount@gmail.com
106-
REACT_APP_SHARED_PROJECT_DEMO_PASS=Qwerty123
107-
REACT_APP_SHARED_PROJECT_USERID=1608
108-
REACT_MS_APP_ID=5e0ea881-693a-4f0a-94a7-dcef7b5accd6
109-
REACT_MS_TENANT_ID=75f881ff-c83b-44de-a964-f0f9ee64c60c
110-
REACT_DOMAIN_URL=https://stage.currikistudio.org/
111-
83+
.env: {{- .Values.clientEnvLocalConfigMap | toYaml | indent 2 }}
84+
11285

11386
---
11487
apiVersion: v1
11588
kind: ConfigMap
11689
metadata:
11790
name: client-env-script
11891
data:
119-
runtime-env.js: |
120-
window.__RUNTIME_CONFIG__ = {"REACT_APP_PEXEL_API":"563492ad6f91700001000001155d7b75f5424ea694b81ce9f867dddf","REACT_APP_API_URL":"https://stage.currikistudio.org/api/api","REACT_APP_RESOURCE_URL":"https://stage.currikistudio.org/api","REACT_APP_GOOGLE_CAPTCHA":"6LdImbgZAAAAAN4s1eEi53-ul7uJfLONrFuBcKS0","REACT_APP_GAPI_CLIENT_ID":"898143939834-9ioui2i9ghgrmcgmgtg0h6rsf83d0t0c.apps.googleusercontent.com","REACT_APP_HUBSPOT":"7874555","REACT_APP_API_VERSION":"v1","REACT_APP_H5P_KEY":"B6TFsmFD5TLZaWCAYZ91ly0D2We0xjLAtRmBJzQ","REACT_APP_TSUGI_SERVER_URL":"https://stage-tsugi.currikistudio.org/mod/curriki/","REACT_APP_SHARED_PROJECT_DEMO_USER":"demoaccount@gmail.com","REACT_APP_SHARED_PROJECT_DEMO_PASS":"Qwerty123","REACT_APP_SHARED_PROJECT_USERID":"1608","REACT_MS_APP_ID":"5e0ea881-693a-4f0a-94a7-dcef7b5accd6","REACT_MS_TENANT_ID":"75f881ff-c83b-44de-a964-f0f9ee64c60c","REACT_DOMAIN_URL":"https://stage.currikistudio.org/"};
92+
runtime-env.js: {{- .Values.clientRuntimeConfig | toYaml | indent 2 }}
12193

12294
---
12395
apiVersion: v1

charts/curriki/templates/ingress.yaml

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,11 @@ metadata:
88
spec:
99
tls:
1010
- hosts:
11-
- stage.currikistudio.org
12-
- stage-api.currikistudio.org
13-
- stage-trax.currikistudio.org
14-
- stage-tsugi.currikistudio.org
11+
{{- with .Values.ingHosts }}
12+
{{- toYaml . | nindent 6}}
13+
{{- end}}
1514
secretName: letsencrypt
1615
rules:
17-
- host: stage.currikistudio.org
18-
http:
19-
paths:
20-
- pathType: Prefix
21-
path: "/"
22-
backend:
23-
service:
24-
name: client-svc
25-
port:
26-
number: 80
27-
- host: stage-api.currikistudio.org
28-
http:
29-
paths:
30-
- pathType: Prefix
31-
path: "/"
32-
backend:
33-
service:
34-
name: api-svc
35-
port:
36-
number: 80
37-
- host: stage-trax.currikistudio.org
38-
http:
39-
paths:
40-
- pathType: Prefix
41-
path: "/"
42-
backend:
43-
service:
44-
name: trax-svc
45-
port:
46-
number: 80
47-
- host: stage-tsugi.currikistudio.org
48-
http:
49-
paths:
50-
- pathType: Prefix
51-
path: "/"
52-
backend:
53-
service:
54-
name: tsugi-svc
55-
port:
56-
number: 80
16+
{{- with .Values.ingRules }}
17+
{{- toYaml . | nindent 4}}
18+
{{- end}}

charts/curriki/templates/trax.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ spec:
6767
path: .env
6868
- name: nfs-volume
6969
nfs:
70-
server: 139.144.231.192
71-
path: /mnt/traxstorage
70+
server: {{ .Values.nfsServer }}
71+
path: {{ .Values.traxStorage }}
7272
readOnly: no
7373

7474

charts/curriki/templates/tsugi.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ kind: ConfigMap
6666
metadata:
6767
name: tsugi-mod-config
6868
data:
69-
config.php: |
70-
<?php
71-
define('CURRIKI_STUDIO_HOST', 'https://stage.currikistudio.org');
69+
config.php: {{- .Values.currikiTsugiHost | toYaml | indent 2 }}
70+
7271

7372

7473
---

charts/curriki/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace: staging
1+
namespace: default
22
image:
33
apirepo: nginx
44
cronrepo: nginx

0 commit comments

Comments
 (0)