forked from openedx-unsupported/devstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-lms.sh
executable file
·49 lines (35 loc) · 2.37 KB
/
provision-lms.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
set -e
set -o pipefail
set -x
apps=( lms studio )
# Load database dumps for the largest databases to save time
./load-db.sh edxapp
./load-db.sh edxapp_csmh
# Bring edxapp containers online
for app in "${apps[@]}"; do
docker-compose up -d $app
done
docker-compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && NO_PYTHON_UNINSTALL=1 paver install_prereqs'
#Installing prereqs crashes the process
docker-compose restart lms
# Run edxapp migrations first since they are needed for the service users and OAuth clients
docker-compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && paver update_db --settings devstack_docker'
# Create a superuser for edxapp
docker-compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && python /edx/app/edxapp/edx-platform/manage.py lms --settings=devstack_docker manage_user edx edx@example.com --superuser --staff'
docker-compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && echo "from django.contrib.auth import get_user_model; User = get_user_model(); user = User.objects.get(username=\"edx\"); user.set_password(\"edx\"); user.save()" | python /edx/app/edxapp/edx-platform/manage.py lms shell --settings=devstack_docker'
# Create an enterprise service user for edxapp and give them appropriate permissions
./enterprise/provision.sh
# Enable the LMS-E-Commerce integration
docker-compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && python /edx/app/edxapp/edx-platform/manage.py lms --settings=devstack_docker configure_commerce'
# Create demo course and users
docker-compose exec -T lms bash -c '/edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook /edx/app/edx_ansible/edx_ansible/playbooks/demo.yml -v -c local -i "127.0.0.1," --extra-vars="COMMON_EDXAPP_SETTINGS=devstack_docker"'
# Fix missing vendor file by clearing the cache
docker-compose exec -T lms bash -c 'rm /edx/app/edxapp/edx-platform/.prereqs_cache/Node_prereqs.sha1'
# Create static assets for both LMS and Studio
for app in "${apps[@]}"; do
docker-compose exec -T $app bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && paver update_assets --settings devstack_docker'
done
# Provision a retirement service account user
./provision-retirement-user.sh retirement retirement_service_worker
# Add demo program
./programs/provision.sh lms