Commit d6e50911 by Vik Paruchuri

Address review comments - remove remote user, add git ssh, move some vars in templates

parent c60d77ac
#!/bin/sh
exec /usr/bin/ssh -o StrictHostKeyChecking=no "$@"
......@@ -14,29 +14,29 @@
#Upload config files for django (auth and env)
- name: create discern application config env.json file
template: src=env.json.j2 dest={{app_base_dir}}/env.json owner={{remote_user}} group=edx mode=0640
template: src=env.json.j2 dest={{app_base_dir}}/env.json owner=root group=edx mode=0640
- name: create discern auth file auth.json
template: src=auth.json.j2 dest={{app_base_dir}}/auth.json owner={{remote_user}} group=edx mode=0640
template: src=auth.json.j2 dest={{app_base_dir}}/auth.json owner=root group=edx mode=0640
#Needed if using redis to prevent memory issues
- name: change memory commit settings -- needed for redis
command: sysctl vm.overcommit_memory=1
#Needed to pull repos from github, due to hanging on host add prompt otherwise
- name: add github to the known hosts file
shell: ssh-keyscan -H github.com > ~/.ssh/known_hosts
#Upload custom git ssh script
- name: upload ssh script
copy: src=git_ssh.sh dest=/tmp/git_ssh.sh force=yes owner=root group=adm mode=750
- name: set permissions on app_base_dir sgid for edx
file: path={{app_base_dir}} owner={{remote_user}} group=edx mode=2775 state=directory
file: path={{venv_dir}} owner={{remote_user}} group=edx mode=2775 state=directory
file: path={{app_base_dir}} owner=root group=edx mode=2775 state=directory
file: path={{venv_dir}} owner=root group=edx mode=2775 state=directory
- name: Install git so that we can clone repos
apt: pkg=git install_recommends=yes state=present
#Create directories for repos
- name: create discern and ease directories and set permissions
file: path={{item}} owner={{remote_user}} group=edx mode=2775 state=directory
file: path={{item}} owner=root group=edx mode=2775 state=directory
with_items:
- ${discern_dir}
- ${ease_dir}
......@@ -44,9 +44,13 @@
#Grab both repos or update
- name: git checkout discern repo into discern_dir
git: dest={{discern_dir}} repo={{discern_source_repo}} version={{discern_branch}}
environment:
GIT_SSH: /tmp/git_ssh.sh
- name: git checkout ease repo into ease_dir
git: dest={{ease_dir}} repo={{ease_source_repo}} version={{ease_branch}}
environment:
GIT_SSH: /tmp/git_ssh.sh
#Install system packages
- name: install discern and ease apt packages
......@@ -76,7 +80,7 @@
shell: command="{{venv_dir}}/bin/python -m nltk.downloader -d {{nltk_data_dir}} all"
- name: set permissions on nltk data directory
file: path={{nltk_data_dir}} owner={{remote_user}} group=edx mode=2775 state=directory
file: path={{nltk_data_dir}} owner=root group=edx mode=2775 state=directory
#Run this instead of using the ansible module because the ansible module only support syncdb of these three, and does not
#support virtualenvs as of this comment
......
......@@ -14,4 +14,4 @@ env DJANGO_SETTINGS_MODULE={{discern_settings}}
chdir {{discern_dir}}
setuid {{remote_user}}
exec {{venv_dir}}/bin/python {{discern_dir}}/manage.py celeryd --loglevel=info --settings={{discern_settings}} --pythonpath={{discern_dir}} -B --autoscale=4,1
exec {{venv_dir}}/bin/python {{discern_dir}}/manage.py celeryd --loglevel=info --settings={{discern_settings}} --pythonpath={{discern_dir}} -B --autoscale={{ ansible_processor_cores * 2 }},1
......@@ -10,8 +10,8 @@ respawn
respawn limit 3 30
env PID=/var/run/gunicorn/discern.pid
env WORKERS=4
env PORT=7999
env WORKERS={{ ansible_processor_cores * 2 }}
env PORT={{ gunicorn_port }}
env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE={{discern_settings}}
......
......@@ -4,7 +4,7 @@ ease_dir: $app_base_dir/ease
discern_dir: $app_base_dir/discern
discern_settings: discern.aws
nltk_data_dir: /usr/share/nltk_data
remote_user: ubuntu
ease_branch: master
discern_branch: dev
nginx_listen_port: 80
\ No newline at end of file
nginx_listen_port: 80
gunicorn_port: 7999
\ 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