Skip to content

Commit 41579d5

Browse files
authored
Merge branch 'develop' into helmcharts
2 parents a792043 + 943f996 commit 41579d5

File tree

4 files changed

+149
-121
lines changed

4 files changed

+149
-121
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
build-context:
1919
runs-on: ubuntu-latest
2020
outputs:
21-
push_image: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')) || (github.event_name == 'release' && github.event.action == 'created') }}
21+
push_image: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')) || (github.event_name == 'release' && github.event.action == 'published') }}
2222
steps:
2323
- name: Dump GitHub context
2424
env:
@@ -32,55 +32,60 @@ jobs:
3232
steps:
3333
- name: Checkout code
3434
uses: actions/checkout@v3
35-
35+
3636
- name: Env seen prerun
3737
run: env
38-
38+
3939
- name: Get branch name
4040
id: branch-name
4141
uses: tj-actions/[email protected]
42-
42+
4343
- name: Current branch name
4444
run: |
4545
echo "Current Branch: ${{ steps.branch-name.outputs.current_branch }}"
4646
echo "Target Branch: ${{ steps.branch-name.outputs.base_ref_branch }}"
4747
echo "Tag if exist: ${{ steps.branch-name.outputs.tag }}"
48-
48+
4949
- name: Running on a tag.
5050
if: steps.branch-name.outputs.is_tag == 'true'
5151
run: |
5252
echo "TAG_NAME=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}
5353
echo "TAG_LATEST=latest" >> ${GITHUB_ENV}
54-
54+
5555
- name: Running on a branch and merge.
56-
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name == 'push'
56+
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name == 'push' && steps.branch-name.outputs.current_branch != 'main'
5757
run: |
5858
echo "TAG_NAME=${{ steps.branch-name.outputs.current_branch }}" >> ${GITHUB_ENV}
5959
echo "TAG_LATEST=${{ steps.branch-name.outputs.current_branch }}" >> ${GITHUB_ENV}
6060
61+
- name: Running on main branch.
62+
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name == 'push' && steps.branch-name.outputs.current_branch == 'main'
63+
run: |
64+
echo "TAG_NAME=${{ steps.branch-name.outputs.current_branch }}" >> ${GITHUB_ENV}
65+
echo "TAG_LATEST=latest" >> ${GITHUB_ENV}
66+
6167
- name: Running on a branch and pull req.
62-
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name != 'push'
68+
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name != 'push'
6369
run: |
6470
echo "TAG_NAME=${{ steps.branch-name.outputs.base_ref_branch }}" >> ${GITHUB_ENV}
6571
echo "TAG_LATEST=${{ steps.branch-name.outputs.base_ref_branch }}" >> ${GITHUB_ENV}
66-
67-
72+
6873
# setup Docker build action
6974
- name: Set up Docker Buildx
7075
id: buildx
7176
uses: docker/setup-buildx-action@v1
7277
- name: Set up QEMU
7378
id: qemu
7479
uses: docker/setup-qemu-action@v1
75-
80+
7681
- name: Login to DockerHub
7782
if: needs.build-context.outputs.push_image == 'true'
7883
uses: docker/login-action@v1
7984
with:
8085
username: ${{ secrets.DOCKERHUB_USERNAME }}
8186
password: ${{ secrets.DOCKERHUB_TOKEN }}
82-
83-
- name: Build crapi-identity image
87+
88+
- name: Build crapi-identity image
8489
uses: docker/build-push-action@v2
8590
with:
8691
context: ./services/identity
@@ -90,8 +95,8 @@ jobs:
9095
platforms: linux/amd64
9196
cache-from: type=gha
9297
cache-to: type=gha,mode=max
93-
94-
- name: Build crapi-workshop image
98+
99+
- name: Build crapi-workshop image
95100
uses: docker/build-push-action@v2
96101
with:
97102
context: ./services/workshop
@@ -101,8 +106,8 @@ jobs:
101106
platforms: linux/amd64
102107
cache-from: type=gha
103108
cache-to: type=gha,mode=max
104-
105-
- name: Build crapi-community image
109+
110+
- name: Build crapi-community image
106111
uses: docker/build-push-action@v2
107112
with:
108113
context: ./services/community
@@ -112,8 +117,8 @@ jobs:
112117
platforms: linux/amd64
113118
cache-from: type=gha
114119
cache-to: type=gha,mode=max
115-
116-
- name: Build crapi-web image
120+
121+
- name: Build crapi-web image
117122
uses: docker/build-push-action@v2
118123
with:
119124
context: ./services/web
@@ -129,8 +134,8 @@ jobs:
129134
uses: andstor/file-existence-action@v1
130135
with:
131136
files: "./services/mailhog"
132-
133-
- name: Build mailhog image
137+
138+
- name: Build mailhog image
134139
if: steps.check_mailhog_exists.outputs.files_exists == 'true'
135140
uses: docker/build-push-action@v2
136141
with:
@@ -141,13 +146,13 @@ jobs:
141146
platforms: linux/amd64
142147
cache-from: type=gha
143148
cache-to: type=gha,mode=max
144-
149+
145150
- name: Show all images built
146151
run: docker images
147-
152+
148153
- name: Env seen
149154
run: env
150-
155+
151156
- name: Run crAPI using built images
152157
run: VERSION=${{ env.TAG_NAME }} docker-compose -f deploy/docker/docker-compose.yml --compatibility up -d
153158

