-
Notifications
You must be signed in to change notification settings - Fork 192
/
Copy pathdeploy.sh
45 lines (35 loc) · 938 Bytes
/
deploy.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
#!/bin/bash
export PATH=$PATH:/usr/local/go/bin
if [ "$#" -ne 6 ]; then
echo "Usage: $0 <source_root> <directory> <fs_paths> <primary_host> <proxy_cnt> <port>"
exit 1
fi
source_root="$1"
directory="$2"
fs_paths="$3"
primary_host="$4"
proxy_cnt="$5"
port="$6"
# Convert the comma-separated paths to an array
IFS=',' read -r -a fs_paths_array <<< "$fs_paths"
# Create the AIS_FS_PATHS config entry
FSP=()
for disk in "${fs_paths_array[@]}"; do
FSP+=("\"$directory/$disk\": {}")
done
FSP=$(printf ", %s" "${FSP[@]}")
# Remove the leading comma and space
FSP=${FSP:2}
# Set the env variables
export AIS_PRIMARY_HOST="$primary_host"
export AIS_FS_PATHS="$FSP"
export PORT="$port"
export GOPATH=~/go
echo "Run config:"
echo "FS paths: $AIS_FS_PATHS"
echo "Port: $PORT"
echo "Primary host: $AIS_PRIMARY_HOST"
cd "$source_root"
# Kill old and deploy new
make cli && make kill
echo -e "1\n$proxy_cnt\n0\nn\nn\nn\nn\n" | make deploy