-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
100 lines (67 loc) · 2.5 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
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
#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y wget docker-compose git
root_folder=$(pwd)
harena_module_link()
{
echo "------------------------------------Link $1-----------------------------------"
echo "Creating module folder"
mkdir $root_folder/modules/$1 -p
echo "Retrieving docker-compose file"
wget -P $root_folder/modules/$1 https://raw.githubusercontent.com/harena-lab/$1/$2/docker-compose.yml --quiet --no-cache
}
harena_module_unlink()
{
echo "------------------------------------Unlink $1-----------------------------------"
echo "Removing module folder"
rm $root_folder/modules/$1 -r -f
}
harena_module_up()
{
echo "------------------------------------Up $1-------------------------------------"
echo "Starting docker-compose"
sudo docker-compose pull
sudo docker-compose --file $root_folder/modules/$1/docker-compose.yml --project-name "harena" up -d
}
harena_module_down()
{
echo "------------------------------------Down $1-----------------------------------"
echo "Trying to stop docker-compose"
sudo docker-compose --file $root_folder/modules/$1/docker-compose.yml --project-name "harena" down
}
harena_module_exec()
{
echo "------------------------------------Exec $1-----------------------------------"
echo "Executing command"
sudo docker-compose --file $root_folder/modules/$1/docker-compose.yml --project-name "harena" exec $2 $3
}
harena_module_run()
{
echo "------------------------------------Run $1------------------------------------"
echo "Executing command"
sudo docker-compose --file $root_folder/modules/$1/docker-compose.yml --project-name "harena" run $2 $3
}
harena_module_ps()
{
sudo docker-compose --file $root_folder/modules/$1/docker-compose.yml --project-name "harena" ps
echo
}
harena_module_start()
{
harena_module_unlink $1 $2
harena_module_link $1 $2
harena_module_down $1 $2
harena_module_up $1 $2
}
# module branch/tag
harena_module_start "harena-space" "master"
harena_module_start "harena-manager" "master"
harena_module_start "harena-logger" "master"
echo "Waiting before running initialization commands via docker exec ..."
sleep 10
# module service command
harena_module_exec "harena-manager" "harena-manager" "adonis migration:run --force"
harena_module_exec "harena-manager" "harena-manager" "adonis seed --files InitialSeeder.js --force"
echo "Done. Listing all containers:"
sudo docker ps -a