forked from qeeqbox/url-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·61 lines (51 loc) · 1.39 KB
/
run.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
echo -e "\nQeeqBox URL-Sandbox v$(jq -r '.version' info) starter script -> https://github.com/qeeqbox/url-sandbox"
echo -e "Free URL Sandbox \n"\
setup_requirements () {
sudo apt update -y
sudo apt install -y linux-headers-$(uname -r) docker.io jq xdg-utils curl
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
which docker-compose && echo "Good"
which docker && echo "Good"
}
wait_on_web_interface () {
echo ''
until $(curl --silent --head --fail http://127.0.0.1:8000 --output /dev/null); do
echo -ne "\n\n[\033[47m\033[0;31mInitializing project in progress..\033[0m]\n\n"
sleep 5
done
echo ''
xdg-open http://127.0.0.1:8000/url/
}
test_project () {
sudo docker-compose -f docker-compose-test.yml up --build
}
dev_project () {
sudo docker-compose -f docker-compose-dev.yml up --build
}
stop_containers () {
sudo docker stop $(sudo docker ps -aq)
}
deploy_aws_project () {
echo "Will be added later on"
}
auto_configure_test () {
setup_requirements
test_project
}
auto_configure () {
setup_requirements
dev_project
}
if [[ "$1" == "auto_test" ]]; then
stop_containers
wait_on_web_interface &
auto_configure_test
stop_containers
fi
if [[ "$1" == "auto_configure" ]]; then
stop_containers
wait_on_web_interface &
auto_configure
stop_containers
fi