Skip to content

Commit fd72938

Browse files
authored
Merge pull request #119 from OWASP/container-preload
Preload all containers: no build required for faster starting
2 parents d405a0c + d22d1dc commit fd72938

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

build-an-deploy-container.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
echo "This Script can be used to 'easily' build all WrongSecrets CTF party Components and install them to a local kubernetes cluster"
4+
echo "For this to work the local kubernetes cluster must have access to the same local registry / image cache which 'docker build ...' writes its image to"
5+
echo "For example docker-desktop with its included k8s cluster"
6+
7+
echo "Usage: ./build-an-deploy.sh"
8+
9+
source ./scripts/check-available-commands.sh
10+
checkCommandsAvailable helm docker kubectl yq
11+
12+
version="$(uuidgen)"
13+
docker login
14+
WRONGSECRETS_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecrets.image')
15+
WRONGSECRETS_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecrets.tag')
16+
WEBTOP_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.virtualdesktop.image')
17+
WEBTOP_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.virtualdesktop.tag')
18+
WRONGSECRETS_BALANCER_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.balancer.repository')
19+
WRONGSECRETS_BALANCER_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.balancer.tag')
20+
WRONGSECRETS_CLEANER_IMAGE=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecretsCleanup.repository')
21+
WRONGSECRETS_CLEANER_TAG=$(cat helm/wrongsecrets-ctf-party/values.yaml| yq '.wrongsecretsCleanup.tag')
22+
echo "Pulling in required images to actually run $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG & $WEBTOP_IMAGE:$WEBTOP_TAG."
23+
echo "If you see an authentication failure: pull them manually by the following 2 commands"
24+
echo "'docker pull $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG'"
25+
echo "'docker pull $WEBTOP_IMAGE:$WEBTOP_TAG'"
26+
echo "'docker pull $WRONGSECRETS_BALANCER_IMAGE:$WRONGSECRETS_BALANCER_TAG'" &
27+
echo "'docker pull $WRONGSECRETS_CLEANER_IMAGE:$WRONGSECRETS_CLEANER_TAG'" &
28+
docker pull $WRONGSECRETS_IMAGE:$WRONGSECRETS_TAG &
29+
docker pull $WEBTOP_IMAGE:$WEBTOP_TAG &
30+
docker pull $WRONGSECRETS_BALANCER_IMAGE:$WRONGSECRETS_BALANCER_TAG &
31+
docker pull $WRONGSECRETS_CLEANER_IMAGE:$WRONGSECRETS_CLEANER_TAG
32+
wait
33+
34+
helm upgrade --install mj ./helm/wrongsecrets-ctf-party --set="imagePullPolicy=Never"

readme.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ For minikube, run:
105105

106106
minikube start --cpus=6 --memory=10000MB --network-plugin=cni --cni=calico
107107
eval $(minikube docker-env)
108-
./build-an-deploy.sh
108+
./build-an-deploy-container.sh
109109
kubectl port-forward service/wrongsecrets-balancer 3000:3000
110110

111111
```
@@ -118,6 +118,18 @@ kubectl top nodes
118118
kubectl top pods
119119
```
120120

121+
### Develop with Minikube
122+
123+
```shell
124+
125+
minikube start --cpus=6 --memory=10000MB --network-plugin=cni --cni=calico
126+
eval $(minikube docker-env)
127+
./build-an-deploy.sh
128+
kubectl port-forward service/wrongsecrets-balancer 3000:3000
129+
130+
```
131+
132+
121133
### Play with AWS EKS:
122134

123135
** NOTE: SEE SECTIONS ABOVE ABOUT WHAT YOU NEED AND THE COST OF THINGS: This project is not responsible, and will not pay for any part of your AWS bill. **

0 commit comments

Comments
 (0)