-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·107 lines (88 loc) · 3.41 KB
/
start.sh
File metadata and controls
executable file
·107 lines (88 loc) · 3.41 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
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
#!/usr/bin/env bash
set -e
source utils.sh
# Set CLI options
setDockerComposeCLIOptions
# Export the DISTRO_PATH variable
setupDirs
# Export the paths variables to point to distro artifacts
exportPaths
# Export IP address of the host machine
if [ "$ENABLE_SSO" == "true" ]; then
exportHostIP
fi
# Set the Traefik host names
if [ "$TRAEFIK" == "true" ]; then
echo "$INFO \$TRAEFIK=true, setting Traefik hostnames..."
setTraefikIP
setTraefikHostnames
else
echo "$INFO \$TRAEFIK!=true, setting Nginx hostnames..."
setNginxHostnames
fi
# Set the demo patients props
if [ "$DEMO" == "true" ]; then
echo "$INFO DEMO=true, setting the number of demo patients..."
export NUMBER_OF_DEMO_PATIENTS=50
echo "→ NUMBER_OF_DEMO_PATIENTS=$NUMBER_OF_DEMO_PATIENTS"
fi
setupProjectName
if ! isOzoneRunning "$PROJECT_NAME"; then
echo "$INFO Starting Ozone project with name: $PROJECT_NAME"
else
echo "$WARN Ozone project with name: $PROJECT_NAME is already running"
echo "$INFO Re-applying Docker Compose up command to ensure all services are up-to-date..."
fi
INSTALLED_DOCKER_VERSION=$(docker version -f "{{.Server.Version}}")
MINIMUM_REQUIRED_DOCKER_VERSION_REGEX="^((([2-9][1-9]|[3-9][0]|[0-9]{3,}).*)|(20\.([0-9]{3,}|[1-9][1-9]|[2-9][0]).*)|(20\.10\.([0-9]{3,}|[2-9][0-9]|[1][3-9])))"
if [[ $INSTALLED_DOCKER_VERSION =~ $MINIMUM_REQUIRED_DOCKER_VERSION_REGEX ]]; then
INSTALLED_DOCKER_COMPOSE_VERSION=$(docker compose version --short 2>/dev/null)
MINIMUM_REQUIRED_DOCKER_COMPOSE_VERSION_REGEX="^([2-9]|[1-9][0-9]+)\.*"
if [[ $INSTALLED_DOCKER_COMPOSE_VERSION =~ $MINIMUM_REQUIRED_DOCKER_COMPOSE_VERSION_REGEX ]]; then
if command -v gp version &> /dev/null; then
export GITPOD_ENV="true"
export USE_HTTPS="true"
else
export GITPOD_ENV="false"
fi
# Export the scheme
exportScheme
# Pull Ozone Docker images
echo "$INFO Pulling ${OZONE_LABEL:-Ozone FOSS} images..."
docker compose -p $PROJECT_NAME $dockerComposeOzoneCLIOptions pull
# Set the Docker Compose command for Ozone
dockerComposeOzoneCommand="docker compose -p $PROJECT_NAME $dockerComposeOzoneCLIOptions up -d --build"
echo "$INFO Running ${OZONE_LABEL:-Ozone FOSS}..."
echo ""
echo "$dockerComposeOzoneCommand"
echo ""
# Create the networks
docker network inspect web >/dev/null 2>&1 || docker network create web
# Run Ozone
($dockerComposeOzoneCommand)
# Run the Nginx Proxy service, if $TRAEFIK!=true
if [ "$TRAEFIK" != "true" ]; then
dockerComposeProxyCommand="docker compose -p $PROJECT_NAME $dockerComposeProxyCLIOptions up -d --build"
echo "$INFO Running Nginx proxy service (\$TRAEFIK!=true)..."
echo ""
echo "$dockerComposeProxyCommand"
echo ""
($dockerComposeProxyCommand)
else
echo "$INFO Skipping running Nginx proxy... (\$TRAEFIK=true)"
fi
# Run the Demo service
if [ "$DEMO" == "true" ]; then
dockerComposeDemoCommand="docker compose -p $PROJECT_NAME $dockerComposeDemoCLIOptions up -d"
echo "$INFO Running demo service..."
echo ""
echo "$dockerComposeDemoCommand"
echo ""
($dockerComposeDemoCommand)
fi
else
echo "$ERROR Docker compose versions < 2.x are not supported"
echo "$ERROR Docker versions < 20.10.13 are not supported"
fi
extractServicesFromComposeFiles
displayAccessURLsWithCredentials