Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit 6b982d9

Browse files
authored
fix: Only create users in mysql 8.0 if they don't already exist (#1112)
This issue was breaking provisioning early in the process. The volumes for mysql57 and mysql80 may still contain users from previous provisioning runs. The old provisioning script for mysql 5.7 (provision.sql) uses implicit user creation via the `GRANT` statement, which is no longer supported in mysql 8.0. Therefore, the `CREATE USER` statements in provision-mysql80.sql fail. The fix here is to change to `CREATE USER IF NOT EXISTS`. I've also deleted `drop-mysql-user.sql`. I suspect it was only used during testing to enable repeated tests of provisioning, but it's not referenced anywhere in the PR that adds it (#1097).
1 parent 6c930bc commit 6b982d9

3 files changed

Lines changed: 14 additions & 20 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ dev.reset: dev.remove-containers dev.reset-repos dev.prune dev.pull.large-and-sl
496496
dev.destroy.coursegraph: dev.remove-containers.coursegraph ## Remove all coursegraph data.
497497
docker volume rm ${COMPOSE_PROJECT_NAME}_coursegraph_data
498498

499-
dev.destroy: ## Irreversibly remove all devstack-related containers, networks, and volumes.
499+
# See https://github.com/openedx/devstack/issues/1113 for lack of ability to destroy data volumes
500+
dev.destroy: ## Irreversibly remove all devstack-related containers and networks (though not data volumes)
500501
$(WINPTY) bash ./destroy.sh
501502

502503
########################################################################################

drop-mysql-user.sql

Lines changed: 0 additions & 11 deletions
This file was deleted.

provision-mysql80.sql

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
1+
-- The use of `CREATE USER IF NOT EXISTS` is necessary since the
2+
-- mysql80_data volume may already contain these users due to previous
3+
-- provisioning https://github.com/openedx/devstack/issues/1113
4+
15
CREATE DATABASE IF NOT EXISTS credentials;
2-
CREATE USER 'credentials001'@'%' IDENTIFIED BY 'password';
6+
CREATE USER IF NOT EXISTS 'credentials001'@'%' IDENTIFIED BY 'password';
37
GRANT ALL ON credentials.* TO 'credentials001'@'%';
48

59
CREATE DATABASE IF NOT EXISTS discovery;
6-
CREATE USER 'discov001'@'%' IDENTIFIED BY 'password';
10+
CREATE USER IF NOT EXISTS 'discov001'@'%' IDENTIFIED BY 'password';
711
GRANT ALL ON discovery.* TO 'discov001'@'%';
812

913
CREATE DATABASE IF NOT EXISTS ecommerce;
10-
CREATE USER 'ecomm001'@'%' IDENTIFIED BY 'password';
14+
CREATE USER IF NOT EXISTS 'ecomm001'@'%' IDENTIFIED BY 'password';
1115
GRANT ALL ON ecommerce.* TO 'ecomm001'@'%';
1216

1317
CREATE DATABASE IF NOT EXISTS notes;
14-
CREATE USER 'notes001'@'%' IDENTIFIED BY 'password';
18+
CREATE USER IF NOT EXISTS 'notes001'@'%' IDENTIFIED BY 'password';
1519
GRANT ALL ON notes.* TO 'notes001'@'%';
1620

1721
CREATE DATABASE IF NOT EXISTS registrar;
18-
CREATE USER 'registrar001'@'%' IDENTIFIED BY 'password';
22+
CREATE USER IF NOT EXISTS 'registrar001'@'%' IDENTIFIED BY 'password';
1923
GRANT ALL ON registrar.* TO 'registrar001'@'%';
2024

2125
CREATE DATABASE IF NOT EXISTS xqueue;
22-
CREATE USER 'xqueue001'@'%' IDENTIFIED BY 'password';
26+
CREATE USER IF NOT EXISTS 'xqueue001'@'%' IDENTIFIED BY 'password';
2327
GRANT ALL ON xqueue.* TO 'xqueue001'@'%';
2428

2529
CREATE DATABASE IF NOT EXISTS `dashboard`;
26-
CREATE USER 'analytics001'@'%' IDENTIFIED BY 'password';
30+
CREATE USER IF NOT EXISTS 'analytics001'@'%' IDENTIFIED BY 'password';
2731
GRANT ALL ON `dashboard`.* TO 'analytics001'@'%';
2832

2933
CREATE DATABASE IF NOT EXISTS `analytics-api`;
@@ -37,7 +41,7 @@ GRANT ALL ON `reports_v1`.* TO 'analytics001'@'%';
3741

3842
CREATE DATABASE IF NOT EXISTS edxapp;
3943
CREATE DATABASE IF NOT EXISTS edxapp_csmh;
40-
CREATE USER 'edxapp001'@'%' IDENTIFIED BY 'password';
44+
CREATE USER IF NOT EXISTS 'edxapp001'@'%' IDENTIFIED BY 'password';
4145
GRANT ALL ON edxapp.* TO 'edxapp001'@'%';
4246
GRANT ALL ON edxapp_csmh.* TO 'edxapp001'@'%';
4347

0 commit comments

Comments
 (0)