Commit 0952ed47 by e0d

Merge pull request #732 from edx/e0d/forum-refactor

productionalization of forum role
parents 6684f02e 2bd990b2
......@@ -28,6 +28,7 @@ FORUM_ELASTICSEARCH_PORT: "9200"
FORUM_ELASTICSEARCH_URL: "http://{{ FORUM_ELASTICSEARCH_HOST }}:{{ FORUM_ELASTICSEARCH_PORT }}"
FORUM_NEW_RELIC_LICENSE_KEY: "new-relic-license-key"
FORUM_NEW_RELIC_APP_NAME: "forum-newrelic-app"
FORUM_WORKER_PROCESSES: "4"
forum_environment:
RBENV_ROOT: "{{ forum_rbenv_root }}"
......@@ -41,12 +42,22 @@ forum_environment:
MONGOHQ_URL: "{{ FORUM_MONGO_URL }}"
HOME: "{{ forum_app_dir }}"
NEW_RELIC_APP_NAME: "{{ FORUM_NEW_RELIC_APP_NAME }}"
NEW_RELIC_LICENSE_KEY: " {{ FORUM_NEW_RELIC_LICENSE_KEY }}"
NEW_RELIC_LICENSE_KEY: "{{ FORUM_NEW_RELIC_LICENSE_KEY }}"
WORKER_PROCESSES: "{{ FORUM_WORKER_PROCESSES }}"
DATA_DIR: "{{ forum_data_dir }}"
forum_user: "forum"
forum_ruby_version: "1.9.3-p448"
forum_source_repo: "https://github.com/edx/cs_comments_service.git"
forum_version: "HEAD"
# Currently we are installing a branch of the comments service
# that configures unicorn to listen on a unix socket and get the
# worker count configuration from the environment. We are not
# merging to master of the comments service yet as this will have
# some incompatibilities with our Heroku deployments.
#
# https://github.com/edx/cs_comments_service/pull/83
#
forum_version: "e0d/unicorn-config"
forum_unicorn_port: "4567"
#
......@@ -59,5 +70,5 @@ forum_unicorn_port: "4567"
# connectivity to Mongo is also tested, but separately.
#
forum_services:
- {service: "sinatra", host: "localhost", port: "{{ forum_unicorn_port }}"}
- {service: "elasticsearch", host: "{{ FORUM_ELASTICSEARCH_HOST }}", port: "{{ FORUM_ELASTICSEARCH_PORT }}"}
\ No newline at end of file
- {service: "elasticsearch", host: "{{ FORUM_ELASTICSEARCH_HOST }}", port: "{{ FORUM_ELASTICSEARCH_PORT }}"}
......@@ -42,5 +42,10 @@
notify:
- restart the forum service
- include: deploy.yml tags=deploy
- name: create {{ forum_data_dir }}
file: >
path={{ forum_data_dir }} state=directory
owner="{{ common_web_user }}" group="{{ common_web_group }}"
mode=0777
- include: deploy.yml tags=deploy
\ No newline at end of file
......@@ -8,4 +8,4 @@
- name: test that mongo replica set members are listing
wait_for: port={{ FORUM_MONGO_PORT }} host={{ item }} timeout=30
with_items: FORUM_MONGO_HOSTS
when: not devstack
when: not devstack
\ No newline at end of file
#!/bin/bash
source {{ forum_app_dir }}/forum_env
cd {{ forum_code_dir }}
{% if devstack %}
{{ forum_rbenv_shims }}/ruby app.rb
{% else %}
{{ forum_gem_bin }}/unicorn -c config/unicorn.rb
{% endif %}
#
# {{ ansible_managed }}
#
{# This prevents the injected comment from eating the server
directive. There's probably a better way of doing this,
but I don't know it currently.
#}
{% raw %}
{% endraw %}
{%- if "forum" in nginx_default_sites -%}
{%- set default_site = "default" -%}
{%- else -%}
{%- set default_site = "" -%}
{%- endif -%}
{% if devstack %}
{# Connects to webbrick on port 4567 typically. Appropriate for development deployments #}
upstream forum_app_server {
server localhost:{{ forum_unicorn_port }} fail_timeout=0;
}
{% else %}
{# Connects to unicorn over a unix socket. Appropriate for production deployments #}
server localhost:{{ forum_unicorn_port }} fail_timeout=0;
upstream forum_app_server {
server unix:{{ forum_data_dir }}/forum.sock fail_timeout=0;
}
{% endif %}
server {
......
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