Commit eb78a7e7 by Clinton Blackburn

Merge pull request #2669 from edx/clintonb/forums-fix

Forums Fixes
parents beb11c51 0cbbab3c
--- ---
forum_app_dir: "{{ COMMON_APP_DIR }}/forum" forum_app_dir: "{{ COMMON_APP_DIR }}/forum"
forum_code_dir: "{{ forum_app_dir }}/cs_comments_service" forum_code_dir: "{{ forum_app_dir }}/cs_comments_service"
forum_binstubs_dir: "{{ forum_code_dir }}/bin"
forum_data_dir: "{{ COMMON_DATA_DIR }}/forum" forum_data_dir: "{{ COMMON_DATA_DIR }}/forum"
forum_rbenv_dir: "{{ forum_app_dir }}" forum_rbenv_dir: "{{ forum_app_dir }}"
forum_rbenv_root: "{{ forum_app_dir }}/.rbenv" forum_rbenv_root: "{{ forum_app_dir }}/.rbenv"
...@@ -9,7 +10,7 @@ forum_rbenv_bin: "{{ forum_rbenv_root }}/bin" ...@@ -9,7 +10,7 @@ forum_rbenv_bin: "{{ forum_rbenv_root }}/bin"
forum_supervisor_wrapper: "{{ forum_app_dir }}/forum-supervisor.sh" forum_supervisor_wrapper: "{{ forum_app_dir }}/forum-supervisor.sh"
forum_gem_root: "{{ forum_rbenv_dir }}/.gem" forum_gem_root: "{{ forum_rbenv_dir }}/.gem"
forum_gem_bin: "{{ forum_gem_root }}/bin" forum_gem_bin: "{{ forum_gem_root }}/bin"
forum_path: "{{ forum_code_dir }}/bin:{{ forum_rbenv_bin }}:{{ forum_rbenv_shims }}:{{ forum_gem_bin }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" forum_path: "{{ forum_binstubs_dir }}:{{ forum_rbenv_bin }}:{{ forum_rbenv_shims }}:{{ forum_gem_bin }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
FORUM_MONGO_USER: "cs_comments_service" FORUM_MONGO_USER: "cs_comments_service"
FORUM_MONGO_PASSWORD: "password" FORUM_MONGO_PASSWORD: "password"
...@@ -59,7 +60,7 @@ forum_environment: ...@@ -59,7 +60,7 @@ forum_environment:
LISTEN_PORT: "{{ FORUM_LISTEN_PORT }}" LISTEN_PORT: "{{ FORUM_LISTEN_PORT }}"
forum_user: "forum" forum_user: "forum"
forum_ruby_version: "1.9.3-p448" forum_ruby_version: "1.9.3-p551"
forum_source_repo: "https://github.com/edx/cs_comments_service.git" forum_source_repo: "https://github.com/edx/cs_comments_service.git"
forum_version: "master" forum_version: "master"
......
...@@ -3,8 +3,6 @@ dependencies: ...@@ -3,8 +3,6 @@ dependencies:
- common - common
- supervisor - supervisor
- role: rbenv - role: rbenv
# TODO: setting the rbenv ownership to rbenv_user: "{{ forum_user }}"
# the common_web_user is a workaround
rbenv_user: "{{ common_web_user }}"
rbenv_dir: "{{ forum_app_dir }}" rbenv_dir: "{{ forum_app_dir }}"
rbenv_ruby_version: "{{ forum_ruby_version }}" rbenv_ruby_version: "{{ forum_ruby_version }}"
...@@ -49,12 +49,9 @@ ...@@ -49,12 +49,9 @@
- install - install
- install:code - install:code
# TODO: This is done as the common_web_user
# since the process owner needs write access
# to the rbenv
- name: install comments service bundle - name: install comments service bundle
shell: bundle install --deployment chdir={{ forum_code_dir }} shell: bundle install --deployment --path {{ forum_gem_root }} chdir={{ forum_code_dir }}
sudo_user: "{{ common_web_user }}" sudo_user: "{{ forum_user }}"
environment: "{{ forum_environment }}" environment: "{{ forum_environment }}"
notify: restart the forum service notify: restart the forum service
tags: tags:
......
...@@ -23,18 +23,23 @@ ...@@ -23,18 +23,23 @@
- name: create application user - name: create application user
user: > user: >
name="{{ forum_user }}" home="{{ forum_app_dir }}" name="{{ forum_user }}"
createhome=no home="{{ forum_app_dir }}"
createhome=yes
shell=/bin/false shell=/bin/false
generate_ssh_key=yes
notify: restart the forum service notify: restart the forum service
tags: tags:
- install - install
- install:base - install:base
- name: create forum app dir # Ensure the directory is accessible to the web service
- name: set forum app dir permissions
file: > file: >
path="{{ forum_app_dir }}" state=directory path="{{ forum_app_dir }}"
owner="{{ forum_user }}" group="{{ common_web_group }}" state=directory
owner="{{ forum_user }}"
group="{{ common_web_group }}"
notify: restart the forum service notify: restart the forum service
tags: tags:
- install - install
...@@ -60,4 +65,4 @@ ...@@ -60,4 +65,4 @@
- install - install
- install:base - install:base
- include: deploy.yml tags=deploy - include: deploy.yml tags=deploy
\ No newline at end of file
...@@ -6,7 +6,7 @@ cd {{ forum_code_dir }} ...@@ -6,7 +6,7 @@ cd {{ forum_code_dir }}
{% if devstack %} {% if devstack %}
{{ forum_rbenv_shims }}/ruby app.rb {{ forum_rbenv_shims }}/ruby app.rb
{% elif FORUM_USE_TCP %} {% elif FORUM_USE_TCP %}
{{ forum_gem_bin }}/unicorn -c config/unicorn_tcp.rb {{ forum_binstubs_dir }}/unicorn -c config/unicorn_tcp.rb
{% else %} {% else %}
{{ forum_gem_bin }}/unicorn -c config/unicorn.rb {{ forum_binstubs_dir }}/unicorn -c config/unicorn.rb
{% endif %} {% endif %}
...@@ -21,23 +21,6 @@ ...@@ -21,23 +21,6 @@
group: "{{ common_web_group }}" group: "{{ common_web_group }}"
when: edxapp_user is defined when: edxapp_user is defined
# Ensure forum user has permissions to access .gem and .rbenv
# This is a little twisty: the forum role sets the owner and group to www-data
# So we add the forum user to the www-data group and give group write permissions
- name: add forum user to www-data group
user: name={{ forum_user }} groups={{ common_web_group }} append=yes
when: forum_user is defined
# Need this in order for the forum user to install and uninstall
# gems using 'bundle' or 'gem'. Can't make it 760 because that
# would break the bin directory under .gem
- name: set forum rbenv and gem permissions
file:
path={{ item }} state=directory recurse=yes mode="g+rw"
with_items:
- "{{ forum_app_dir }}/.gem"
when: forum_user is defined
# Create scripts to configure environment # Create scripts to configure environment
- name: create login scripts - name: create login scripts
template: template:
......
--- ---
rbenv_version: 'v0.4.0' rbenv_version: 'v1.0.0'
rbenv_bundler_version: '1.3.2' rbenv_bundler_version: '1.11.2'
rbenv_rake_version: '10.0.3' rbenv_rake_version: '10.4.2'
rbenv_root: "{{ rbenv_dir }}/.rbenv" rbenv_root: "{{ rbenv_dir }}/.rbenv"
rbenv_gem_root: "{{ rbenv_dir }}/.gem" rbenv_gem_root: "{{ rbenv_dir }}/.gem"
rbenv_gem_bin: "{{ rbenv_gem_root }}/bin" rbenv_gem_bin: "{{ rbenv_gem_root }}/bin"
......
...@@ -177,6 +177,14 @@ ...@@ -177,6 +177,14 @@
tags: tags:
- install - install
- install:base - install:base
- name: update rubygems
shell: "gem install rubygems-update && update_rubygems"
sudo_user: "{{ rbenv_user }}"
environment: "{{ rbenv_environment }}"
tags:
- install
- install:base
- name: rehash - name: rehash
shell: "rbenv rehash" shell: "rbenv rehash"
...@@ -184,4 +192,4 @@ ...@@ -184,4 +192,4 @@
environment: "{{ rbenv_environment }}" environment: "{{ rbenv_environment }}"
tags: tags:
- install - install
- install:base - install:base
\ No newline at end of file
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