Skip to content

Commit 0bf05d9

Browse files
committed
Merge branch 'develop' into chatbot
2 parents e38cb66 + 9cdb8b9 commit 0bf05d9

180 files changed

Lines changed: 31978 additions & 36926 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pr-build.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- 'deploy/**'
99
- '.github/workflows/**'
1010
workflow_dispatch:
11-
1211
jobs:
1312
build-context:
1413
runs-on: ubuntu-latest
@@ -22,6 +21,10 @@ jobs:
2221
runs-on: ubuntu-latest
2322
env:
2423
PLATFORMS: "linux/amd64,linux/arm64"
24+
permissions:
25+
pull-requests: write # Required to post comments
26+
contents: read
27+
checks: write
2528
steps:
2629
- name: Checkout code
2730
uses: actions/checkout@v4
@@ -159,10 +162,12 @@ jobs:
159162
- name: Cleanup docker before running
160163
if: always()
161164
continue-on-error: true
162-
run: docker-compose -f deploy/docker/docker-compose.yml down --volumes --remove-orphans
165+
run: docker compose -f deploy/docker/docker-compose.yml down --volumes --remove-orphans
163166

164167
- name: Run crAPI using built images
165-
run: VERSION=${{ env.TAG_NAME }} docker-compose -f deploy/docker/docker-compose.yml --compatibility up -d
168+
run: |
169+
cd deploy/docker
170+
VERSION=${{ env.TAG_NAME }} docker compose -f docker-compose.yml --compatibility up -d
166171
167172
- name: Install Node
168173
uses: actions/setup-node@v3
@@ -181,12 +186,16 @@ jobs:
181186

182187
- name: Cleanup docker
183188
if: always()
184-
run: docker-compose -f deploy/docker/docker-compose.yml down --volumes --remove-orphans
189+
run: docker compose -f deploy/docker/docker-compose.yml down --volumes --remove-orphans
185190

186191

187192
tests:
188193
needs: build-context
189194
runs-on: ubuntu-latest
195+
permissions:
196+
pull-requests: write
197+
contents: read
198+
checks: write
190199
steps:
191200
- name: Checkout code
192201
uses: actions/checkout@v4
@@ -208,7 +217,7 @@ jobs:
208217
go-version: '1.21'
209218

210219
- name: Start the database
211-
run: docker-compose -f services/docker-database.yml up -d
220+
run: docker compose -f services/docker-database.yml up -d
212221

213222
- name: Run identity tests
214223
run: |
@@ -262,7 +271,7 @@ jobs:
262271
coverage xml -o coverage.xml
263272
264273
- name: Publish Coverage for workshop
265-
uses: orgoro/coverage@v3.1
274+
uses: orgoro/coverage@v3.2
266275
with:
267276
coverageFile: services/workshop/coverage.xml
268277
token: ${{ secrets.GITHUB_TOKEN }}
@@ -271,4 +280,4 @@ jobs:
271280
run: |
272281
cd services/web
273282
npm install
274-
npm run lint
283+
npm run lint

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
http://www.apache.org/licenses/
44

55
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6-
6+
77
1. Definitions.
88

99
"License" shall mean the terms and conditions for use, reproduction,

README.md

