FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
devstack/update-dbs-init-sql-scripts.sh at master · Pearson-Advance/devstack · GitHub
Pearson-Advance
/
devstack
Public
forked from
openedx-unsupported/devstack
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
devstack
/
update-dbs-init-sql-scripts.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
37 lines (30 loc) · 1.4 KB
Breadcrumbs
devstack
/
update-dbs-init-sql-scripts.sh
Copy path
File metadata and controls
executable file
·
37 lines (30 loc) · 1.4 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
#!
/usr/bin/env bash
#
Updates MySQL databases dumps with MySQL Docker container schema/data
#
Make sure you have added your user to the docker group before running this script
#
or use sudo to run it
set
-x
#
echo on
set
-e
#
exit when any command fails
set
-u
#
exit when undefined variables are found
set
-o pipefail
#
prevents errors in a pipeline from being masked
#
constants
readonly
EDXAPP_MYSQL_DB_USER=
"
edxapp001
"
readonly
ECOMMERCE_MYSQL_DB_USER=
"
ecomm001
"
readonly
MYSQL_DB_PASSWORD=
"
password
"
readonly
EDXAPP_DBS=(
"
edxapp
"
"
edxapp_csmh
"
)
DBS=(
"
ecommerce
"
"
${EDXAPP_DBS[@]}
"
)
#
create a docker devstack with LMS and ecommerce
make destroy
make dev.clone.ssh
make dev.provision.services.lms+ecommerce
#
dump schema and data from mysql databases in the mysql docker container and copy them to current directory in docker host
MYSQL_DOCKER_CONTAINER=
"
$(
make --silent dev.print-container.mysql
)
"
for
DB_NAME
in
"
${DBS[@]}
"
;
do
DB_CREATION_SQL_SCRIPT=
"
${DB_NAME}
.sql
"
if
[[
"
${EDXAPP_DBS[@]}
"
=~
"
${DB_NAME}
"
]]
;
then
MYSQL_DB_USER=
${EDXAPP_MYSQL_DB_USER}
else
MYSQL_DB_USER=
${ECOMMERCE_MYSQL_DB_USER}
fi
docker
exec
${MYSQL_DOCKER_CONTAINER}
/bin/bash -c
"
mysqldump -u
${MYSQL_DB_USER}
-p
${MYSQL_DB_PASSWORD}
--add-drop-database --skip-add-drop-table --databases
${DB_NAME}
>
${DB_CREATION_SQL_SCRIPT}
"
docker cp
${MYSQL_DOCKER_CONTAINER}
:/
${DB_CREATION_SQL_SCRIPT}
.
done
Back
|
FazBrowse Home
|
New Git URL