-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·143 lines (114 loc) · 6.27 KB
/
setup.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
# Ask the user which version of DE-STRESS they want to install
echo "Which version of DE-STRESS do you want to install? Submit 1 for the webserver and 2 for the headless version of DE-STRESS."
read option1
# Installing the webserver version of DE-STRESS
if [ "$option1" == "1" ]; then
# Asking the user if they want to install Rosetta and checking if they have a licence.
echo "Do you want to install Rosetta? A licence is required to use Rosetta which is free for academics but not for commercial users. Submit 1 if you still want to install Rosetta and 2 if you want to install a version without Rosetta."
read option2
# Installing Rosetta
if [ "$option2" == "1" ]; then
rosetta_install_command1="cd dependencies_for_de-stress/"
$rosetta_install_command1
rosetta_install_command2="git clone --branch v2024.18-dev62107 https://github.com/RosettaCommons/rosetta.git"
$rosetta_install_command2
echo "Rosetta has been successfully downloaded."
# Installing a version of DE-STRESS without Rosetta
elif [ "$option2" == "2" ]; then
echo "A version without Rosetta is not available yet."
exit 1
else
echo "Invalid option. Please choose either 1 or 2."
exit 1
fi
# Changing directory
change_dir_command="cd ../"
$change_dir_command
# Ask the user which version of DE-STRESS they want to install
echo "Are you installing the websever in a development or production environment. Submit 1 for development or 2 for production."
read option3
if [ "$option3" == "1" ]; then
# Building the docker image for development webserver version of DE-STRESS
echo "Building docker image for the development version of the DE-STRESS webserver."
docker_command1a="docker compose -f development-compose.yml build"
docker_command1b="docker-compose -f development-compose.yml build"
$docker_command1a || $docker_command1b
elif [ "$option3" == "2" ]; then
# Building the docker image for production webserver version of DE-STRESS
echo "Building docker image for the production version of the DE-STRESS webserver."
docker_command1a="docker compose -f production-compose.yml build"
docker_command1b="docker-compose -f production-compose.yml build"
$docker_command1a || $docker_command1b
exit 1
else
echo "Invalid option. Please choose either 1 or 2."
exit 1
fi
# Get the current working directory
current_dir=$(pwd)
echo "Current dir: $current_dir"
# Building the dependencies for DE-STRESS
echo "Building DE-STRESS dependencies. Rosetta will take a few hours to compile. "
docker_command2a="docker run -it --rm -v $current_dir/dependencies_for_de-stress/:/dependencies_for_de-stress de-stress-big-structure:latest sh build_dependencies.sh"
docker_command2b="docker run -it --rm -v $current_dir/dependencies_for_de-stress/:/dependencies_for_de-stress de-stress_big-structure:latest sh build_dependencies.sh"
$docker_command2a || $docker_command2b
# Asking the user how many cpus they want to use for the webserver
echo "How many CPUs do you want to use for the DE-STRESS webserver?"
read webserver_num_cpus
echo "Launching DE-STRESS webserver"
if [ "$option3" == "1" ]; then
# Launching the development version of DE-STRESS web server
docker_command3a="docker compose -f development-compose.yml --env-file .env up -d --scale rq-worker=$webserver_num_cpus"
docker_command3b="docker-compose -f development-compose.yml --env-file .env up -d --scale rq-worker=$webserver_num_cpus"
$docker_command3a || $docker_command3b
elif [ "$option3" == "2" ]; then
# Launching the production version of DE-STRESS web server
docker_command3a="docker compose -f production-compose.yml --env-file .env up -d --scale rq-worker=$webserver_num_cpus"
docker_command3b="docker-compose -f production-compose.yml --env-file .env up -d --scale rq-worker=$webserver_num_cpus"
$docker_command3a || $docker_command3b
exit 1
else
echo "Invalid option. Please choose either 1 or 2."
exit 1
fi
# Installing the headless version of DE-STRESS
elif [ "$option1" == "2" ]; then
# Asking the user if they want to install Rosetta and checking if they have a licence.
echo "Do you want to install Rosetta? A licence is required to use Rosetta which is free for academics but not for commercial users. Submit 1 if you still want to install Rosetta and 2 if you want to install a version without Rosetta."
read option2
# Installing Rosetta
if [ "$option2" == "1" ]; then
rosetta_install_command1="cd dependencies_for_de-stress/"
$rosetta_install_command1
rosetta_install_command2="git clone --branch v2024.18-dev62107 https://github.com/RosettaCommons/rosetta.git"
$rosetta_install_command2
echo "Rosetta has been successfully downloaded."
# Installing a version of DE-STRESS without Rosetta
elif [ "$option2" == "2" ]; then
echo "A version without Rosetta is not available yet."
exit 1
else
echo "Invalid option. Please choose either 1 or 2."
exit 1
fi
# Changing directory
change_dir_command="cd ../"
$change_dir_command
# Building the docker image for headless version of DE-STRESS
echo "Building docker image for headless DE-STRESS."
docker_command1a="docker compose -f headless-compose.yml build"
docker_command1b="docker-compose -f headless-compose.yml build"
$docker_command1a || $docker_command1b
# Get the current working directory
current_dir=$(pwd)
echo "Current dir: $current_dir"
# Building the dependencies for DE-STRESS
echo "Building DE-STRESS dependencies. Rosetta will take a few hours to compile. "
docker_command2a="docker run -it --rm -v $current_dir/dependencies_for_de-stress/:/dependencies_for_de-stress de-stress-big-structure:latest sh build_dependencies.sh"
docker_command2b="docker run -it --rm -v $current_dir/dependencies_for_de-stress/:/dependencies_for_de-stress de-stress_big-structure:latest sh build_dependencies.sh"
$docker_command2a || $docker_command2b
else
echo "Invalid option. Please choose either 1 or 2."
exit 1
fi