Commit 1219468a by Fred Smith

Merge pull request #3065 from edx/saleem-latif/MAYN-281

MAYN-281: Update edx-configuration to support multiple theme directories
parents dc1c4159 10e8d3a3
...@@ -134,3 +134,9 @@ ...@@ -134,3 +134,9 @@
- Role: Edxapp - Role: Edxapp
- Added EDXAPP_LMS_AUTH_EXTRA and EDXAPP_CMS_AUTH_EXTRA for passing unique AUTH_EXTRA configurations to the LMS and CMS. - Added EDXAPP_LMS_AUTH_EXTRA and EDXAPP_CMS_AUTH_EXTRA for passing unique AUTH_EXTRA configurations to the LMS and CMS.
Both variables default to EDXAPP_AUTH_EXTRA for backward compatibility Both variables default to EDXAPP_AUTH_EXTRA for backward compatibility
- Role: ecommerce
- Renamed `ECOMMERCE_COMPREHENSIVE_THEME_DIR` to `ECOMMERCE_COMPREHENSIVE_THEME_DIRS`, `ECOMMERCE_COMPREHENSIVE_THEME_DIRS`
is now a list of directories. Change is backward incompatible.
- Renamed `COMPREHENSIVE_THEME_DIR` to `COMPREHENSIVE_THEME_DIRS`, `COMPREHENSIVE_THEME_DIRS` is now a list of directories.
Change is backward incompatible.
...@@ -15,7 +15,18 @@ ...@@ -15,7 +15,18 @@
# #
# This role performs the repetitive tasks that most edX roles # This role performs the repetitive tasks that most edX roles
# require in our default configuration. # require in our default configuration.
#
# create groups for the user
- name: create user groups
group:
name: "{{ item }}"
state: present
with_items:
- "{{ user_name }}"
tags:
- install
- install:base
# Generating an ssh key so users can do a git # Generating an ssh key so users can do a git
# clone over ssh for public repositories without any # clone over ssh for public repositories without any
# additional configuration # additional configuration
......
...@@ -115,7 +115,7 @@ ECOMMERCE_THEME_SCSS: 'sass/themes/default.scss' ...@@ -115,7 +115,7 @@ ECOMMERCE_THEME_SCSS: 'sass/themes/default.scss'
# Directory name inside edx-themes repo that contain ecommerce themes # Directory name inside edx-themes repo that contain ecommerce themes
ECOMMERCE_THEMES_DIR_NAME: 'ecommerce' ECOMMERCE_THEMES_DIR_NAME: 'ecommerce'
ECOMMERCE_COMPREHENSIVE_THEME_DIR: !!null ECOMMERCE_COMPREHENSIVE_THEME_DIRS: !!null
ECOMMERCE_ENABLE_COMPREHENSIVE_THEMING: false ECOMMERCE_ENABLE_COMPREHENSIVE_THEMING: false
ECOMMERCE_DEFAULT_SITE_THEME: !!null ECOMMERCE_DEFAULT_SITE_THEME: !!null
...@@ -178,7 +178,7 @@ ECOMMERCE_SERVICE_CONFIG: ...@@ -178,7 +178,7 @@ ECOMMERCE_SERVICE_CONFIG:
BROKER_URL: '{{ ECOMMERCE_BROKER_URL }}' BROKER_URL: '{{ ECOMMERCE_BROKER_URL }}'
# Theming config # Theming config
COMPREHENSIVE_THEME_DIR: "{{ ECOMMERCE_COMPREHENSIVE_THEME_DIR }}" COMPREHENSIVE_THEME_DIRS: "{{ ECOMMERCE_COMPREHENSIVE_THEME_DIRS }}"
ENABLE_COMPREHENSIVE_THEMING: "{{ ECOMMERCE_ENABLE_COMPREHENSIVE_THEMING }}" ENABLE_COMPREHENSIVE_THEMING: "{{ ECOMMERCE_ENABLE_COMPREHENSIVE_THEMING }}"
DEFAULT_SITE_THEME: "{{ ECOMMERCE_DEFAULT_SITE_THEME }}" DEFAULT_SITE_THEME: "{{ ECOMMERCE_DEFAULT_SITE_THEME }}"
......
...@@ -23,5 +23,10 @@ dependencies: ...@@ -23,5 +23,10 @@ dependencies:
debian: "{{ ecommerce_debian_pkgs }}" debian: "{{ ecommerce_debian_pkgs }}"
redhat: "{{ ecommerce_redhat_pkgs }}" redhat: "{{ ecommerce_redhat_pkgs }}"
- role: edx_themes - role: edx_themes
theme_users:
- "{{ ecommerce_user }}"
additional_theme_dirs:
- "{{ ECOMMERCE_COMPREHENSIVE_THEME_DIRS }}"
when: "{{ ECOMMERCE_ENABLE_COMPREHENSIVE_THEMING }}" when: "{{ ECOMMERCE_ENABLE_COMPREHENSIVE_THEMING }}"
- oraclejdk - oraclejdk
...@@ -20,15 +20,6 @@ ...@@ -20,15 +20,6 @@
# Example play: # Example play:
# #
# #
# Copy themes directories.
# When synchronizing we need to make sure that directory path ends with a trailing slash,
# otherwise synchronize will copy the src directory instead of the files/dirs included within the src directory
- name: synchronize theme directories
command: "rsync -a {{ THEMES_CODE_DIR }}/{{ ECOMMERCE_THEMES_DIR_NAME }}/ {{ ECOMMERCE_COMPREHENSIVE_THEME_DIR }}"
sudo_user: "{{ ecommerce_user }}"
when: ECOMMERCE_ENABLE_COMPREHENSIVE_THEMING and THEMES_CODE_DIR is defined
- name: "add gunicorn configuration file" - name: "add gunicorn configuration file"
template: > template: >
src=edx/app/ecommerce/ecommerce_gunicorn.py.j2 src=edx/app/ecommerce/ecommerce_gunicorn.py.j2
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
## ##
# Defaults for role themes # Defaults for role themes
# #
themes_service_name: "edx-themes" themes_service_name: "edx-themes"
themes_user: "{{ themes_service_name }}" themes_user: "{{ themes_service_name }}"
themes_group: "{{ themes_user }}"
themes_home: "{{ COMMON_CFG_DIR }}/{{ themes_service_name }}" themes_home: "{{ COMMON_CFG_DIR }}/{{ themes_service_name }}"
THEMES_CODE_DIR: "{{ themes_home }}/{{ themes_service_name }}" THEMES_CODE_DIR: "{{ themes_home }}/{{ themes_service_name }}"
...@@ -21,7 +23,7 @@ THEMES_GIT_PROTOCOL: "{{ COMMON_GIT_PROTOCOL }}" ...@@ -21,7 +23,7 @@ THEMES_GIT_PROTOCOL: "{{ COMMON_GIT_PROTOCOL }}"
THEMES_GIT_MIRROR: "{{ COMMON_GIT_MIRROR }}" THEMES_GIT_MIRROR: "{{ COMMON_GIT_MIRROR }}"
THEMES_GIT_PATH: "{{ COMMON_GIT_PATH }}" THEMES_GIT_PATH: "{{ COMMON_GIT_PATH }}"
THEMES_REPO: "sample-themes.git" THEMES_REPO: "sample-themes.git"
THEMES_VERSION: "master" THEMES_VERSION: "release"
THEMES_REPOS: THEMES_REPOS:
......
...@@ -14,9 +14,9 @@ dependencies: ...@@ -14,9 +14,9 @@ dependencies:
- role: add_user - role: add_user
user_name: "{{ themes_user }}" user_name: "{{ themes_user }}"
user_home: "{{ themes_home }}" user_home: "{{ themes_home }}"
group_name: "{{ themes_user }}" group_name: "{{ themes_group }}"
- role: git_clone - role: git_clone
repo_owner: "{{ themes_user }}" repo_owner: "{{ themes_user }}"
repo_group: "{{ themes_user }}" repo_group: "{{ themes_group }}"
GIT_REPOS: "{{ THEMES_REPOS }}" GIT_REPOS: "{{ THEMES_REPOS }}"
git_home: "{{ themes_home }}" git_home: "{{ themes_home }}"
...@@ -25,5 +25,45 @@ ...@@ -25,5 +25,45 @@
# #
# dependencies: # dependencies:
# - role: edx_themes # - role: edx_themes
# theme_users:
# - ecommerce
# - edxapp
# additional_theme_dirs:
# - /edx/app/ecommerce/ecommerce/ecommerce/themes
# when do_setup_themes # when do_setup_themes
# #
# make sure edx-theme's group has read/write access to themes directory
- name: ensure edx-theme's group has read/write access to themes directory
file:
path: "{{ themes_home }}"
state: directory
recurse: yes
owner: "{{ themes_user }}"
group: "{{ themes_group }}"
mode: "g+rw"
tags:
- install
- install:base
- name: assign theme's group to all theme's directories
file:
path: "{{ item }}"
state: directory
recurse: yes
group: "{{ themes_group }}"
mode: "g+rw"
with_items: additional_theme_dirs
when: additional_theme_dirs is defined
tags:
- install
- install:base
- name: Add theme users to theme's group so that that have read/write access to themes directories
user:
name: "{{ item }}"
shell: /bin/bash
groups: "{{ themes_group }}"
append: yes
with_items: theme_users
when: theme_users is defined
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