-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart-stack.sh
executable file
·63 lines (54 loc) · 1.6 KB
/
start-stack.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
SCRIPT_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1; pwd -P )"
SRC_DIR="$SCRIPT_DIR/.."
COMPOSE_PROFILES="${COMPOSE_PROFILES:-}"
COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-}"
COMPOSE_ENV_FILES="${COMPOSE_ENV_FILES:-}"
print_help () {
cat <<EOF
Usage: $0 OPTION[=VALUE]...
Script for starting up an API stack for Denser
OPTIONS:
--profiles=P1,P2,P3 Profile(s) to use, if empty only API is started (default: empty)
--project-name=NAME Name of the Compose project (default: defined at the top of stack/compose.yml)
--env-files=1.env,2.env Specify a file to use to start the stack, uses ${SRC_DIR}/stack/.env
when empty (default: empty)
--help,-h,-? Display this help screen and exit
Available profiles:
- denser - starts auth, blog and wallet services in addition to the API stack
EOF
}
set -e
while [ $# -gt 0 ]; do
case "$1" in
--profiles=*)
arg="${1#*=}"
COMPOSE_PROFILES="$arg"
;;
--project-name=*)
arg="${1#*=}"
COMPOSE_PROJECT_NAME="$arg"
;;
--env-files=*)
arg="${1#*=}"
COMPOSE_ENV_FILES="$arg"
;;
--help|-h|-\?)
print_help
exit 0
;;
*)
echo "ERROR: '$1' is not a valid option/positional argument"
echo
print_help
exit 2
;;
esac
shift
done
pushd "$SRC_DIR/stack"
export COMPOSE_PROFILES
export COMPOSE_PROJECT_NAME
export COMPOSE_ENV_FILES
docker compose up --detach
popd