Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
51845e31
Commit
51845e31
authored
May 02, 2013
by
vik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in some upstart config and update tasks
parent
a90cb43f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
162 additions
and
22 deletions
+162
-22
playbooks/roles/mlapi/tasks/main.yml
+40
-22
playbooks/roles/mlapi/templates/celery.conf.j2
+17
-0
playbooks/roles/mlapi/templates/default.j2
+83
-0
playbooks/roles/mlapi/templates/ml-service-api.conf.j2
+22
-0
No files found.
playbooks/roles/mlapi/tasks/main.yml
View file @
51845e31
...
@@ -19,37 +19,51 @@
...
@@ -19,37 +19,51 @@
-
name
:
Install git so that we can clone repos
-
name
:
Install git so that we can clone repos
apt
:
pkg=git install_recommends=yes state=present
apt
:
pkg=git install_recommends=yes state=present
sudo
:
True
sudo
:
True
-
name
:
create ml api directory and set permissions
-
name
:
create ml api directory and set permissions
file
:
path={{ml_api_dir}} owner={{remote_user}} group=edx mode=2775 state=directory
file
:
path={{ml_api_dir}} owner={{remote_user}} group=edx mode=2775 state=directory
sudo
:
True
sudo
:
True
-
name
:
create machine learning directory and set permissions
-
name
:
create machine learning directory and set permissions
file
:
path={{ml_dir}} owner={{remote_user}} group=edx mode=2775 state=directory
file
:
path={{ml_dir}} owner={{remote_user}} group=edx mode=2775 state=directory
sudo
:
True
sudo
:
True
-
name
:
git checkout ml-service-api repo into $app_base_dir
-
name
:
git checkout ml-service-api repo into $app_base_dir
git
:
dest={{ml_api_dir}} repo={{mlapi_source_repo}}
git
:
dest={{ml_api_dir}} repo={{mlapi_source_repo}}
-
name
:
git checkout machine-learning repo into $app_base_dir
-
name
:
git checkout machine-learning repo into $app_base_dir
git
:
dest={{ml_dir}} repo={{ml_source_repo}}
git
:
dest={{ml_dir}} repo={{ml_source_repo}}
-
name
:
install ml-service-api apt packages
-
name
:
install ml-service-api apt packages
command
:
xargs -a $app_base_dir/ml-service-api/apt-packages.txt apt-get install -y
command
:
xargs -a $app_base_dir/ml-service-api/apt-packages.txt apt-get install -y
sudo
:
yes
sudo
:
yes
-
name
:
install machine-learning apt packages
-
name
:
install machine-learning apt packages
command
:
xargs -a $app_base_dir/machine-learning/apt-packages.txt apt-get install -y
command
:
xargs -a $app_base_dir/machine-learning/apt-packages.txt apt-get install -y
sudo
:
yes
sudo
:
yes
-
name
:
install python pre-requirements for ml-service-api
-
name
:
install python pre-requirements for ml-service-api
pip
:
requirements="{{ml_api_dir}}/pre-requirements.txt" virtualenv="{{venv_dir}}" state=present
pip
:
requirements="{{ml_api_dir}}/pre-requirements.txt" virtualenv="{{venv_dir}}" state=present
-
name
:
install python pre-requirements for machine-learning
-
name
:
install python pre-requirements for machine-learning
pip
:
requirements="{{ml_dir}}/pre-requirements.txt" virtualenv="{{venv_dir}}" state=present
pip
:
requirements="{{ml_dir}}/pre-requirements.txt" virtualenv="{{venv_dir}}" state=present
-
name
:
install python requirements for ml-service-api
-
name
:
install python requirements for ml-service-api
pip
:
requirements="{{ml_api_dir}}/requirements.txt" virtualenv="{{venv_dir}}" state=present
pip
:
requirements="{{ml_api_dir}}/requirements.txt" virtualenv="{{venv_dir}}" state=present
-
name
:
install python requirements for machine-learning
-
name
:
install python requirements for machine-learning
pip
:
requirements="{{ml_dir}}/requirements.txt" virtualenv="{{venv_dir}}" state=present
pip
:
requirements="{{ml_dir}}/requirements.txt" virtualenv="{{venv_dir}}" state=present
-
name
:
render nltk data download shell script from template
-
name
:
render nltk data download shell script from template
template
:
src=install_nltk_data.sh.j2 dest=$app_base_dir/install_nltk_data.sh
template
:
src=install_nltk_data.sh.j2 dest={{ml_dir}}/install_nltk_data.sh
-
name
:
install nltk data using rendered shell script
-
name
:
install nltk data using rendered shell script
action
:
script $app_base_sir/install_nltk_data.sh
action
:
script {{ml_dir}}/install_nltk_data.sh
-
name
:
set permissions on nltk data directory
-
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={{remote_user}} group=edx mode=2775 state=directory
sudo
:
True
sudo
:
True
-
name
:
django syncdb for ml-service-api
-
name
:
django syncdb for ml-service-api
django_manage
:
>
django_manage
:
>
command=syncdb
command=syncdb
...
@@ -57,25 +71,28 @@
...
@@ -57,25 +71,28 @@
settings={{ml_api_settings}}
settings={{ml_api_settings}}
pythonpath={{ml_api_dir}}
pythonpath={{ml_api_dir}}
virtualenv={{venv_dir}}
virtualenv={{venv_dir}}
-
name
:
django migrate for ml-service-api
-
name
:
django migrate for ml-service-api
django_manage
:
>
shell
:
command="{{venv_dir}}/bin/activate; cd {{ml_api_dir}}; python manage.py migrate --noinput --settings={{ml_api_settings}} --pythonpath={{ml_api_dir}}"
command=migrate
app_path={{ml_api_dir}}
-
name
:
django migrate for ml-service-api
settings={{ml_api_settings}}
shell
:
command="{{venv_dir}}/bin/activate; cd {{ml_api_dir}}; python manage.py collectstatic --noinput --settings={{ml_api_settings}} --pythonpath={{ml_api_dir}}"
pythonpath={{ml_api_dir}}
virtualenv={{venv_dir}}
-
name
:
django migrate for ml-service-api
-
name
:
django collectstatic for ml-service-api
shell
:
command="{{venv_dir}}/bin/activate; cd {{ml_api_dir}}; python manage.py update_index --noinput --settings={{ml_api_settings}} --pythonpath={{ml_api_dir}}"
django_manage
:
>
command=collectstatic
-
name
:
render celery service from template
app_path={{ml_api_dir}}
template
:
src=celery.conf.j2 dest=/etc/init/celery.conf
settings={{ml_api_settings}}
sudo
:
True
pythonpath={{ml_api_dir}}
virtualenv={{venv_dir}}
-
name
:
render ml-service-api service from template
-
name
:
django update_index for ml-service-api
template
:
src=ml-service-api.conf.j2 dest=/etc/init/ml-service-api.conf
django_manage
:
>
sudo
:
True
command=update_index
app_path={{ml_api_dir}}
-
name
:
create nginx directory and set perms
settings={{ml_api_settings}}
file
:
path=/etc/nginx/sites-available owner=root group=edx mode=2775 state=directory
pythonpath={{ml_api_dir}}
sudo
:
True
virtualenv={{venv_dir}}
-
name
:
render nginx sites available
template
:
src=default.j2 dest=/etc/nginx/sites-available/default
sudo
:
True
\ No newline at end of file
playbooks/roles/mlapi/templates/celery.conf.j2
0 → 100644
View file @
51845e31
#Celery task for ml api
description "Celery ML api"
author "Vik Paruchuri <vik@edx.org>"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 3 30
env DJANGO_SETTINGS_MODULE={{ml_api_settings}}
chdir {{ml_api_dir}}
setuid {{remote_user}}
exec {{venv_dir}}/bin/python {{ml_api_dir}}/manage.py celeryd --loglevel=info --settings={{ml_api_settings}} --pythonpath={{ml_api_dir}} -B --autoscale=4,1
playbooks/roles/mlapi/templates/default.j2
0 → 100644
View file @
51845e31
server {
listen 80;
server_name {{ml_api_elb_url}};
# https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-files-in-production
location /static/ { # STATIC_URL
alias {{ml_api_dir}}/staticfiles/;
expires 1m;
autoindex on;
}
location /media/ { # MEDIA_URL
alias /home/www/myhostname/static/; # MEDIA_ROOT
expires 30d;
}
location / {
proxy_pass http://127.0.0.1:7999;
}
}
# server {
# #listen 80; ## listen for ipv4; this line is default and implied
# #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
# root /usr/share/nginx/www;
# index index.html index.htm;
# # Make site accessible from http://localhost/
# server_name localhost;
# location / {
# # First attempt to serve request as file, then
# # as directory, then fall back to displaying a 404.
# try_files $uri $uri/ /index.html;
# # Uncomment to enable naxsi on this location
# # include /etc/nginx/naxsi.rules
# }
# location /doc/ {
# alias /usr/share/doc/;
# autoindex on;
# allow 127.0.0.1;
# allow ::1;
# deny all;
# }
# # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
# #location /RequestDenied {
# # proxy_pass http://127.0.0.1:8080;
# #}
# #error_page 404 /404.html;
# # redirect server error pages to the static page /50x.html
# #
# #error_page 500 502 503 504 /50x.html;
# #location = /50x.html {
# # root /usr/share/nginx/www;
# #}
# # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# #
# #location ~ \.php$ {
# # fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# #
# # # With php5-cgi alone:
# # fastcgi_pass 127.0.0.1:9000;
# # # With php5-fpm:
# # fastcgi_pass unix:/var/run/php5-fpm.sock;
# # fastcgi_index index.php;
# # include fastcgi_params;
# #}
# # deny access to .htaccess files, if Apache's document root
# # concurs with nginx's one
# #
# #location ~ /\.ht {
# # deny all;
# #}
# }
playbooks/roles/mlapi/templates/ml-service-api.conf.j2
0 → 100644
View file @
51845e31
# gunicorn
description "ML API Server"
author "Vik Paruchuri <vik@edx.org>"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 3 30
env PID=/var/run/gunicorn/ml-service-api.pid
env WORKERS=4
env PORT=7999
env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE={{ml_api_settings}}
chdir {{ml_api_dir}}
setuid {{remote_user}}
exec {{venv_dir}}/bin/gunicorn --preload -b 127.0.0.1:$PORT -w $WORKERS --timeout=30 --pythonpath={{ml_api_dir}} ml_service_api.wsgi
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment