Set up databases for different services when using persistent databases
Created by: itsjeyd
cf. OC-1610
Dependencies
-
https://github.com/edx/configuration/pull/3052 (fixes issue where
edxlocal
role would fail due to missing dependencies when using non-local databases) - https://github.com/open-craft/configuration/pull/5 (fixes issue affecting creation of user for ecommerce database in integration tests; should merge before this PR so we can go back to using open-craft:integration branch for integration tests)
Test instructions
-
Prepare your
.env
by settingINSTANCE_MYSQL_URL
andINSTANCE_MONGO_URL
to values from corresponding settings from stage.console.opencraft.com.env
file. Make sure your.env
setsSWIFT_ENABLE=true
(if it doesn't contain theSWIFT_ENABLE
setting, that's fine too since it defaults totrue
). -
Log in to https://horizon.cloud.ovh.net using credentials for "OVH - OpenStack - Horizon - Databases" (stored in KeePassX database). Go to "Access & Security" and add a rule to the
databases-mysql-im-stage
anddatabases-mongodb-stage
security groups that grants your IP access to the corresponding databases. -
Create a new instance from the shell using the following settings:
from instance.factories import production_instance_factory instance = production_instance_factory( sub_domain="databases-test.sandbox", name='Databases Test', edx_platform_repository_url="https://github.com/edx/edx-platform.git", configuration_source_repo_url="https://github.com/open-craft/configuration.git", configuration_version="jill/edx-sandbox-remote", # branch from related PR edx_platform_commit="master", openedx_release="master", )
-
Run the development server, go to http://localhost:5000/instance, find the instance created in the previous step and click "Launch new AppServer".
-
Once the status of the app server switches to "Configuring VM", copy its "VM IP Address" from the "Status" section. Using this IP address, repeat step 2 to grant the VM access to the external MySQL and MongoDB databases.
-
Wait for the provisioning process to finish.