-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.sh
33 lines (28 loc) · 831 Bytes
/
startup.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
#!/bin/bash
### Env
HOME=/home/swarm
PDIR=/home/swarm/wpcluster_poc
CLEAN=/home/swarm/wpcluster_poc/certs/.gitignore
CLEAN2=/home/swarm/wpcluster_poc/webroot/.gitignore
CERT=$(find /home/swarm/wpcluster_poc/certs -type f -name "*.pem")
### Env
if [ -d "$PDIR" ]; then
echo "Project exists ..."
else
echo "Create Project ..."
cd $HOME
git clone https://github.com/herzog-network/wpcluster_poc.git
fi
if test -f "$CLEAN"; then
echo "Cleanup ..."
rm -rf $CLEAN && rm -rf $CLEAN2
else
echo "Skip cleanup ..."
fi
if [ -f "$CERT" ]; then
echo "Cert exists ..."
else
echo "Create cert ..."
cd $PDIR && openssl req -nodes -x509 -newkey rsa:2048 -keyout wpc.key -out wpc.crt -days 30 && cat wpc.key wpc.crt > ./certs/wpc.pem
fi
cd $PDIR && docker stack deploy --compose-file compose.yml wpcluster