-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_control.sh
More file actions
executable file
·56 lines (50 loc) · 1.96 KB
/
start_control.sh
File metadata and controls
executable file
·56 lines (50 loc) · 1.96 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
echo "This script must be run from the base project directory"
echo "i.e. the directory containing the start_control.sh file itself"
# Prompt the user for webserver option
echo "Do you want to start the webserver component? (y/n) [default: y]:"
read start_webserver
start_webserver=${start_webserver:-y}
# Prompt the user for the data directory path
echo "Please enter the raw data path:"
read data_directory_path
# Determine the script's directory
script_directory=$(dirname "$(readlink -f "$0")")
project_directory_path=$(realpath "$script_directory/")
echo "Project directory path: ${project_directory_path}"
# Exporting environmental variables to allow the container the knowledge of its location and the data location on the base machine
# Project Path
export PROJECT_DIRECTORY_PATH="${project_directory_path}"
# Raw Data Path
export DATA_DIRECTORY_PATH="${data_directory_path}"
# Check if running in WSL, WSL2, or Linux
if grep -qi Microsoft /proc/version; then
echo "Running on WSL"
WSL=true
elif grep -qi WSL /proc/version; then
echo "Running on WSL 2"
WSL=true
else
echo "Running on pure Linux"
WSL=false
fi
# Use the provided path as a volume in Docker Compose
# Previously exported paths are used as environment variables in the docker-compose.yml files
if [ "$start_webserver" = "y" ] || [ "$start_webserver" = "Y" ]; then
echo "Starting with webserver component..."
if [ "$WSL" = true ]; then
echo "Using docker-compose-wsl.yml"
docker compose -f ./control_system/docker-compose-wsl.yml up --build
else
echo "Using docker-compose.yml"
docker compose -f ./control_system/docker-compose.yml up --build
fi
else
echo "Starting without webserver component..."
if [ "$WSL" = true ]; then
echo "Using docker-compose-wsl-no-web.yml"
docker compose -f ./control_system/docker-compose-wsl-no-web.yml up --build
else
echo "Using docker-compose-no-web.yml"
docker compose -f ./control_system/docker-compose-no-web.yml up --build
fi
fi