FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cloudstack/setup/db/deploy-db-dev.sh at main · apache/cloudstack · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
apache
/
cloudstack
Public
Notifications
You must be signed in to change notification settings
Fork
1.4k
Star
3k
Code
Issues
608
Pull requests
389
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cloudstack
/
setup
/
db
/
deploy-db-dev.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
144 lines (115 loc) · 3.51 KB
Breadcrumbs
cloudstack
/
setup
/
db
/
deploy-db-dev.sh
Copy path
File metadata and controls
executable file
·
144 lines (115 loc) · 3.51 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!
/usr/bin/env bash
#
Licensed to the Apache Software Foundation (ASF) under one
#
or more contributor license agreements. See the NOTICE file
#
distributed with this work for additional information
#
regarding copyright ownership. The ASF licenses this file
#
to you under the Apache License, Version 2.0 (the
#
"License"); you may not use this file except in compliance
#
with the License. You may obtain a copy of the License at
#
#
http://www.apache.org/licenses/LICENSE-2.0
#
#
Unless required by applicable law or agreed to in writing,
#
software distributed under the License is distributed on an
#
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#
KIND, either express or implied. See the License for the
#
specific language governing permissions and limitations
#
under the License.
#
deploy-db.sh -- deploys the database configuration.
#
set -x
if
[
"
$1
"
==
"
"
]
;
then
printf
"
Usage: %s [path to server-setup.xml] [path to additional sql] [root password]\n
"
$(
basename
$0
)
>&2
exit
1
;
fi
if
[
!
-f
$1
]
;
then
echo
"
Error: Unable to find
$1
"
exit
2
fi
if
[
"
$2
"
!=
"
"
]
;
then
if
[
!
-f
$2
]
;
then
echo
"
Error: Unable to find
$2
"
exit
3
fi
fi
if
[
!
-f
create-database.sql ]
;
then
printf
"
Error: Unable to find create-database.sql\n
"
exit
4
fi
if
[
!
-f
create-schema.sql ]
;
then
printf
"
Error: Unable to find create-schema.sql\n
"
exit
5
fi
if
[
!
-f
create-index-fk.sql ]
;
then
printf
"
Error: Unable to find create-index-fk.sql\n
"
exit
6
;
fi
PATHSEP=
'
:
'
if
[[
$OSTYPE
==
"
cygwin
"
]]
;
then
export
CATALINA_HOME=
`
cygpath -m
$CATALINA_HOME
`
PATHSEP=
'
;
'
fi
handle_error
() {
mysqlout=
$?
if
[
$mysqlout
-eq
1 ]
;
then
printf
"
Please enter root password for MySQL.\n
"
mysql --user=root --password
<
$1
if
[
$?
-ne
0 ]
;
then
printf
"
Error: Cannot execute
$1
\n
"
exit
10
fi
elif
[
$mysqlout
-eq
127 ]
;
then
printf
"
Error: Cannot execute
$1
- mysql command not found.\n
"
exit
11
elif
[
$mysqlout
-ne
0 ]
;
then
printf
"
Error: Cannot execute
$1
\n
"
exit
11
fi
}
echo
"
Recreating Database cloud.
"
mysql --user=root --password=
$3
<
create-database.sql
>
/dev/null
2>
/dev/null
handle_error create-database.sql
echo
"
Recreating Database cloud_usage
"
mysql --user=root --password=
$3
<
create-database-premium.sql
>
/dev/null
2>
/dev/null
handle_error create-database-premium.sql
mysql --user=cloud --password=cloud cloud
<
create-schema.sql
if
[
$?
-ne
0 ]
;
then
printf
"
Error: Cannot execute create-schema.sql\n
"
exit
11
fi
mysql --user=cloud --password=cloud
<
create-schema-premium.sql
if
[
$?
-ne
0 ]
;
then
printf
"
Error: Cannot execute create-schema-premium.sql\n
"
exit
11
fi
CP=./
CP=
${CP}
$PATHSEP$CATALINA_HOME
/conf
#
Add mysql jar from mysql-connector-j package to CP
#
for Jenkins
MYSQL_CONNECTOR_VERSION =
'
8.4.0
'
CP=
${CP}${PATHSEP}
/usr/share/java/mysql-connector-j-
${MYSQL_CONNECTOR_VERSION}
.jar
for
file
in
$CATALINA_HOME
/webapps/client/WEB-INF/lib/
*
.jar
do
CP=
${CP}
$PATHSEP$file
done
for
file
in
$CATALINA_HOME
/lib/
*
.jar
;
do
CP=
${CP}
$PATHSEP$file
done
echo
CP is
$CP
java -cp
$CP
com.cloud.test.DatabaseConfig
$*
if
[
$?
-ne
0 ]
then
exit
1
fi
if
[
"
$2
"
!=
"
"
]
;
then
mysql --user=cloud --password=cloud cloud
<
$2
if
[
$?
-ne
0 ]
;
then
printf
"
Error: Cannot execute
$2
\n
"
exit
12
fi
fi
echo
"
Creating Indice and Foreign Keys
"
mysql --user=cloud --password=cloud cloud
<
create-index-fk.sql
if
[
$?
-ne
0 ]
;
then
printf
"
Error: Cannot execute create-index-fk.sql\n
"
exit
13
fi
Back
|
FazBrowse Home
|
New Git URL