-
Notifications
You must be signed in to change notification settings - Fork 12
feat: add enterprise-access to devstack #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -386,6 +386,69 @@ services: | |
| ELASTICSEARCH_URL: "http://edx.devstack.elasticsearch710:9200" | ||
| ELASTICSEARCH_DSL: "http://edx.devstack.elasticsearch710:9200" | ||
|
|
||
| enterprise-access: | ||
| image: edxops/enterprise-access-dev | ||
| container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.enterprise-access" | ||
| hostname: enterprise-access.devstack.edx | ||
| command: bash -c 'while true; do python /edx/app/enterprise-access/manage.py runserver 0.0.0.0:18270; sleep 2; done' | ||
| ports: | ||
| - "18270:18270" | ||
| depends_on: | ||
| - mysql80 | ||
| - memcached | ||
| - enterprise-access-worker | ||
| networks: | ||
| default: | ||
| aliases: | ||
| - edx.devstack.enterprise-access | ||
| stdin_open: true | ||
| tty: true | ||
| environment: | ||
| CELERY_ALWAYS_EAGER: 'false' | ||
| CELERY_BROKER_TRANSPORT: redis | ||
| CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379 | ||
| CELERY_BROKER_VHOST: 0 | ||
| CELERY_BROKER_PASSWORD: password | ||
| DJANGO_SETTINGS_MODULE: enterprise_access.settings.devstack | ||
| DJANGO_WATCHMAN_TIMEOUT: 30 | ||
| ENABLE_DJANGO_TOOLBAR: 1 | ||
| DB_HOST: edx.devstack.mysql80 | ||
| DB_NAME: enterprise_access | ||
| DB_PORT: 3306 | ||
| DB_USER: enterprise_access001 | ||
| DB_PASSWORD: password | ||
|
|
||
| enterprise-access-worker: | ||
| image: edxops/enterprise-access-dev | ||
| command: bash -c 'cd /edx/app/enterprise-access/ && celery -A enterprise_access worker -l DEBUG' | ||
| container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.enterprise-access-worker" | ||
| hostname: enterprise-access-worker.devstack.edx | ||
| depends_on: | ||
| - mysql80 | ||
| - memcached | ||
| environment: | ||
| CELERY_ALWAYS_EAGER: 'false' | ||
| CELERY_BROKER_TRANSPORT: redis | ||
| CELERY_BROKER_HOSTNAME: edx.devstack.redis:6379 | ||
| CELERY_BROKER_VHOST: 0 | ||
| CELERY_BROKER_PASSWORD: password | ||
| DJANGO_SETTINGS_MODULE: enterprise_access.settings.devstack | ||
| COLUMNS: 80 | ||
| DB_HOST: edx.devstack.mysql80 | ||
| DB_NAME: enterprise_access | ||
| DB_PORT: 3306 | ||
| DB_USER: enterprise_access001 | ||
| DB_PASSWORD: password | ||
| networks: | ||
| default: | ||
| aliases: | ||
| - edx.devstack.enterprise-access-worker | ||
|
Comment on lines
+442
to
+445
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above... |
||
| ports: | ||
| - "18271:18271" | ||
| restart: always | ||
| stdin_open: true | ||
| tty: true | ||
|
|
||
| forum: | ||
| command: bash -c 'source /edx/app/forum/ruby_env && source /edx/app/forum/devstack_forum_env && cd /edx/app/forum/cs_comments_service && bundle install && while true; do ./bin/unicorn -c config/unicorn_tcp.rb -I .; sleep 2; done' | ||
| container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.forum" | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||
| set -euf -o pipefail | ||||
|
|
||||
| . scripts/colors.sh | ||||
|
|
||||
| name="enterprise-access" | ||||
| port="18270" | ||||
|
|
||||
| docker compose up -d $name lms | ||||
|
|
||||
| echo -e "${GREEN}Installing requirements for ${name}...${NC}" | ||||
| docker compose exec -T ${name} bash -e -c 'cd /edx/app/enterprise-access && make requirements' -- "$name" | ||||
|
|
||||
| # Run migrations | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we going to use the following convention here |
||||
| echo -e "${GREEN}Running migrations for ${name}...${NC}" | ||||
| docker compose exec -T ${name} bash -e -c "cd /edx/app/enterprise-access/ && make migrate" -- "$name" | ||||
| # docker compose exec -T ${name} bash -e -c 'source /edx/app/credentials/credentials_env && cd /edx/app/credentials/credentials && make migrate' -- "$name" | ||||
|
|
||||
| # Create superuser | ||||
| echo -e "${GREEN}Creating super-user for ${name}...${NC}" | ||||
| docker compose exec -T ${name} bash -e -c "echo 'from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser(\"edx\", \"edx@example.com\", \"edx\") if not User.objects.filter(username=\"edx\").exists() else None' | python /edx/app/enterprise-access/manage.py shell" -- "$name" | ||||
|
|
||||
| ./provision-ida-user.sh ${name} ${name} ${port} | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might need to update it as in the upcoming line
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is already adding devstack/provision-ida-user.sh Line 16 in 731be3f
|
||||
|
|
||||
| # Create system wide enterprise role assignment | ||||
| # TODO: this is a pretty complex oneline, we should probably eventually convert this to a management command. | ||||
| echo -e "${GREEN}Creating system wide enterprise user role assignment for ${name}...${NC}" | ||||
| docker compose exec -T lms bash -e -c "source /edx/app/edxapp/edxapp_env && echo 'from django.contrib.auth import get_user_model; from enterprise.models import SystemWideEnterpriseUserRoleAssignment, SystemWideEnterpriseRole; User = get_user_model(); worker_user = User.objects.get(username=\"${name}_worker\"); operator_role = SystemWideEnterpriseRole.objects.get(name=\"enterprise_openedx_operator\"); assignment = SystemWideEnterpriseUserRoleAssignment.objects.get_or_create(user=worker_user, role=operator_role, applies_to_all_contexts=True);' | /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py lms shell" -- lms | ||||
|
|
||||
| make dev.restart-devserver.enterprise-access | ||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this... as it's already in the same docker-compose file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it is there to define its
alias. Also present in other IDAs in this docker-compose.yml file.