forked from MarquezProject/marquez
-
Notifications
You must be signed in to change notification settings - Fork 0
/
up.sh
executable file
·113 lines (101 loc) · 2.58 KB
/
up.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
#
# Copyright 2018-2022 contributors to the Marquez project
# SPDX-License-Identifier: Apache-2.0
set -e
VERSION=0.26.0
DOCKER_DIR=$(dirname $0)
title() {
echo -e "\033[1m${1}\033[0m"
}
usage() {
echo "usage: ./$(basename -- ${0}) [--api-port PORT] [--web-port PORT] [--tag TAG] [--build] [--seed] [--detach]"
echo "A script used to run Marquez via Docker"
echo
title "EXAMPLES:"
echo " # Build image from source"
echo " $ ./up.sh --build"
echo
echo " # Build image from source, then seed HTTP API server with metadata"
echo " $ ./up.sh --build --seed"
echo
echo " # Use tagged image"
echo " ./up.sh --tag X.Y.X"
echo
echo " # Use tagged image, then seed HTTP API server with metadata"
echo " ./up.sh --tag X.Y.X --seed"
echo
echo " # Set HTTP API server port"
echo " ./up.sh --api-port 9000"
echo
title "ARGUMENTS:"
echo " -a, --api-port int api port (default: 5000)"
echo " -m, --api-admin-port int api admin port (default: 5001)"
echo " -w, --web-port int web port (default: 3000)"
echo " -t, --tag string image tag (default: ${VERSION})"
echo
title "FLAGS:"
echo " -b, --build build images from source"
echo " -s, --seed seed HTTP API server with metadata"
echo " -d, --detach run in the background"
echo " -h, --help show help for script"
exit 1
}
# Change working directory to project root
project_root=$(git rev-parse --show-toplevel)
cd "${project_root}/"
compose_files="-f docker-compose.yml"
args="-V --force-recreate --remove-orphans"
API_PORT=5000
API_ADMIN_PORT=5001
WEB_PORT=3000
TAG=${VERSION}
while [ $# -gt 0 ]; do
case $1 in
-a|'--api-port')
shift
API_PORT="${1}"
;;
-m|'--api-admin-port')
shift
API_ADMIN_PORT="${1}"
;;
-w|'--web-port')
shift
WEB_PORT="${1}"
;;
-t|'--tag')
shift
TAG="${1}"
;;
-b|'--build')
BUILD='true'
;;
-s|'--seed')
SEED='true'
;;
-d|'--detach')
DETACH='true'
;;
-h|'--help')
usage
exit 0
;;
*) usage
exit 1
;;
esac
shift
done
if [[ "${DETACH}" = "true" ]]; then
args+=" -d"
fi
if [[ "${BUILD}" = "true" ]]; then
compose_files+=" -f docker-compose.dev.yml"
args+=" --build"
fi
if [[ "${SEED}" = "true" ]]; then
compose_files+=" -f docker-compose.seed.yml"
fi
${DOCKER_DIR}/volumes.sh marquez
API_PORT=${API_PORT} API_ADMIN_PORT=${API_ADMIN_PORT} WEB_PORT=${WEB_PORT} TAG=${TAG} docker-compose $compose_files up $args