This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
start.sh
executable file
·94 lines (80 loc) · 2.21 KB
/
start.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
#!/usr/bin/env bash
set -e
export PATH="$PATH:$HOME/.local/bin"
export COMPOSE_PROJECT_NAME="negentropy"
function usage {
echo -e "Usage: $(basename "$0") [option]\n"
echo "Options:"
echo " e2e for e2e tests"
echo " single single vault"
echo " debug debug with dlv"
echo " local local development"
}
case "$1" in
single)
MODE="single"
;;
e2e)
MODE="e2e"
;;
debug)
MODE="debug"
;;
local)
MODE="local"
;;
--help|-h|"")
usage && exit 0
;;
*)
printf "Illegal option $1\n"
usage && exit 1
;;
esac
echo DEBUG: MODE is $MODE
if [[ $MODE == "single" ]]; then
docker-compose -f docker/docker-compose.common.yml -f docker/docker-compose.single.yml up -d
elif [[ $MODE == "e2e" ]]; then
docker-compose -f docker/docker-compose.common.yml -f docker/docker-compose.yml up -d
elif [[ $MODE == "debug" ]]; then
docker-compose -f docker/docker-compose.common.yml -f docker/docker-compose.debug.yml up -d
while true; do
read -p "Are you ready? (Y/n) " ANSWER;
if [[ -z "$ANSWER" ]]; then ANSWER=Y; fi
case $ANSWER in
[Yy]* ) break;;
[Nn]* ) exit 1;;
esac
done
elif [[ $MODE == "local" ]]; then
docker-compose -f docker/docker-compose.common.yml -f docker/docker-compose.yml up -d
if [[ -f okta-uuid ]]; then
OKTA_UUID=$(cat okta-uuid)
fi
if [[ -z $OKTA_UUID ]]; then
echo -n "Enter your OKTA UUID: "
read -r OKTA_UUID
echo $OKTA_UUID > okta-uuid
fi
echo DEBUG: OKTA UUID is $OKTA_UUID
if [[ -f okta-email ]]; then
OKTA_EMAIL=$(cat okta-email)
fi
if [[ -z $OKTA_EMAIL ]]; then
echo -n "Enter your OKTA EMAIL: "
read -r OKTA_EMAIL
echo $OKTA_EMAIL > okta-email
fi
echo DEBUG: OKTA EMAIL is $OKTA_EMAIL
fi
pip3 install virtualenv
python3 -m virtualenv infra/vault_migrator/environment
source infra/vault_migrator/environment/bin/activate
pip3 install -r infra/vault_migrator/requirements.txt
export VAULT_CACERT=docker/vault/tls/ca.crt # used at vault.hvac to connect https://vault
if [[ $MODE == "local" ]]; then
python3 infra/vault_migrator/migrator.py local --okta-uuid $OKTA_UUID --okta-email $OKTA_EMAIL
else
python3 infra/vault_migrator/migrator.py local
fi
deactivate