@@ -171,7 +176,7 @@ jobs:
171176
platforms: ${{ env.PLATFORMS }}
172177
cache-from: type=gha
173178
cache-to: type=gha,mode=max
174-
179+
175180
- name: Build crapi-workshop all platforms and conditionally push to Docker Hub
176181
uses: docker/build-push-action@v2
177182
with:
@@ -181,7 +186,7 @@ jobs:
181186
platforms: ${{ env.PLATFORMS }}
182187
cache-from: type=gha
183188
cache-to: type=gha,mode=max
184-
189+
185190
- name: Build crapi-community all platforms and conditionally push to Docker Hub
186191
uses: docker/build-push-action@v2
187192
with:
@@ -191,7 +196,7 @@ jobs:
191196
platforms: ${{ env.PLATFORMS }}
192197
cache-from: type=gha
193198
cache-to: type=gha,mode=max
194-
199+
195200
- name: Build crapi-web all platforms and conditionally push to Docker Hub
196201
uses: docker/build-push-action@v2
197202
with:
@@ -212,4 +217,4 @@ jobs:
212217
platforms: ${{ env.PLATFORMS }}
213218
cache-from: type=gha
214219
cache-to: type=gha,mode=max
215-
220+

README.md

Lines changed: 26 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -17,108 +17,48 @@ You'll need to have Docker installed and running on your host system.
1717
#### Using prebuilt images
1818
You can use prebuilt images generated by our CI workflow.
1919

20-
1. Clone crAPI repository
21-
22-
- Linux Machine
23-
24-
```
25-
$ git clone [REPOSITORY-URL]
26-
```
27-
28-
- Windows Machine
29-
30-
```
31-
$ git clone [REPOSITORY-URL] --config core.autocrlf=input
32-
```
33-
34-
35-
2. Start crAPI
36-
- To use the latest stable version.
20+
- To use the latest stable version.
3721

3822
- Linux Machine
39-
23+
4024
```
41-
git checkout main
42-
43-
VERSION=latest docker-compose -f deploy/docker/docker-compose.yml --compatibility up -d
25+
curl -o docker-compose.yml https://raw.githubusercontent.com/OWASP/crAPI/main/deploy/docker/docker-compose.yml
26+
27+
docker-compose -f docker-compose.yml --compatibility up -d
4428
```
4529

4630
- Windows Machine
47-
31+
4832
```
49-
git checkout main
50-
51-
setx VERSION latest && docker-compose -f deploy/docker/docker-compose.yml --compatibility up -d
33+
curl.exe -o docker-compose.yml https://raw.githubusercontent.com/OWASP/crAPI/main/deploy/docker/docker-compose.yml
34+
35+
docker-compose -f docker-compose.yml --compatibility up -d
5236
```
5337

54-
- To use the latest development version
38+
- To use the latest development version
5539

5640
- Linux Machine
57-
58-
```
59-
git checkout develop
60-
61-
VERSION=develop docker-compose -f deploy/docker/docker-compose.yml --compatibility up -d
62-
```
6341

