forked from openedx-unsupported/devstack
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprovision.sh
executable file
·74 lines (59 loc) · 1.97 KB
/
provision.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
#!/usr/bin/env bash
# This script will provision all of the services. Each service will be setup in the following manner:
#
# 1. Migrations run,
# 2. Tenants—as in multi-tenancy—setup,
# 3. Service users and OAuth clients setup in LMS,
# 4. Static assets compiled/collected.
set -e
set -o pipefail
set -x
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
DEVSTACK_DIR=`dirname $0`
for conf in ${DEVSTACK_DIR}/local*.sh ; do
source ${conf}
done
if [ -z "$DEVSTACK_WORKSPACE" ]; then
echo "need to set workspace dir"
exit 1
elif [ ! -d "$DEVSTACK_WORKSPACE" ]; then
echo "Workspace directory $DEVSTACK_WORKSPACE doesn't exist"
exit 1
fi
# Create default configuration files to mount them as volumes
for conf in lms.env.json.gz cms.env.json.gz ; do
mkdir -p ${DEVSTACK_WORKSPACE}/src
test -f ${DEVSTACK_WORKSPACE}/src/${conf} || \
cp scripts/defaults/${conf} ${DEVSTACK_WORKSPACE}/src/ && \
gzip -f -d ${DEVSTACK_WORKSPACE}/src/${conf}
done
# Bring the databases online.
docker-compose up -d mysql mongo
# Ensure the MySQL server is online and usable
echo "Waiting for MySQL"
until docker exec -i edx.devstack.mysql mysql -uroot -se "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = 'root')" &> /dev/null
do
printf "."
sleep 1
done
# In the event of a fresh MySQL container, wait a few seconds for the server to restart
# This can be removed once https://github.com/docker-library/mysql/issues/245 is resolved.
sleep 20
echo -e "MySQL ready"
echo -e "${GREEN}Creating databases and users...${NC}"
docker exec -i edx.devstack.mysql mysql -uroot mysql < provision.sql
docker exec -i edx.devstack.mongo mongo < mongo-provision.js
./provision-lms.sh
# Nothing special needed for studio
docker-compose $DOCKER_COMPOSE_FILES up -d studio
./provision-ecommerce.sh
./provision-discovery.sh
./provision-credentials.sh
./provision-e2e.sh
./provision-forum.sh
./provision-notes.sh
docker image prune -f
echo -e "${GREEN}Provisioning complete!${NC}"