-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·48 lines (38 loc) · 1.29 KB
/
deploy.sh
File metadata and controls
executable file
·48 lines (38 loc) · 1.29 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
44
45
46
47
48
#!/bin/bash
COFF='\033[0m'
CBLACK='\033[0;30m'
CRED='\033[0;31m'
CGREEN='\033[0;32m'
CYELLOW='\033[0;33m'
CBLUE='\033[0;34m'
CPURPLE='\033[0;35m'
CCYAN='\033[0;36m'
CWHITE='\033[0;37m'
CGRAY='\033[1;30m'
SED_PATTERN="s/^/$(tput setaf 0)$(tput bold)Docker : $(tput sgr0) /"
function printf() { builtin printf "${CGRAY}GogsonStack: ${COFF} $1"; }
########################
#### CORE
########################
function configure()
{
printf "${CGREEN}Creating data volumes${COFF}\n"
docker volume create portainer_data 2>&1 | sed "${SED_PATTERN}"
docker volume create traefik_data 2>&1 | sed "${SED_PATTERN}"
docker volume create swarmpit_data 2>&1 | sed "${SED_PATTERN}"
printf "${CGREEN}Creating networks${COFF}\n"
docker network create -d overlay --attachable agents 2>&1 | sed "${SED_PATTERN}"
docker network create -d overlay --attachable proxy 2>&1 | sed "${SED_PATTERN}"
}
function deploy()
{
if [ ! -f stack-config.env ]; then
printf "${CRED}No stack-config.env file found${COFF}\n"
printf "${CRED}Copy the configuration file and edit it${COFF}\n"
exit 1
fi
configure
printf "${CGREEN}Deploying stack${COFF}\n"
source stack-config.env && docker stack deploy -c docker-cloud.yml gogson-stack 2>&1 | sed "${SED_PATTERN}"
}
deploy