A sandbox will be automatically created when you open a pull request on edx/edx-platform, if you belong to the Owners team on github. You can monitor the progress of the sandbox creation on the OpenCraft instance manager.
SSH to the instance, using your github username and the public SSH key from your github account. The keys are automatically refreshed from GitHub on every provisioning run - so if you need to use a different SSH key, update it on your GitHub account and restart the provisioning of your sandbox.
Sandboxes now use individual user sessions, all of them with full sudo access.
You can see the ansible configuration for a given sandbox by clicking on its "Configuration" tab in the OpenCraft instance manager.
If you want to change the default configuration, you can add or override any of its variables by adding a "Settings" section to your PR. This ensures the information is available in a central place, for both the reviewers and the OpenCraft Instance manager. The section should use the following format:
- - -
**Settings**
```yaml
[YAML: VARIABLES]
```
For example:
- - -
**Settings**
```yaml
EDXAPP_FEATURES:
ALLOW_HIDING_DISCUSSION_TAB: true
```
Note: You need to match the above format exactly.
Login on the OpenCraft instance manager, select your sandbox, and click "Reprovisioning". This will automatically recreate the sandbox, using the latest code on your branch.
Warning: Changes you make on a sandbox VM are lost on each reprovisioning, as the VM is recreated from scratch every time, to ensure a clean slate and mirror the production environment as closely as possible. Which means you should for example edit the sandbox configuration via ansible variables (see below), rather than going on the sandbox to edit it manually.
However, if for some reason you still need to make changes on an instance that can't yet be made via ansible (make sure to complain about it to Xavier!), you can simply avoid reprovisioning the sandbox to preserve your changes. In which case, you could find the instructions below helpful.
Do:
antoviaque@edx-sandbox-contentlib:~$ sudo -u edxapp bash
edxapp@edx-sandbox-contentlib:~$ export HOME=~edxapp
edxapp@edx-sandbox-contentlib:/home/ubuntu$ cd
edxapp@edx-sandbox-contentlib:~$ . edxapp_env
edxapp@edx-sandbox-contentlib:~$ . ./venvs/edxapp/bin/activate
(edxapp)edxapp@edx-sandbox-contentlib:~$ cd edx-platform/
(edxapp)edxapp@edx-sandbox-contentlib:~/edx-platform$
You can also use the corresponding paver command, but the detection of updated dependencies can be unreliable - via pip directly:
(edxapp)edxapp@edx-sandbox-contentlib:~/edx-platform$ for i in pre base github local paver post ; do pip install -r requirements/edx/$i.txt ; done
You need to do it for both the LMS and the CMS:
(edxapp)edxapp@edx-sandbox-contentlib:~/edx-platform$ ./manage.py lms syncdb --migrate --settings aws && ./manage.py cms syncdb --migrate --settings aws
(edxapp)edxapp@edx-sandbox-contentlib:~/edx-platform$ paver update_assets lms --settings=aws && paver update_assets cms --settings=aws
for i in pre base github local paver post ; do pip install -r requirements/edx/$i.txt ; done
./manage.py lms syncdb --migrate --settings aws && ./manage.py cms syncdb --migrate --settings aws
paver update_assets lms --settings=aws && paver update_assets cms --settings=aws
Switch (Ctrl-A N) or create (Ctrl-A C) another screen terminal to preserve the edxapp session, and restart the LMS and CMS:
root@edx-sandbox-contentlib:~# sudo /edx/bin/supervisorctl restart edxapp:*
If your changes include something to deal with celery (e.g. adding new tasks or modifying existing ones), yuou might want to restart celery workers as well:
root@edx-sandbox-contentlib:~# sudo /edx/bin/supervisorctl restart edxapp_worker:*
Note that to avoid taking too much RAM, you should only keep the minimal set of services necessary to test your feature:
root@edx-sandbox-contentlib:~# sudo /edx/bin/supervisorctl status
certs STOPPED Jan 29 03:06 PM
edxapp:cms RUNNING pid 9138, uptime 0:00:13
edxapp:lms RUNNING pid 9137, uptime 0:00:13
edxapp_worker:cms_default_4 STOPPED Jan 29 03:06 PM
edxapp_worker:cms_high_1 STOPPED Jan 29 03:06 PM
edxapp_worker:cms_low_3 STOPPED Jan 29 03:06 PM
edxapp_worker:lms_default_3 STOPPED Jan 29 03:06 PM
edxapp_worker:lms_high_4 STOPPED Jan 29 03:06 PM
edxapp_worker:lms_high_mem_2 STOPPED Jan 29 03:06 PM
edxapp_worker:lms_low_1 STOPPED Jan 29 03:06 PM
forum RUNNING pid 2191, uptime 12 days, 5:28:35
xqueue STOPPED Jan 29 03:06 PM
xqueue_consumer STOPPED Jan 29 03:06 PM