-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlpa-cli.sh
executable file
·147 lines (114 loc) · 5.07 KB
/
lpa-cli.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
144
145
146
147
#!/bin/bash
startDevelopment() {
cd docker
echo 'Attempting to stop current running configuration'
docker-compose -f docker-compose.yml down
echo 'Starting new compose configuration'
docker-compose -f docker-compose.yml up --force-recreate
cd ..
}
startDevelopmentPersistent() {
cd docker
echo 'Attempting to stop current compose configuration'
docker-compose -f docker-compose-persistent.yml down
echo 'Starting new compose configuration'
docker-compose -f docker-compose-persistent.yml up --force-recreate
cd ..
}
startProductionNoCloning() {
mkdir -p lpa_temp/docker
if [ -e "lpa_temp/docker/docker-compose.yml" ]; then
echo 'docker-compose.yml already exists' >&2
else
curl https://raw.githubusercontent.com/linkedpipes/applications/master/docker/docker-compose-master.yml -o lpa_temp/docker/docker-compose.yml
fi
if [ -e "lpa_temp/docker/nginx-prod.conf" ]; then
echo 'nginx-prod.conf already exists' >&2
else
curl https://raw.githubusercontent.com/linkedpipes/applications/master/docker/nginx-prod.conf -o lpa_temp/docker/nginx-prod.conf
fi
if [ -e "lpa_temp/src/backend/src/main/resources/db/migration" ]; then
echo 'migrations already exist' >&2
else
mkdir -p lpa_temp/src/backend/src/main/resources/db/migration
curl https://raw.githubusercontent.com/linkedpipes/applications/master/src/backend/src/main/resources/db/migration/R__Vacuum.sql -o lpa_temp/src/backend/src/main/resources/db/migration/R__Vacuum.sql
curl https://raw.githubusercontent.com/linkedpipes/applications/master/src/backend/src/main/resources/db/migration/V1.0__Create_schema.sql -o lpa_temp/src/backend/src/main/resources/db/migration/V1.0__Create_schema.sql
curl https://raw.githubusercontent.com/linkedpipes/applications/master/src/backend/src/main/resources/db/migration/V1.1__Extended_user_profile_and_storing_discovery_and_ETL_parameters.sql -o lpa_temp/src/backend/src/main/resources/db/migration/V1.1__Extended_user_profile_and_storing_discovery_and_ETL_parameters.sql
curl https://raw.githubusercontent.com/linkedpipes/applications/master/src/backend/src/main/resources/db/migration/V1.2__Multiple_named_graphs.sql -o lpa_temp/src/backend/src/main/resources/db/migration/V1.2__Multiple_named_graphs.sql
curl https://raw.githubusercontent.com/linkedpipes/applications/master/src/backend/src/main/resources/db/migration/V1.3__Color_schemes_on_user%2C_drop_applications%2C_named_graphs_on_delete_cascade.sql -o lpa_temp/src/backend/src/main/resources/db/migration/V1.3__Color_schemes_on_user%2C_drop_applications%2C_named_graphs_on_delete_cascade.sql
curl https://raw.githubusercontent.com/linkedpipes/applications/master/src/backend/src/main/resources/db/migration/V1.4__Applications.sql -o lpa_temp/src/backend/src/main/resources/db/migration/V1.4__Applications.sql
curl https://raw.githubusercontent.com/linkedpipes/applications/master/src/backend/src/main/resources/db/migration/V1.5__Repeated_executions.sql -o lpa_temp/src/backend/src/main/resources/db/migration/V1.5__Repeated_executions.sql
fi
cd lpa_temp/docker
echo 'Attempting to stop current compose configuration'
docker-compose -f docker-compose.yml down
echo 'Starting new compose configuration'
docker-compose -f docker-compose.yml up
}
startProduction() {
cd docker
echo 'Attempting to stop current running configuration'
docker-compose -f docker-compose-master.yml down
echo 'Starting current running configuration'
docker-compose -f docker-compose-master.yml up
cd ..
}
cleanStorage() {
cd docker
rm -rf appData
rm -rf data
cd ..
rm -rf appData
rm -rf data
}
stopCompose() {
docker-compose down
cd docker
docker-compose down
cd ..
}
function usage {
echo "usage: ./lpa-cli.sh [-dc]|[--detailed-command]"
echo "-d | --development Start non persistent development setup (assumes repository is already cloned)"
echo "-dp | --development-persistent Start non persistend development setup (assumes repository is already cloned)"
echo "-p | --production Start persistend production setup (assumes repository is already cloned)"
echo "-pnc | --production-no-cloning Start persistend production setup (only use it if you don't want to clone the whole repository, don't execute this from within an already cloned repository)"
echo "-cs | --clean-storage Remove 'appdata' and 'data' folders with database data and etc"
echo "-sc | --stop-compose Setup whatever configuration setup is currently running"
echo "-h | --help Print help documentation"
exit 1
}
while [ ! $# -eq 0 ]
do
case "$1" in
--development | -d)
startDevelopment
exit
;;
--development-persistent | -dp)
startDevelopmentPersistent
exit
;;
--production-no-cloning | -pnc)
startProductionNoCloning
exit
;;
--production | -p)
startProduction
exit
;;
--clean-storage | -cs)
cleanStorage
exit
;;
--stop-compose | -sc)
stopCompose
exit
;;
--help | -h)
usage
exit
;;
esac
shift
done