Commit 01508715 by Renzo Lucioni

Ecommerce in devstack

This kills the ecomstack. Includes a new ecommerce task responsible for OAuth2 Client configuration.
parent 3d6f4892
...@@ -39,18 +39,17 @@ ECOMMERCE_SECRET_KEY: 'Your secret key here' ...@@ -39,18 +39,17 @@ ECOMMERCE_SECRET_KEY: 'Your secret key here'
ECOMMERCE_TIME_ZONE: 'UTC' ECOMMERCE_TIME_ZONE: 'UTC'
ECOMMERCE_LANGUAGE_CODE: 'en-us' ECOMMERCE_LANGUAGE_CODE: 'en-us'
ECOMMERCE_EDX_API_KEY: 'put-your-edx-api-auth-token-here' ECOMMERCE_EDX_API_KEY: 'put-your-edx-api-auth-token-here'
ECOMMERCE_ECOMMERCE_URL_ROOT: 'https://www.example.com' ECOMMERCE_ECOMMERCE_URL_ROOT: 'http://localhost:8002'
ECOMMERCE_LMS_URL_ROOT: 'https://www.example.com' ECOMMERCE_LMS_URL_ROOT: 'http://127.0.0.1:8000'
ECOMMERCE_JWT_SECRET_KEY: 'generated-key-that-matches-ECOMMERCE_API_SIGNING_KEY-in-edxapp' ECOMMERCE_JWT_SECRET_KEY: 'generated-key-that-matches-ECOMMERCE_API_SIGNING_KEY-in-edxapp'
ECOMMERCE_JWT_VERIFY_EXPIRATION: true ECOMMERCE_JWT_VERIFY_EXPIRATION: true
# Generated by the app that you're using as your auth source # Used to automatically configure OAuth2 Client
# in most cases this will be the edx-platform
ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_KEY : 'some-secret' ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_KEY : 'some-secret'
ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_SECRET : 'some-secret' ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_SECRET : 'some-secret'
ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_ID_TOKEN_DECRYPTION_KEY : 'some-secret'
ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_URL_ROOT : 'some-secret'
ECOMMERCE_SOCIAL_AUTH_REDIRECT_IS_HTTPS: false ECOMMERCE_SOCIAL_AUTH_REDIRECT_IS_HTTPS: false
# Analytics related
ECOMMERCE_SEGMENT_KEY: !!null ECOMMERCE_SEGMENT_KEY: !!null
# CyberSource related # CyberSource related
...@@ -109,7 +108,7 @@ ECOMMERCE_SERVICE_CONFIG: ...@@ -109,7 +108,7 @@ ECOMMERCE_SERVICE_CONFIG:
JWT_VERIFY_EXPIRATION: '{{ ECOMMERCE_JWT_VERIFY_EXPIRATION }}' JWT_VERIFY_EXPIRATION: '{{ ECOMMERCE_JWT_VERIFY_EXPIRATION }}'
SOCIAL_AUTH_EDX_OIDC_KEY: '{{ ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_KEY }}' SOCIAL_AUTH_EDX_OIDC_KEY: '{{ ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_KEY }}'
SOCIAL_AUTH_EDX_OIDC_SECRET: '{{ ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_SECRET }}' SOCIAL_AUTH_EDX_OIDC_SECRET: '{{ ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_SECRET }}'
SOCIAL_AUTH_EDX_OIDC_ID_TOKEN_DECRYPTION_KEY: '{{ ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_ID_TOKEN_DECRYPTION_KEY }}' SOCIAL_AUTH_EDX_OIDC_ID_TOKEN_DECRYPTION_KEY: '{{ ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_SECRET }}'
SOCIAL_AUTH_EDX_OIDC_URL_ROOT: '{{ ECOMMERCE_LMS_URL_ROOT }}/oauth2' SOCIAL_AUTH_EDX_OIDC_URL_ROOT: '{{ ECOMMERCE_LMS_URL_ROOT }}/oauth2'
SOCIAL_AUTH_REDIRECT_IS_HTTPS: '{{ ECOMMERCE_SOCIAL_AUTH_REDIRECT_IS_HTTPS }}' SOCIAL_AUTH_REDIRECT_IS_HTTPS: '{{ ECOMMERCE_SOCIAL_AUTH_REDIRECT_IS_HTTPS }}'
SEGMENT_KEY: '{{ ECOMMERCE_SEGMENT_KEY }}' SEGMENT_KEY: '{{ ECOMMERCE_SEGMENT_KEY }}'
...@@ -145,7 +144,7 @@ ECOMMERCE_GUNICORN_WORKER_CLASS: "gevent" ...@@ -145,7 +144,7 @@ ECOMMERCE_GUNICORN_WORKER_CLASS: "gevent"
# #
ecommerce_environment: ecommerce_environment:
DJANGO_SETTINGS_MODULE: "ecommerce.settings.production" DJANGO_SETTINGS_MODULE: "ecommerce.settings.production"
ECOMMERCE_CFG: "{{ COMMON_CFG_DIR }}/{{ ecommerce_service_name }}.yml" ECOMMERCE_CFG: "{{ COMMON_CFG_DIR }}/{{ ecommerce_service_name }}.yml"
ecommerce_service_name: "ecommerce" ecommerce_service_name: "ecommerce"
ecommerce_user: "{{ ecommerce_service_name }}" ecommerce_user: "{{ ecommerce_service_name }}"
...@@ -168,9 +167,6 @@ ecommerce_requirements: ...@@ -168,9 +167,6 @@ ecommerce_requirements:
- production.txt - production.txt
- optional.txt - optional.txt
ecommerce_dev_requirements:
- local.txt
# #
# OS packages # OS packages
# #
......
...@@ -34,16 +34,6 @@ ...@@ -34,16 +34,6 @@
state=present state=present
sudo_user: "{{ ecommerce_user }}" sudo_user: "{{ ecommerce_user }}"
with_items: ecommerce_requirements with_items: ecommerce_requirements
when: not devstack
- name: install application requirements
pip: >
requirements="{{ ecommerce_requirements_base }}/{{ item }}"
virtualenv="{{ ecommerce_home }}/venvs/{{ ecommerce_service_name }}"
state=present
sudo_user: "{{ ecommerce_user }}"
with_items: ecommerce_dev_requirements
when: devstack
- name: create nodeenv - name: create nodeenv
shell: > shell: >
...@@ -145,3 +135,18 @@ ...@@ -145,3 +135,18 @@
name={{ ecommerce_service_name }} name={{ ecommerce_service_name }}
when: not disable_edx_services when: not disable_edx_services
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
- name: create OAuth2 Client
shell: >
{{ COMMON_BIN_DIR }}/manage.edxapp lms --settings=aws
create_oauth2_client
"{{ ECOMMERCE_ECOMMERCE_URL_ROOT }}"
"{{ ECOMMERCE_ECOMMERCE_URL_ROOT }}/complete/edx-oidc/"
confidential
--client_name "{{ ecommerce_service_name }}"
--client_id "{{ ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_KEY }}"
--client_secret "{{ ECOMMERCE_SOCIAL_AUTH_EDX_OIDC_SECRET }}"
--trusted
sudo_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
when: create_oauth2_clients
...@@ -18,6 +18,8 @@ localdev_accounts: ...@@ -18,6 +18,8 @@ localdev_accounts:
- { user: "{{ notifier_user|default('None') }}", home: "{{ notifier_app_dir }}", - { user: "{{ notifier_user|default('None') }}", home: "{{ notifier_app_dir }}",
env: "notifier_env", repo: "" } env: "notifier_env", repo: "" }
- { user: "{{ ecommerce_user|default('None') }}", home: "{{ ecommerce_home }}",
env: "ecommerce_env", repo: "ecommerce" }
# Helpful system packages for local dev # Helpful system packages for local dev
local_dev_pkgs: local_dev_pkgs:
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
devstack: true devstack: true
disable_edx_services: true disable_edx_services: true
mongo_enable_journal: false mongo_enable_journal: false
create_oauth2_clients: true
EDXAPP_NO_PREREQ_INSTALL: 0 EDXAPP_NO_PREREQ_INSTALL: 0
COMMON_MOTD_TEMPLATE: 'devstack_motd.tail.j2' COMMON_MOTD_TEMPLATE: 'devstack_motd.tail.j2'
COMMON_SSH_PASSWORD_AUTH: "yes" COMMON_SSH_PASSWORD_AUTH: "yes"
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
- oraclejdk - oraclejdk
- elasticsearch - elasticsearch
- forum - forum
- ecommerce
- role: notifier - role: notifier
NOTIFIER_DIGEST_TASK_INTERVAL: "5" NOTIFIER_DIGEST_TASK_INTERVAL: "5"
- role: ora - role: ora
......
- name: Configure instance(s)
hosts: all
sudo: True
gather_facts: True
vars:
migrate_db: 'yes'
openid_workaround: true
devstack: true
disable_edx_services: true
EDXAPP_NO_PREREQ_INSTALL: 0
COMMON_MOTD_TEMPLATE: 'devstack_motd.tail.j2'
COMMON_SSH_PASSWORD_AUTH: "yes"
roles:
- edx_ansible
- edxlocal
- mongo
- edxapp
- ecommerce
- browsers
- browsermob-proxy
- local_dev
- demo
...@@ -12,6 +12,7 @@ edx_platform_mount_dir = "edx-platform" ...@@ -12,6 +12,7 @@ edx_platform_mount_dir = "edx-platform"
themes_mount_dir = "themes" themes_mount_dir = "themes"
forum_mount_dir = "cs_comments_service" forum_mount_dir = "cs_comments_service"
ora_mount_dir = "ora" ora_mount_dir = "ora"
ecommerce_mount_dir = "ecommerce"
if ENV['VAGRANT_MOUNT_BASE'] if ENV['VAGRANT_MOUNT_BASE']
...@@ -19,6 +20,7 @@ if ENV['VAGRANT_MOUNT_BASE'] ...@@ -19,6 +20,7 @@ if ENV['VAGRANT_MOUNT_BASE']
themes_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + themes_mount_dir themes_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + themes_mount_dir
forum_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + forum_mount_dir forum_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + forum_mount_dir
ora_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + ora_mount_dir ora_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + ora_mount_dir
ecommerce_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + ecommerce_mount_dir
end end
...@@ -31,6 +33,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| ...@@ -31,6 +33,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.network :private_network, ip: "192.168.33.10" config.vm.network :private_network, ip: "192.168.33.10"
config.vm.network :forwarded_port, guest: 8000, host: 8000 # LMS config.vm.network :forwarded_port, guest: 8000, host: 8000 # LMS
config.vm.network :forwarded_port, guest: 8001, host: 8001 # Studio config.vm.network :forwarded_port, guest: 8001, host: 8001 # Studio
config.vm.network :forwarded_port, guest: 8002, host: 8002 # Ecommerce
config.vm.network :forwarded_port, guest: 8003, host: 8003 # LMS for Bok Choy config.vm.network :forwarded_port, guest: 8003, host: 8003 # LMS for Bok Choy
config.vm.network :forwarded_port, guest: 8031, host: 8031 # Studio for Bok Choy config.vm.network :forwarded_port, guest: 8031, host: 8031 # Studio for Bok Choy
config.vm.network :forwarded_port, guest: 8120, host: 8120 # edX Notes Service config.vm.network :forwarded_port, guest: 8120, host: 8120 # edX Notes Service
...@@ -53,6 +56,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| ...@@ -53,6 +56,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
create: true, owner: "edxapp", group: "www-data" create: true, owner: "edxapp", group: "www-data"
config.vm.synced_folder "#{forum_mount_dir}", "/edx/app/forum/cs_comments_service", config.vm.synced_folder "#{forum_mount_dir}", "/edx/app/forum/cs_comments_service",
create: true, owner: "forum", group: "www-data" create: true, owner: "forum", group: "www-data"
config.vm.synced_folder "#{ecommerce_mount_dir}", "/edx/app/ecommerce/ecommerce",
create: true, owner: "ecommerce", group: "www-data"
if ENV['ENABLE_LEGACY_ORA'] if ENV['ENABLE_LEGACY_ORA']
config.vm.synced_folder "#{ora_mount_dir}", "/edx/app/ora/ora", config.vm.synced_folder "#{ora_mount_dir}", "/edx/app/ora/ora",
...@@ -65,6 +70,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| ...@@ -65,6 +70,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
create: true, nfs: true create: true, nfs: true
config.vm.synced_folder "#{forum_mount_dir}", "/edx/app/forum/cs_comments_service", config.vm.synced_folder "#{forum_mount_dir}", "/edx/app/forum/cs_comments_service",
create: true, nfs: true create: true, nfs: true
config.vm.synced_folder "#{ecommerce_mount_dir}", "/edx/app/ecommerce/ecommerce",
create: true, nfs: true
if ENV['ENABLE_LEGACY_ORA'] if ENV['ENABLE_LEGACY_ORA']
config.vm.synced_folder "#{ora_mount_dir}", "/edx/app/ora/ora", config.vm.synced_folder "#{ora_mount_dir}", "/edx/app/ora/ora",
......
Vagrant.require_version ">= 1.5.3"
unless Vagrant.has_plugin?("vagrant-vbguest")
raise "Please install the vagrant-vbguest plugin by running `vagrant plugin install vagrant-vbguest`"
end
VAGRANTFILE_API_VERSION = "2"
# Needed to accommodate compilation of SciPy and NumPy
MEMORY = 4096
CPU_COUNT = 2
edx_platform_mount_dir = "edx-platform"
ecommerce_mount_dir = "ecommerce"
if ENV['VAGRANT_MOUNT_BASE']
edx_platform_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + edx_platform_mount_dir
ecommerce_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + ecommerce_mount_dir
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Creates a Vagrant machine from a base Ubuntu 12.04 image for virtualbox
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.network :forwarded_port, guest: 8000, host: 8000
config.vm.network :forwarded_port, guest: 8001, host: 8001
config.vm.network :forwarded_port, guest: 8002, host: 8002
config.ssh.insert_key = true
config.vm.synced_folder ".", "/vagrant", disabled: true
# Enable X11 forwarding so we can interact with GUI applications
if ENV['VAGRANT_X11']
config.ssh.forward_x11 = true
end
if ENV['VAGRANT_USE_VBOXFS'] == 'true'
config.vm.synced_folder "#{edx_platform_mount_dir}", "/edx/app/edxapp/edx-platform",
create: true, owner: "edxapp", group: "www-data"
config.vm.synced_folder "#{ecommerce_mount_dir}", "/edx/app/ecommerce/ecommerce",
create: true, owner: "ecommerce", group: "www-data"
else
config.vm.synced_folder "#{edx_platform_mount_dir}", "/edx/app/edxapp/edx-platform",
create: true, nfs: true
config.vm.synced_folder "#{ecommerce_mount_dir}", "/edx/app/ecommerce/ecommerce",
create: true, nfs: true
end
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]
# Allow DNS to work for Ubuntu 12.10 host
# http://askubuntu.com/questions/238040/how-do-i-fix-name-service-for-vagrant-client
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
["vmware_fusion", "vmware_workstation"].each do |vmware_provider|
config.vm.provider vmware_provider do |v, override|
# Override box url to get vmware one
override.vm.box = "precise64_vmware"
override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
v.vmx["memsize"] = MEMORY.to_s
v.vmx["numvcpus"] = CPU_COUNT.to_s
end
end
# Make LC_ALL default to en_US.UTF-8 instead of en_US.
# See: https://github.com/mitchellh/vagrant/issues/1188
config.vm.provision "shell", inline: 'echo \'LC_ALL="en_US.UTF-8"\' > /etc/default/locale'
# Use vagrant-vbguest plugin to make sure Guest Additions are in sync
config.vbguest.auto_reboot = true
config.vbguest.auto_update = true
config.vm.provision :ansible do |ansible|
ansible.playbook = "../../../playbooks/vagrant-ecomstack.yml"
ansible.verbose = "vvvv"
ansible.extra_vars = {}
if ENV['OPENEDX_RELEASE']
ansible.extra_vars = {
edx_platform_version: ENV['OPENEDX_RELEASE'],
}
end
end
end
# config file for ansible -- http://ansible.github.com
# nearly all parameters can be overridden in ansible-playbook or with command line flags
# ansible will read ~/.ansible.cfg or /etc/ansible/ansible.cfg, whichever it finds first
[defaults]
jinja2_extensions=jinja2.ext.do
host_key_checking = False
roles_path=../../ansible-roles/roles:../../ansible-private/roles:../../ansible-roles/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment