-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote_init.sh
More file actions
executable file
·43 lines (40 loc) · 1.13 KB
/
remote_init.sh
File metadata and controls
executable file
·43 lines (40 loc) · 1.13 KB
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
#!/bin/bash
if hash docker 2>/dev/null; then
echo "✅ Docker is installed"
else
echo "❌ Docker is not installed"
exit 1
fi
if hash docker-compose 2>/dev/null; then
echo "✅ Docker Compose is installed"
else
echo "❌ Docker compose is not installed"
exit 1
fi
if [ -f .env ]; then
# Load Environment Variables
echo "✅ Loading environment variabled"
export $(cat .env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
else
echo "❌ Could not find .env file, rename .env.template and populate the file"
exit 1
fi
if [ -f "$GIT_SSH_KEY" ]; then
echo "✅ Copying GIT SSH key file to ${PWD}"
cp "${GIT_SSH_KEY}" ./git.pem
else
echo "❌ $GIT_SSH_KEY does not exist, exiting setup."
exit 1
fi
docker stop dev # In case running from local
docker rm dev # In case running from local
if hash caddy 2>/dev/null; then
# Load Environment Variables
echo "✅ Caddy is locally installed -> Stopping caddy in case it runs"
caddy stop
fi
docker-compose build --force-rm
docker-compose up -d --force-recreate
rm -Rf ./git.pem
docker-compose logs | grep "secret"
echo "Done Script"