Skip to content

Commit

Permalink
Registrar upgrade to MySQL 5.7 (openedx-unsupported#619)
Browse files Browse the repository at this point in the history
* Connect registrar to mysql5.7 database

* Add scripts to allow provisioning with mysql5.7
  • Loading branch information
bseverino authored Sep 24, 2020
1 parent 89d35b3 commit daf9b11
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,15 @@ services:
depends_on:
- discovery
- lms
- mysql
- mysql57
- memcached
- redis
- registrar-worker
# Allows attachment to the registrar service using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
DB_HOST: edx.devstack.mysql
DB_HOST: edx.devstack.mysql57
DB_NAME: registrar
DB_PORT: 3306
DB_USER: registrar001
Expand Down Expand Up @@ -358,12 +358,12 @@ services:
hostname: registrar-worker.devstack.edx
depends_on:
- lms
- mysql
- mysql57
- redis
stdin_open: true
tty: true
environment:
DB_HOST: edx.devstack.mysql
DB_HOST: edx.devstack.mysql57
DB_NAME: registrar
DB_PORT: 3306
DB_USER: registrar001
Expand Down
13 changes: 13 additions & 0 deletions provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ do
sleep 1
done

# Ensure the MySQL 5.7 server is online and usable
echo "${GREEN}Waiting for MySQL 5.7.${NC}"
until docker-compose exec -T mysql57 bash -c "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
# See https://github.com/docker-library/mysql/issues/245 for why this is necessary.
sleep 20
Expand All @@ -150,6 +158,11 @@ echo -e "${GREEN}MySQL ready.${NC}"
echo -e "${GREEN}Ensuring MySQL databases and users exist...${NC}"
docker-compose exec -T mysql bash -c "mysql -uroot mysql" < provision.sql

# Ensure that the MySQL 5.7 databases and users are created for all IDAs.
# (A no-op for databases and users that already exist).
echo -e "${GREEN}Ensuring MySQL 5.7 databases and users exist...${NC}"
docker-compose exec -T mysql57 bash -c "mysql -uroot mysql" < provision.sql

# If necessary, ensure the MongoDB server is online and usable
# and create its users.
if needs_mongo "$to_provision_ordered"; then
Expand Down

0 comments on commit daf9b11

Please sign in to comment.