64-
- Windows Machine
65-
6642
```
67-
git checkout develop
43+
curl -o docker-compose.yml https://raw.githubusercontent.com/OWASP/crAPI/develop/deploy/docker/docker-compose.yml
6844
69-
setx VERSION develop && docker-compose -f deploy/docker/docker-compose.yml --compatibility up -d
45+
VERSION=develop docker-compose -f docker-compose.yml --compatibility up -d
7046
```
7147
72-
3. Visit `http://localhost:8888`
73-
74-
**Note**: All emails are sent to mailhog service by default and can be checked on
75-
`http://localhost:8025`
76-
You can change the smtp configuration if required however all emails with domain **example.com** will still go to mailhog.
77-
78-
79-
#### Build it yourself
80-
81-
1. Clone crAPI repository
82-
83-
- Linux Machine
84-
85-
```
86-
$ git clone [REPOSITORY-URL]
87-
```
88-
89-
- Windows Machine
90-
91-
```
92-
$ git clone [REPOSITORY-URL] --config core.autocrlf=input
93-
```
94-
95-
2. Build all docker images
96-
97-
- Linux Machine
98-
99-
```
100-
$ deploy/docker/build-all.sh
101-
```
48+
- Windows Machine
10249
103-
- Windows Machine
50+
```
51+
curl.exe -o docker-compose.yml https://raw.githubusercontent.com/OWASP/crAPI/develop/deploy/docker/docker-compose.yml
10452
105-
```
106-
$ call "%cd%\deploy\docker\build-all.bat"
107-
```
53+
setx VERSION develop && docker-compose -f docker-compose.yml --compatibility up -d
54+
```
10855
109-
3. Start crAPI
110-
```
111-
$ docker-compose -f deploy/docker/docker-compose.yml --compatibility up -d
112-
```
113-
4. Visit `http://localhost:8888`
56+
Visit [http://localhost:8888](http://localhost:8888)
11457
11558
**Note**: All emails are sent to mailhog service by default and can be checked on
116-
`http://localhost:8025`
59+
[http://localhost:8025](http://localhost:8025)
11760
You can change the smtp configuration if required however all emails with domain **example.com** will still go to mailhog.
11861
119-
If you would like to deploy on kubernetes we have sample k8s configs already
120-
created. Check [the setup instructions][setup-k8s] for more details.
121-
12262
### Vagrant
12363
12464
This option allows you to run crAPI within a virtual machine, thus isolated from
@@ -133,10 +73,10 @@ installed.
13373
```
13474
$ cd deploy/vagrant && vagrant up
13575
```
136-
3. Visit `http://192.168.33.20`
76+
3. Visit [http://192.168.33.20](http://192.168.33.20)
13777
13878
**Note**: All emails are sent to mailhog service and can be checked on
139-
`http://192.168.33.20:8025`
79+
[http://192.168.33.20:8025](http://192.168.33.20:8025)
14080
14181
Once you're done playing with crAPI, you can remove it completely from your
14282
system running the following command from the repository root directory
@@ -145,8 +85,13 @@ system running the following command from the repository root directory
14585
$ cd deploy/vagrant && vagrant destroy
14686
```
14787
88+
For more deployment options visit [the setup instructions](docs/setup.md) for more details.
14889
---
14990
91+
To know more about challenges in crAPI. Visit [challenges]
92+
----
93+
94+
[challenges]: docs/challenges.md
15095
[overview]: docs/overview.md
15196
[setup-k8s]: docs/setup.md#kubernetes-minikube
15297
[vagrant]: https://www.vagrantup.com/downloads

docs/overview.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,16 @@ crAPI has a microservices architecture comprising the following services develop
1616
* postgres: SQL Database
1717

1818
[0]: ./challenges.md
19+
20+
21+
For deployment options, visit [the setup instructions](docs/setup.md).
22+
---
23+
24+
To know more about challenges in crAPI, visit [challenges].
25+
----
26+
27+
[challenges]: docs/challenges.md
28+
[overview]: docs/overview.md
29+
[setup-k8s]: docs/setup.md#kubernetes-minikube
30+
[vagrant]: https://www.vagrantup.com/downloads
31+
[virtualbox]: https://www.virtualbox.org/wiki/Downloads

0 commit comments

Comments
 (0)