1
1
#! /usr/bin/env bash
2
2
3
- # Deployment script - intended to run on Spire servers
3
+ # Deployment script - intended to run on Spire API server
4
+
5
+ # Colors
6
+ C_RESET=' \033[0m'
7
+ C_RED=' \033[1;31m'
8
+ C_GREEN=' \033[1;32m'
9
+ C_YELLOW=' \033[1;33m'
10
+
11
+ # Logs
12
+ PREFIX_INFO=" ${C_GREEN} [INFO]${C_RESET} [$( date +%d-%m\ %T) ]"
13
+ PREFIX_WARN=" ${C_YELLOW} [WARN]${C_RESET} [$( date +%d-%m\ %T) ]"
14
+ PREFIX_CRIT=" ${C_RED} [CRIT]${C_RESET} [$( date +%d-%m\ %T) ]"
4
15
5
16
# Main
6
17
APP_DIR=" ${APP_DIR:-/ home/ ubuntu/ spire} "
@@ -27,19 +38,23 @@ set -eu
27
38
28
39
echo
29
40
echo
30
- echo " Updating Python dependencies"
31
- " ${PIP} " install --upgrade pip
32
- " ${PIP} " install --exists-action i -r " ${APP_DIR} /requirements.txt"
41
+ echo -e " ${PREFIX_INFO} Upgrading Python pip and setuptools"
42
+ " ${PIP} " install --upgrade pip setuptools
43
+
44
+ echo
45
+ echo
46
+ echo -e " ${PREFIX_INFO} Installing Python dependencies"
47
+ " ${PIP} " install -e " ${APP_DIR} /"
33
48
34
49
echo
35
50
echo
36
- echo " Retrieving deployment parameters"
51
+ echo -e " ${PREFIX_INFO} Retrieving deployment parameters"
37
52
mkdir -p " ${SECRETS_DIR} "
38
53
AWS_DEFAULT_REGION=" ${AWS_DEFAULT_REGION} " " ${PYTHON} " " ${PARAMETERS_SCRIPT} " " ${AWS_SSM_PARAMETER_PATH} " -o " ${PARAMETERS_ENV_PATH} "
39
54
40
55
echo
41
56
echo
42
- echo " Replacing existing Spire service definition with ${SERVICE_FILE} "
57
+ echo -e " ${PREFIX_INFO} Replacing existing Spire service definition with ${SERVICE_FILE} "
43
58
chmod 644 " ${SERVICE_FILE} "
44
59
cp " ${SERVICE_FILE} " /etc/systemd/system/spire.service
45
60
systemctl daemon-reload
@@ -49,7 +64,7 @@ systemctl status spire.service
49
64
50
65
echo
51
66
echo
52
- echo " Replacing existing Spire GitHub service and timer definitions with: ${TOKEN_SERVICE_FILE} , ${TOKEN_TIMER_FILE} "
67
+ echo -e " ${PREFIX_INFO} Replacing existing Spire GitHub service and timer definitions with: ${TOKEN_SERVICE_FILE} , ${TOKEN_TIMER_FILE} "
53
68
chmod 644 " ${TOKEN_SERVICE_FILE} " " ${TOKEN_TIMER_FILE} "
54
69
cp " ${TOKEN_SERVICE_FILE} " /etc/systemd/system/spiregithubtoken.service
55
70
cp " ${TOKEN_TIMER_FILE} " /etc/systemd/system/spiregithubtoken.timer
@@ -60,7 +75,7 @@ systemctl start spiregithubtoken.timer
60
75
61
76
echo
62
77
echo
63
- echo " Replacing existing Spire Humbug tokens synchronization service and timer definitions with: ${HUMBUG_TOKENS_SERVICE_FILE} , ${HUMBUG_TOKENS_TIMER_FILE} "
78
+ echo -e " ${PREFIX_INFO} Replacing existing Spire Humbug tokens synchronization service and timer definitions with: ${HUMBUG_TOKENS_SERVICE_FILE} , ${HUMBUG_TOKENS_TIMER_FILE} "
64
79
chmod 644 " ${HUMBUG_TOKENS_SERVICE_FILE} " " ${HUMBUG_TOKENS_TIMER_FILE} "
65
80
cp " ${HUMBUG_TOKENS_SERVICE_FILE} " /etc/systemd/system/spirehumbugtokens.service
66
81
cp " ${HUMBUG_TOKENS_TIMER_FILE} " /etc/systemd/system/spirehumbugtokens.timer
0 commit comments