-
Notifications
You must be signed in to change notification settings - Fork 4
/
init
executable file
·44 lines (34 loc) · 1.15 KB
/
init
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
#!/usr/bin/env bash
## Initialize stack and site (full reset)
##
## Usage: fin init
# Abort if anything fails
set -e
#-------------------------- Helper functions --------------------------------
# Console colors
red='\033[0;31m'
green='\033[0;32m'
green_bg='\033[42m'
yellow='\033[1;33m'
NC='\033[0m'
echo-red () { echo -e "${red}$1${NC}"; }
echo-green () { echo -e "${green}$1${NC}"; }
echo-green-bg () { echo -e "${green_bg}$1${NC}"; }
echo-yellow () { echo -e "${yellow}$1${NC}"; }
#-------------------------- Execution --------------------------------
# Stack initialization
echo -e "${green_bg} Step 1 ${NC}${green} Initializing stack...${NC}"
if [[ $DOCKER_RUNNING == "true" ]]; then
fin reset -f
else
fin up
fi
echo "Waiting 10s for MySQL to initialize...";
sleep 10
# Site initialization
echo -e "${green_bg} Step 2 ${NC}${green} Initializing site...${NC}"
# This runs inside cli using https://docs.docksal.io/fin/custom-commands/#target_cli
fin init-site
echo -en "${green_bg} DONE! ${NC} "
echo -e "Open ${yellow}http://${VIRTUAL_HOST}${NC} in your browser to verify the setup."
#-------------------------- END: Execution --------------------------------