Commit 38156281 by Fred Smith Committed by GitHub

Merge pull request #3640 from edx/derf/Build_Notes_Docker_OPS-1993

Build Notes Docker OPS-1993
parents cfabf00c f910e514
# To build this Dockerfile:
#
# From the root of configuration:
#
# docker build -f docker/build/notes/Dockerfile .
#
# This allows the dockerfile to update /edx/app/edx_ansible/edx_ansible
# with the currently checked-out configuration repo.
FROM edxops/xenial-common:latest
MAINTAINER edxops
ENV NOTES_VERSION=master
ENV REPO_OWNER=edx
ADD . /edx/app/edx_ansible/edx_ansible
WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays
COPY docker/build/notes/ansible_overrides.yml /
RUN sudo /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook notes.yml \
-c local -i '127.0.0.1,' \
-t 'install,assets,devstack:install' \
--extra-vars="@/ansible_overrides.yml" \
--extra-vars="EDX_NOTES_API_VERSION=$NOTES_VERSION" \
--extra-vars="COMMON_GIT_PATH=$REPO_OWNER"
USER root
CMD ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
---
edx_notes_api_gunicorn_host: 0.0.0.0
EDX_NOTES_API_MYSQL_HOST: 'db'
EDX_NOTES_API_ELASTICSEARCH_URL: 'http://es:9200/'
COMMON_MYSQL_MIGRATE_USER: '{{ EDX_NOTES_API_MYSQL_DB_USER }}'
COMMON_MYSQL_MIGRATE_PASS: '{{ EDX_NOTES_API_MYSQL_DB_PASSWORD }}'
- name: Deploy Notes
hosts: all
sudo: True
gather_facts: True
vars:
serial_count: 1
serial: "{{ serial_count }}"
roles:
- role: nginx
nginx_sites:
- edx_notes_api
- role: edx_notes_api
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
extra_args: "--exists-action w" extra_args: "--exists-action w"
become_user: "{{ edx_notes_api_user }}" become_user: "{{ edx_notes_api_user }}"
with_items: "{{ edx_notes_api_requirements }}" with_items: "{{ edx_notes_api_requirements }}"
tags:
- install
- install:system-requirements
- name: Migrate - name: Migrate
shell: > shell: >
...@@ -64,6 +67,9 @@ ...@@ -64,6 +67,9 @@
environment: environment:
EDXNOTES_CONFIG_ROOT: "{{ COMMON_CFG_DIR }}" EDXNOTES_CONFIG_ROOT: "{{ COMMON_CFG_DIR }}"
when: migrate_db is defined and migrate_db|lower == "yes" when: migrate_db is defined and migrate_db|lower == "yes"
tags:
- migrate
- migrate:db
- name: Write out gunicorn.py - name: Write out gunicorn.py
template: template:
...@@ -73,7 +79,8 @@ ...@@ -73,7 +79,8 @@
group: "{{ common_web_user }}" group: "{{ common_web_user }}"
mode: "0650" mode: "0650"
tags: tags:
- deploy - install
- install:configuration
- name: Write out the supervisor wrapper - name: Write out the supervisor wrapper
template: template:
...@@ -95,7 +102,8 @@ ...@@ -95,7 +102,8 @@
group: "{{ common_web_user }}" group: "{{ common_web_user }}"
mode: "0644" mode: "0644"
tags: tags:
- deploy - install
- install:configuration
- name: Setup the edx_notes_api env file - name: Setup the edx_notes_api env file
template: template:
...@@ -117,13 +125,15 @@ ...@@ -117,13 +125,15 @@
force: yes force: yes
when: not disable_edx_services when: not disable_edx_services
tags: tags:
- deploy - install
- install:configuration
- name: Update supervisor configuration - name: Update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update" shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
when: not disable_edx_services when: not disable_edx_services
tags: tags:
- deploy - manage
- manage:start
- name: Restart supervisor - name: Restart supervisor
supervisorctl: supervisorctl:
...@@ -133,7 +143,8 @@ ...@@ -133,7 +143,8 @@
state: restarted state: restarted
when: not disable_edx_services when: not disable_edx_services
tags: tags:
- deploy - manage
- manage:start
- name: Create symlinks from the venv bin dir - name: Create symlinks from the venv bin dir
file: file:
...@@ -144,12 +155,18 @@ ...@@ -144,12 +155,18 @@
- python - python
- pip - pip
- django-admin.py - django-admin.py
tags:
- install
- install:app-requirements
- name: Create manage.py symlink - name: Create manage.py symlink
file: file:
src: "{{ edx_notes_api_manage }}" src: "{{ edx_notes_api_manage }}"
dest: "{{ COMMON_BIN_DIR }}/manage.{{ edx_notes_api_service_name }}" dest: "{{ COMMON_BIN_DIR }}/manage.{{ edx_notes_api_service_name }}"
state: link state: link
tags:
- install
- install:app-requirements
- name: Restart edx_notes_api - name: Restart edx_notes_api
supervisorctl: supervisorctl:
...@@ -159,3 +176,6 @@ ...@@ -159,3 +176,6 @@
state: restarted state: restarted
when: not disable_edx_services when: not disable_edx_services
become_user: "{{ supervisor_service_user }}" become_user: "{{ supervisor_service_user }}"
tags:
- manage
- manage:start
...@@ -28,3 +28,4 @@ weights: ...@@ -28,3 +28,4 @@ weights:
- docker-tools: 3 - docker-tools: 3
- tools_jenkins: 8 - tools_jenkins: 8
- ecomworker: 4 - ecomworker: 4
- notes: 2
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