Lines changed: 65 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,68 +10,113 @@ know more about crAPI, please check [crAPI's overview][overview].
1010

1111
## QuickStart Guide
1212

13-
### Docker and docker-compose
13+
### Docker and docker compose
1414

15-
You'll need to have Docker and docker-compose installed and running on your host system. Also, the version of docker-compose should be `1.27.0` or above. Check your docker-compose version using:
15+
You'll need to have Docker and docker compose installed and running on your host system. Also, the version of docker compose should be `1.27.0` or above. Check your docker compose version using:
1616
```
17-
docker-compose version
17+
docker compose version
1818
```
1919

20+
**Upgrade your docker compose version if you get errors like**
21+
22+
```ERROR: Invalid interpolation format for ...```
23+
2024
#### Using prebuilt images
21-
You can use prebuilt images generated by our CI workflow.
25+
You can use prebuilt images generated by our CI workflow by downloading the docker compose and **.env** files.
2226

2327
- To use the latest stable version.
2428

2529
- Linux Machine
2630

2731
```
28-
curl -o docker-compose.yml https://raw.githubusercontent.com/OWASP/crAPI/main/deploy/docker/docker-compose.yml
32+
curl -o /tmp/crapi.zip https://github.com/OWASP/crAPI/archive/refs/heads/main.zip
33+
34+
unzip /tmp/crapi.zip
35+
36+
cd crAPI-main/deploy/docker
37+
38+
docker compose pull
39+
40+
docker compose -f docker-compose.yml --compatibility up -d
41+
```
42+
43+
To override server configurations, change the values of the variables present in the **.env** file or add the respective variables to the start of the docker compose command.
2944

30-
docker-compose pull
45+
For example to expose the system to all network interfaces.
3146

32-
docker-compose -f docker-compose.yml --compatibility up -d
47+
```
48+
LISTEN_IP="0.0.0.0" docker compose -f docker-compose.yml --compatibility up -d
3349
```
3450

3551
- Windows Machine
3652

3753
```
38-
curl.exe -o docker-compose.yml https://raw.githubusercontent.com/OWASP/crAPI/main/deploy/docker/docker-compose.yml
54+
curl.exe -o crapi.zip https://github.com/OWASP/crAPI/archive/refs/heads/main.zip
55+
56+
tar -xf .\crapi.zip
57+
58+
cd crAPI-main/deploy/docker
59+
60+
docker compose pull
61+
62+
docker compose -f docker-compose.yml --compatibility up -d
63+
```
64+
65+
To override server configurations, change the values of the variables present in the **.env** file or add the respective variables to the start of the docker compose command.
3966

40-
docker-compose pull
67+
For example to expose the system to all network interfaces.
4168

42-
docker-compose -f docker-compose.yml --compatibility up -d
69+
```
70+
LISTEN_IP="0.0.0.0" docker compose -f docker-compose.yml --compatibility up -d
4371
```
4472

4573
- To use the latest development version
4674

4775
- Linux Machine
4876

4977
```
50-
curl -o docker-compose.yml https://raw.githubusercontent.com/OWASP/crAPI/develop/deploy/docker/docker-compose.yml
78+
curl -o /tmp/crapi.zip https://github.com/OWASP/crAPI/archive/refs/heads/develop.zip
79+
80+
unzip /tmp/crapi.zip
81+
82+
cd crAPI-develop/deploy/docker
83+
84+
docker compose pull
85+
86+
docker compose -f docker-compose.yml --compatibility up -d
87+
```
88+
89+
To override server configurations, change the values of the variables present in the **.env** file or add the respective variables to the start of the docker compose command.
5190
52-
VERSION=develop docker-compose pull
91+
For example to expose the system to all network interfaces.
5392
54-
VERSION=develop docker-compose -f docker-compose.yml --compatibility up -d
93+
```
94+
LISTEN_IP="0.0.0.0" docker compose -f docker-compose.yml --compatibility up -d
5595
```
5696
5797
- Windows Machine
5898
5999
```
60-
curl.exe -o docker-compose.yml https://raw.githubusercontent.com/OWASP/crAPI/develop/deploy/docker/docker-compose.yml
100+
curl.exe -o crapi.zip https://github.com/OWASP/crAPI/archive/refs/heads/develop.zip
61101
62-
set "VERSION=develop"
102+
tar -xf .\crapi.zip
103+
104+
cd crAPI-develop/deploy/docker
63105
64-
docker-compose pull
106+
docker compose pull
65107
66-
docker-compose -f docker-compose.yml --compatibility up -d
108+
docker compose -f docker-compose.yml --compatibility up -d
67109
```
110+
111+
To override server configurations, change the values of the variables present in the **.env** file or add the respective variables to the start of the docker compose command.
68112
69-
- To Stop and Cleanup crAPI
113+
For example to expose the system to all network interfaces.
70114
71115
```
72-
docker-compose -f docker-compose.yml --compatibility down –volumes
116+
LISTEN_IP="0.0.0.0" docker compose -f docker-compose.yml --compatibility up -d
73117
```
74118
119+
75120
Visit [http://localhost:8888](http://localhost:8888)
76121
77122
**Note**: All emails are sent to mailhog service by default and can be checked on
@@ -117,4 +162,4 @@ To know more about challenges in crAPI. Visit [challenges]
117162
[virtualbox]: https://www.virtualbox.org/wiki/Downloads
118163
119164
## Troubleshooting guide for general issues while installing and running crAPI
120-
If you need any help with installing and running crAPI you can check out this guide: [Troubleshooting guide crAPI](https://github.com/OWASP/crAPI/blob/main/docs/troubleshooting.md). If this doesn't solve your problem, please create an issue in Github Issues.
165+
If you need any help with installing and running crAPI you can check out this guide: [Troubleshooting guide crAPI](https://github.com/OWASP/crAPI/blob/main/docs/troubleshooting.md). If this doesn't solve your problem, please create an issue in Github Issues.

deploy/docker/docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
#ports:
1919
# - "${LISTEN_IP:-127.0.0.1}:8080:8080"
2020
volumes:
21-
- ./keys:/keys
21+
- ./keys:/app/keys
2222
environment:
2323
- LOG_LEVEL=${LOG_LEVEL:-INFO}
2424
- DB_NAME=crapi
@@ -178,7 +178,9 @@ services:
178178
image: crapi/crapi-web:${VERSION:-latest}
179179
ports:
180180
- "${LISTEN_IP:-127.0.0.1}:8888:80"
181+
- "${LISTEN_IP:-127.0.0.1}:30080:80"
181182
- "${LISTEN_IP:-127.0.0.1}:8443:443"
183+
- "${LISTEN_IP:-127.0.0.1}:30443:443"
182184
environment:
183185
- COMMUNITY_SERVICE=crapi-community:${COMMUNITY_SERVER_PORT:-8087}
184186
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
@@ -194,7 +196,7 @@ services:
194196
crapi-workshop:
195197
condition: service_healthy
196198
healthcheck:
197-
test: curl 0.0.0.0:80/web/health
199+
test: curl 0.0.0.0:80/health
198200
interval: 15s
199201
timeout: 15s
200202
retries: 15
@@ -276,7 +278,7 @@ services:
276278
#ports:
277279
# - "${LISTEN_IP:-127.0.0.1}:8443:443" # https
278280
healthcheck:
279-
test: echo -n "GET / HTTP/1.1\n\n\n" > /dev/tcp/127.0.0.1/443
281+
test: bash -c 'echo -n "GET / HTTP/1.1\n\n" > /dev/tcp/127.0.0.1/443'
280282
interval: 15s
281283
timeout: 15s
282284
retries: 15

deploy/helm/templates/mongodb/statefulset.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ spec:
3434
volumes:
3535
- name: mongodb-data
3636
persistentVolumeClaim:
37-
claimName: {{ .Values.mongodb.pvc.name }}
37+
claimName: {{ .Values.mongodb.storage.pvc.name }}
38+
Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
1-
kind: PersistentVolumeClaim
1+
{{- if eq .Values.mongodb.storage.type "manual" }}
22
apiVersion: v1
3-
3+
kind: PersistentVolume
4+
metadata:
5+
name: {{ .Values.mongodb.storage.pv.name }}
6+
labels:
7+
release: {{ .Release.Name }}
8+
{{- toYaml .Values.mongodb.storage.pv.labels | nindent 4 }}
9+
spec:
10+
storageClassName: {{ .Values.mongodb.storage.type }}
11+
capacity:
12+
storage: {{ .Values.mongodb.storage.pv.resources.storage }}
13+
accessModes:
14+
- ReadWriteOnce
15+
hostPath:
16+
path: {{ .Values.mongodb.storage.pv.hostPath }}
17+
---
18+
{{- end }}
19+
apiVersion: v1
20+
kind: PersistentVolumeClaim
421
metadata:
5-
name: {{ .Values.mongodb.pvc.name }}
22+
name: {{ .Values.mongodb.storage.pvc.name }}
623
labels:
724
release: {{ .Release.Name }}
8-
{{- toYaml .Values.mongodb.pvc.labels | nindent 4 }}
9-
25+
{{- toYaml .Values.mongodb.storage.pvc.labels | nindent 4 }}
1026
spec:
11-
#storageClassName: local-path
27+
{{- if ne .Values.mongodb.storage.type "default" }}
28+
storageClassName: {{ .Values.mongodb.storage.type }}
29+
{{- end }}
1230
accessModes:
1331
- ReadWriteOnce
14-
1532
resources:
16-
{{- toYaml .Values.mongodb.pvc.resources | nindent 4 }}
33+
{{- toYaml .Values.mongodb.storage.pvc.resources | nindent 4 }}
34+

deploy/helm/templates/postgres/statefulset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ spec:
3737
volumes:
3838
- name: postgres-data
3939
persistentVolumeClaim:
40-
claimName: {{ .Values.postgresdb.pvc.name }}
40+
claimName: {{ .Values.postgresdb.storage.pvc.name }}
Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
1-
kind: PersistentVolumeClaim
1+
{{- if eq .Values.postgresdb.storage.type "manual" }}
22
apiVersion: v1
3-
3+
kind: PersistentVolume
4+
metadata:
5+
name: {{ .Values.postgresdb.storage.pv.name }}
6+
labels:
7+
release: {{ .Release.Name }}
8+
{{- toYaml .Values.postgresdb.storage.pv.labels | nindent 4 }}
9+
spec:
10+
storageClassName: {{ .Values.postgresdb.storage.type }}
11+
capacity:
12+
storage: {{ .Values.postgresdb.storage.pv.resources.storage }}
13+
accessModes:
14+
- ReadWriteOnce
15+
hostPath:
16+
path: {{ .Values.postgresdb.storage.pv.hostPath }}
17+
---
18+
{{- end }}
19+
apiVersion: v1
20+
kind: PersistentVolumeClaim
421
metadata:
5-
name: {{ .Values.postgresdb.pvc.name }}
22+
name: {{ .Values.postgresdb.storage.pvc.name }}
623
labels:
724
release: {{ .Release.Name }}
8-
{{- toYaml .Values.postgresdb.pvc.labels | nindent 4 }}
9-
25+
{{- toYaml .Values.postgresdb.storage.pvc.labels | nindent 4 }}
1026
spec:
11-
#storageClassName: local-path
27+
{{- if ne .Values.postgresdb.storage.type "default" }}
28+
storageClassName: {{ .Values.postgresdb.storage.type }}
29+
{{- end }}
1230
accessModes:
1331
- ReadWriteOnce
14-
1532
resources:
16-
{{- toYaml .Values.postgresdb.pvc.resources | nindent 4 }}
33+
{{- toYaml .Values.postgresdb.storage.pvc.resources | nindent 4 }}

deploy/helm/values-pv.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
mongodb:
2+
storage:
3+
type: "manual"
4+
pv:
5+
name: mongodb-pv
6+
labels:
7+
app: mongodb
8+
resources:
9+
storage: 2Gi
10+
hostPath: /mnt/mongodb
11+
accessModes: ReadWriteOnce
12+
pvc:
13+
name: mongodb-pv-claim
14+
labels:
15+
app: mongodb
16+
resources:
17+
requests:
18+
storage: 2Gi
19+
20+
postgresdb:
21+
storage:
22+
type: "manual"
23+
pv:
24+
name: postgres-pv
25+
labels:
26+
app: postgresdb
27+
resources:
28+
storage: 2Gi
29+
hostPath: /mnt/postgresdb
30+
pvc:
31+
name: postgres-pv-claim
32+
labels:
33+
app: postgresdb
34+
accessModes: ReadWriteOnce
35+
resources:
36+
requests:
37+
storage: 2Gi

0 commit comments

Comments
 (0)