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
6cc84722
Commit
6cc84722
authored
Feb 05, 2015
by
Max Rothman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unnecessary files
parent
3b507cf9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
160 deletions
+118
-160
playbooks/roles/analytics-api/handlers/main.yml
+0
-25
playbooks/roles/analytics-api/tasks/deploy.yml
+0
-121
playbooks/roles/analytics-api/tasks/main.yml
+118
-3
playbooks/roles/analytics-api/tasks/tag_ec2.yml
+0
-11
No files found.
playbooks/roles/analytics-api/handlers/main.yml
deleted
100644 → 0
View file @
3b507cf9
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Handlers for role analytics-api
#
# Overview:
#
#
-
name
:
"
restart
the
analytics
service"
supervisorctl_local
:
>
name={{ analytics_api_service_name }}
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
when
:
not disable_edx_services
\ No newline at end of file
playbooks/roles/analytics-api/tasks/deploy.yml
deleted
100644 → 0
View file @
3b507cf9
---
-
name
:
install read-only ssh key
copy
:
>
content="{{ ANALYTICS_API_GIT_IDENTITY }}" dest={{ analytics_api_git_identity_file }}
owner={{ analytics_api_user }} group={{ analytics_api_user }} mode=0600
-
name
:
setup the analytics-api env file
template
:
>
src="edx/app/analytics-api/analytics_api_env.j2"
dest="{{ analytics_api_app_dir }}/analytics_api_env"
owner={{ analytics_api_user }}
group={{ analytics_api_user }}
mode=0644
-
name
:
checkout code
git
:
>
dest={{ analytics_api_code_dir }} repo={{ analytics_api_source_repo }} version={{ ANALYTICS_API_VERSION }}
accept_hostkey=yes
ssh_opts="{{ analytics_api_git_ssh_opts }}"
register
:
analytics_api_code_checkout
notify
:
"
restart
the
analytics
service"
sudo_user
:
"
{{
analytics_api_user
}}"
-
name
:
"
add
gunicorn
configuration
file"
template
:
>
src=edx/app/analytics-api/analytics_api_gunicorn.py.j2
dest={{ analytics_api_app_dir }}/analytics_api_gunicorn.py
sudo_user
:
"
{{
analytics_api_user
}}"
notify
:
"
restart
the
analytics
service"
-
name
:
write out app config file
template
:
>
src=edx/app/analytics-api/analytics-api.yaml.j2
dest={{ COMMON_CFG_DIR }}/{{ analytics_api_service_name }}.yaml
mode=0644 owner={{ analytics_api_user }} group={{ analytics_api_user }}
notify
:
restart the analytics service
-
name
:
install application requirements
pip
:
>
requirements="{{ analytics_api_requirements_base }}/{{ item }}"
virtualenv="{{ analytics_api_venv_dir }}" state=present
sudo_user
:
"
{{
analytics_api_user
}}"
notify
:
restart the analytics service
with_items
:
analytics_api_requirements
-
name
:
migrate
shell
:
>
chdir={{ analytics_api_code_dir }}
DB_MIGRATION_USER={{ COMMON_MYSQL_MIGRATE_USER }}
DB_MIGRATION_PASS={{ COMMON_MYSQL_MIGRATE_PASS }}
{{ analytics_api_venv_bin }}/python ./manage.py migrate --noinput
sudo_user
:
"
{{
analytics_api_user
}}"
environment
:
"
{{
analytics_api_environment
}}"
when
:
migrate_db is defined and migrate_db|lower == "yes"
-
name
:
run collectstatic
shell
:
>
chdir={{ analytics_api_code_dir }}
{{ analytics_api_venv_bin }}/python manage.py collectstatic --noinput
sudo_user
:
"
{{
analytics_api_user
}}"
environment
:
"
{{
analytics_api_environment
}}"
-
name
:
create api users
shell
:
>
chdir={{ analytics_api_code_dir }}
{{ analytics_api_venv_bin }}/python manage.py set_api_key {{ item.key }} {{ item.value }}
sudo_user
:
"
{{
analytics_api_user
}}"
environment
:
"
{{
analytics_api_environment
}}"
with_dict
:
ANALYTICS_API_USERS
-
name
:
write out the supervisior wrapper
template
:
>
src=edx/app/analytics-api/analytics-api.sh.j2
dest={{ analytics_api_app_dir }}/{{ analytics_api_service_name }}.sh
mode=0650 owner={{ supervisor_user }} group={{ common_web_user }}
notify
:
restart the analytics service
-
name
:
write supervisord config
template
:
>
src=edx/app/supervisor/conf.d.available/analytics-api.conf.j2
dest="{{ supervisor_available_dir }}/{{ analytics_api_service_name }}.conf"
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
notify
:
restart the analytics service
-
name
:
enable supervisor script
file
:
>
src={{ supervisor_available_dir }}/{{ analytics_api_service_name }}.conf
dest={{ supervisor_cfg_dir }}/{{ analytics_api_service_name }}.conf
state=link
force=yes
notify
:
restart the analytics service
when
:
not disable_edx_services
-
name
:
update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
when
:
not disable_edx_services
-
name
:
create symlinks from the venv bin dir
file
:
>
src="{{ analytics_api_venv_bin }}/{{ item }}"
dest="{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.analytics-api"
state=link
with_items
:
-
python
-
pip
-
django-admin.py
-
name
:
create symlinks from the repo dir
file
:
>
src="{{ analytics_api_code_dir }}/{{ item }}"
dest="{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.analytics-api"
state=link
with_items
:
-
manage.py
-
name
:
remove read-only ssh key for the content repo
file
:
path={{ analytics_api_git_identity_file }} state=absent
-
include
:
tag_ec2.yml tags=deploy
when
:
COMMON_TAG_EC2_INSTANCE
playbooks/roles/analytics-api/tasks/main.yml
View file @
6cc84722
...
@@ -32,7 +32,122 @@
...
@@ -32,7 +32,122 @@
# ansible-playbook -i 'api.example.com,' ./analyticsapi.yml -e@/ansible/vars/deployment.yml -e@/ansible/vars/env-deployment.yml
# ansible-playbook -i 'api.example.com,' ./analyticsapi.yml -e@/ansible/vars/deployment.yml -e@/ansible/vars/env-deployment.yml
#
#
-
fail
:
msg="You must provide a private key for the analytics repo"
-
name
:
install read-only ssh key
when
:
not ANALYTICS_API_GIT_IDENTITY
copy
:
>
content="{{ ANALYTICS_API_GIT_IDENTITY }}" dest={{ analytics_api_git_identity_file }}
owner={{ analytics_api_user }} group={{ analytics_api_user }} mode=0600
-
include
:
deploy.yml tags=deploy
-
name
:
setup the analytics-api env file
template
:
>
src="edx/app/analytics-api/analytics_api_env.j2"
dest="{{ analytics_api_app_dir }}/analytics_api_env"
owner={{ analytics_api_user }}
group={{ analytics_api_user }}
mode=0644
-
name
:
checkout code
git
:
>
dest={{ analytics_api_code_dir }} repo={{ analytics_api_source_repo }} version={{ ANALYTICS_API_VERSION }}
accept_hostkey=yes
ssh_opts="{{ analytics_api_git_ssh_opts }}"
register
:
analytics_api_code_checkout
notify
:
"
restart
the
analytics
service"
sudo_user
:
"
{{
analytics_api_user
}}"
-
name
:
"
add
gunicorn
configuration
file"
template
:
>
src=edx/app/analytics-api/analytics_api_gunicorn.py.j2
dest={{ analytics_api_app_dir }}/analytics_api_gunicorn.py
sudo_user
:
"
{{
analytics_api_user
}}"
notify
:
"
restart
the
analytics
service"
-
name
:
write out app config file
template
:
>
src=edx/app/analytics-api/analytics-api.yaml.j2
dest={{ COMMON_CFG_DIR }}/{{ analytics_api_service_name }}.yaml
mode=0644 owner={{ analytics_api_user }} group={{ analytics_api_user }}
notify
:
restart the analytics service
-
name
:
install application requirements
pip
:
>
requirements="{{ analytics_api_requirements_base }}/{{ item }}"
virtualenv="{{ analytics_api_venv_dir }}" state=present
sudo_user
:
"
{{
analytics_api_user
}}"
notify
:
restart the analytics service
with_items
:
analytics_api_requirements
-
name
:
migrate
shell
:
>
chdir={{ analytics_api_code_dir }}
DB_MIGRATION_USER={{ COMMON_MYSQL_MIGRATE_USER }}
DB_MIGRATION_PASS={{ COMMON_MYSQL_MIGRATE_PASS }}
{{ analytics_api_venv_bin }}/python ./manage.py migrate --noinput
sudo_user
:
"
{{
analytics_api_user
}}"
environment
:
"
{{
analytics_api_environment
}}"
when
:
migrate_db is defined and migrate_db|lower == "yes"
-
name
:
run collectstatic
shell
:
>
chdir={{ analytics_api_code_dir }}
{{ analytics_api_venv_bin }}/python manage.py collectstatic --noinput
sudo_user
:
"
{{
analytics_api_user
}}"
environment
:
"
{{
analytics_api_environment
}}"
-
name
:
create api users
shell
:
>
chdir={{ analytics_api_code_dir }}
{{ analytics_api_venv_bin }}/python manage.py set_api_key {{ item.key }} {{ item.value }}
sudo_user
:
"
{{
analytics_api_user
}}"
environment
:
"
{{
analytics_api_environment
}}"
with_dict
:
ANALYTICS_API_USERS
-
name
:
write out the supervisior wrapper
template
:
>
src=edx/app/analytics-api/analytics-api.sh.j2
dest={{ analytics_api_app_dir }}/{{ analytics_api_service_name }}.sh
mode=0650 owner={{ supervisor_user }} group={{ common_web_user }}
notify
:
restart the analytics service
-
name
:
write supervisord config
template
:
>
src=edx/app/supervisor/conf.d.available/analytics-api.conf.j2
dest="{{ supervisor_available_dir }}/{{ analytics_api_service_name }}.conf"
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
notify
:
restart the analytics service
-
name
:
enable supervisor script
file
:
>
src={{ supervisor_available_dir }}/{{ analytics_api_service_name }}.conf
dest={{ supervisor_cfg_dir }}/{{ analytics_api_service_name }}.conf
state=link
force=yes
notify
:
restart the analytics service
when
:
not disable_edx_services
-
name
:
update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
when
:
not disable_edx_services
-
name
:
create symlinks from the venv bin dir
file
:
>
src="{{ analytics_api_venv_bin }}/{{ item }}"
dest="{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.analytics-api"
state=link
with_items
:
-
python
-
pip
-
django-admin.py
-
name
:
create symlinks from the repo dir
file
:
>
src="{{ analytics_api_code_dir }}/{{ item }}"
dest="{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.analytics-api"
state=link
with_items
:
-
manage.py
-
name
:
remove read-only ssh key for the content repo
file
:
path={{ analytics_api_git_identity_file }} state=absent
-
include
:
tag_ec2.yml tags=deploy
when
:
COMMON_TAG_EC2_INSTANCE
playbooks/roles/analytics-api/tasks/tag_ec2.yml
deleted
100644 → 0
View file @
3b507cf9
---
-
name
:
get instance information
action
:
ec2_facts
-
name
:
tag instance
ec2_tag
:
resource={{ ansible_ec2_instance_id }} region={{ ansible_ec2_placement_region }}
args
:
tags
:
"
version:analytics_api"
:
"
{{
analytics_api_source_repo
}}
{{
analytics_api_code_checkout.after
|truncate(7,True,'')}}"
when
:
analytics_api_code_checkout.after is defined
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