-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.sh
executable file
·136 lines (103 loc) · 3.54 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
set -e
set -o xtrace
DOMAIN_LOGIN=login.cryptoverse.local
DOMAIN_DEMO=login-demo.cryptoverse.local
echo "Enable DNS"
microk8s enable dns
echo "Enable prometheus"
microk8s enable prometheus
sleep 10s
echo "Enable storage"
microk8s enable hostpath-storage
sleep 10s
echo "Enable ingress"
microk8s enable ingress
sleep 10s
echo "Enable registry"
microk8s enable registry
sleep 10s
echo "Install postgress"
microk8s helm upgrade --install postgres bitnami/postgresql \
--set auth.database=cryptoverse-login,auth.username=cryptoverse,auth.password=cryptopass \
--version 12.4.3 \
--wait=true
sleep 10s
echo "Create namesapces"
microk8s kubectl create namespace cryptoverse-login || true
microk8s kubectl create namespace cryptoverse-login-demo || true
echo "Generate certificates"
microk8s kubectl delete secret cryptoverse-login -n cryptoverse-login --ignore-not-found --wait=true
cat <<EOF > local.conf
[req]
distinguished_name=dn
[ dn ]
[ ext ]
basicConstraints=CA:FALSE,pathlen:0
subjectAltName=DNS:$DOMAIN_LOGIN
extendedKeyUsage=serverAuth
EOF
openssl req -x509 -new -nodes -days 1 -newkey rsa:2048 \
-out local.crt \
-keyout local.key \
-config local.conf \
-extensions ext \
-subj "/CN=${DOMAIN_LOGIN}/O=Cryptoverse OU"
microk8s kubectl create secret tls cryptoverse-login \
--namespace cryptoverse-login \
--key local.key \
--cert local.crt
microk8s kubectl delete secret login-demo-tls -n cryptoverse-login-demo --ignore-not-found --wait=true
cat <<EOF > local-demo.conf
[req]
distinguished_name=dn
[ dn ]
[ ext ]
basicConstraints=CA:FALSE,pathlen:0
subjectAltName=DNS:$DOMAIN_DEMO
extendedKeyUsage=serverAuth
EOF
openssl req -x509 -new -nodes -days 1 -newkey rsa:2048 \
-out local-demo.crt \
-keyout local-demo.key \
-config local-demo.conf \
-extensions ext \
-subj "/CN=${DOMAIN_DEMO}/O=Cryptoverse OU"
microk8s kubectl create secret tls login-demo-tls \
--namespace cryptoverse-login-demo \
--key local-demo.key \
--cert local-demo.crt
echo "Build the application"
export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1
export PROJECT=cryptoverse-login
export REGISTRY=localhost:32000/cryptoverse
TAG="v$(date '+%Y%m%d_%H%M%S')"
export TAG
docker-compose -f docker-compose.build.yml build --pull #--parallel
docker-compose -f docker-compose.build.yml push
echo "Install Cryptoverse Login"
microk8s helm3 upgrade cryptoverse-login ./charts/login/ \
--install \
--namespace cryptoverse-login \
--values charts/login/values.yaml \
--values charts/login/values.local.yaml \
--set version="$TAG" \
--debug
echo "Build Demo App"
docker-compose -f tests/cryptoverse-login-demo/docker-compose.build.yml build --pull #--parallel
docker-compose -f tests/cryptoverse-login-demo/docker-compose.build.yml push
echo "Install demo app"
microk8s helm3 upgrade cryptoverse-login-demo ./tests/cryptoverse-login-demo/charts/demo/ \
--install \
--namespace cryptoverse-login-demo \
--values ./tests/cryptoverse-login-demo/charts/demo/values.yaml \
--values ./tests/cryptoverse-login-demo/charts/demo/values.local.yaml \
--set version="$TAG" \
--set tlsSecretName=login-demo-tls \
--set demo.oidc.jwksEndpoint=http://cryptoverse-login-hydra-public.cryptoverse-login:4444/.well-known/jwks.json \
--set demo.oidc.tokenEndpoint=http://cryptoverse-login-hydra-public.cryptoverse-login:4444/oauth2/token \
--set demo.oidc.userEndpoint=http://cryptoverse-login-hydra-public.cryptoverse-login:4444/userinfo \
--debug
dig $DOMAIN_LOGIN
dig $DOMAIN_DEMO