forked from USC-NSL/ripe-atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_service
More file actions
executable file
·38 lines (29 loc) · 938 Bytes
/
deploy_service
File metadata and controls
executable file
·38 lines (29 loc) · 938 Bytes
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
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: user@host version"
exit 1
fi
#initialize ssh environment variables
source ~/.ssh/environment
app="atlas-service"
port=8080
host=$1
version=$2
script_dir=$(dirname $0)
cd $script_dir
remote_dir="$app/$version"
#create remote directory structure if it doesn't exist. create symlink to CURRENT
cmd="if [ ! -d $remote_dir ]; then mkdir --parents $remote_dir; fi; rm -f $app/CURRENT; ln -s ~/$remote_dir $app/CURRENT;"
ssh $host $cmd
if ssh $host test ! -e "$app/logging.json" -a ! -e "$app/.key"; then
echo "logging and .key have not been configured! Exiting."
exit 1
fi
#perform upload
echo "uploading files to $host:$remote_dir"
scp *.py $host:$remote_dir
#restart
echo "restarting $app"
ssh $host "pkill -f $app"
ssh $host "$app/run $port"
#ssh $host "LOG_CFG=$app/logging.json; nohup $remote_dir/traceroute_service.py $port \$(cat $app/.key) &> $app/log < /dev/null &"