Commit 2a47f845 by e0d

Changes to make the forums run using unicorn and

unix sockets.
parent 3eeb0aa1
...@@ -28,6 +28,7 @@ FORUM_ELASTICSEARCH_PORT: "9200" ...@@ -28,6 +28,7 @@ FORUM_ELASTICSEARCH_PORT: "9200"
FORUM_ELASTICSEARCH_URL: "http://{{ FORUM_ELASTICSEARCH_HOST }}:{{ FORUM_ELASTICSEARCH_PORT }}" FORUM_ELASTICSEARCH_URL: "http://{{ FORUM_ELASTICSEARCH_HOST }}:{{ FORUM_ELASTICSEARCH_PORT }}"
FORUM_NEW_RELIC_LICENSE_KEY: "new-relic-license-key" FORUM_NEW_RELIC_LICENSE_KEY: "new-relic-license-key"
FORUM_NEW_RELIC_APP_NAME: "forum-newrelic-app" FORUM_NEW_RELIC_APP_NAME: "forum-newrelic-app"
FORUM_WORKER_PROCESSES: "4"
forum_environment: forum_environment:
RBENV_ROOT: "{{ forum_rbenv_root }}" RBENV_ROOT: "{{ forum_rbenv_root }}"
...@@ -41,12 +42,14 @@ forum_environment: ...@@ -41,12 +42,14 @@ forum_environment:
MONGOHQ_URL: "{{ FORUM_MONGO_URL }}" MONGOHQ_URL: "{{ FORUM_MONGO_URL }}"
HOME: "{{ forum_app_dir }}" HOME: "{{ forum_app_dir }}"
NEW_RELIC_APP_NAME: "{{ FORUM_NEW_RELIC_APP_NAME }}" 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_user: "forum"
forum_ruby_version: "1.9.3-p448" forum_ruby_version: "1.9.3-p448"
forum_source_repo: "https://github.com/edx/cs_comments_service.git" forum_source_repo: "https://github.com/edx/cs_comments_service.git"
forum_version: "HEAD" forum_version: "e0d/unicorn-config"
forum_unicorn_port: "4567" forum_unicorn_port: "4567"
# #
...@@ -59,5 +62,5 @@ forum_unicorn_port: "4567" ...@@ -59,5 +62,5 @@ forum_unicorn_port: "4567"
# connectivity to Mongo is also tested, but separately. # connectivity to Mongo is also tested, but separately.
# #
forum_services: forum_services:
- {service: "sinatra", host: "localhost", port: "{{ forum_unicorn_port }}"} # - {service: "sinatra", host: "localhost", port: "{{ forum_unicorn_port }}"}
- {service: "elasticsearch", host: "{{ FORUM_ELASTICSEARCH_HOST }}", port: "{{ FORUM_ELASTICSEARCH_PORT }}"} - {service: "elasticsearch", host: "{{ FORUM_ELASTICSEARCH_HOST }}", port: "{{ FORUM_ELASTICSEARCH_PORT }}"}
\ No newline at end of file
...@@ -38,9 +38,14 @@ ...@@ -38,9 +38,14 @@
template: > template: >
src=forum_env.j2 dest={{ forum_app_dir }}/forum_env src=forum_env.j2 dest={{ forum_app_dir }}/forum_env
owner={{ forum_user }} group={{ common_web_user }} owner={{ forum_user }} group={{ common_web_user }}
mode=0644 mode=0774
notify: notify:
- restart the forum service - 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
#!/bin/bash #!/bin/bash
source {{ forum_app_dir }}/forum_env source {{ forum_app_dir }}/forum_env
cd {{ forum_code_dir }} cd {{ forum_code_dir }}
{% if devstack %}
{{ forum_rbenv_shims }}/ruby app.rb {{ 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 -%} {%- if "forum" in nginx_default_sites -%}
{%- set default_site = "default" -%} {%- set default_site = "default" -%}
{%- else -%} {%- else -%}
{%- set default_site = "" -%} {%- set default_site = "" -%}
{%- endif -%} {%- endif -%}
{% if devstack %}
{# Connects to webbrick on port 4567 typically. Appropriate for development deployments #}
upstream forum_app_server { 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 { 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