Commit 8e92b6f1 by Edward Zarecor Committed by Kevin Falcone

WIP for upgrading RabbitMQ

Files for building a docker container for rabbitmq

All apt-get over https

New third-party repos

Enforce correct rabbit version installed

Flag rabbit upgrading

Adds the CHECK_RABBIT_VERSION flag (true by default). If true and the
rabbitmq version found differs from the version specified in
RABBITMQ_VERSION, the role fails. If false in the same scenario, the
role continues but does not install rabbitmq (because it's already
installed).

This enables us to continue using this role without forcing us to
upgrade rabbitmq.

Rebase miss

Missed merge conflict marker

syntax and whitespace

latest rabbit.
parent c72e0ef9
FROM edxops/precise-common:latest FROM edxops/precise-common
MAINTAINER edxops MAINTAINER edxops
USER root
ADD . /edx/app/edx_ansible/edx_ansible ADD . /edx/app/edx_ansible/edx_ansible
COPY docker/build/rabbitmq/ansible_overrides.yml /
COPY docker/build/rabbitmq/run_rabbitmq.sh /
RUN chmod +x /run_rabbitmq.sh
WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays
# Role is currently untagged RUN /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook rabbitmq.yml \
RUN /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook rabbitmq.yml -c local \ -i '127.0.0.1,' -c local \
-i '127.0.0.1,' -e@/ansible_overrides.yml
USER rabbitmq WORKDIR /edx/app
# TBD what we want to run rabbit under
EXPOSE 15672 5672 EXPOSE 15672 5672
CMD ["/run_rabbitmq.sh"]
#!/bin/bash
ulimit -n 1024
exec rabbitmq-server $@
\ No newline at end of file
{
"test-pull":
{
"AUTH": [
"lms",
"password"
],
"CONNECTIONS": 2,
"HANDLERS": [
{
"CODEJAIL": {
"name": "demo",
"python_bin": "/edx/app/xqwatcher/venvs/demo/bin/python",
"user": "demo"
},
"HANDLER": "xqueue_watcher.jailedgrader.JailedGrader",
"KWARGS": {
"grader_root": "../data/edx-demo-course/graders/"
}
}
],
"SERVER": "http://xqueue.edx"
}
}
...@@ -108,6 +108,7 @@ common_redhat_pkgs: ...@@ -108,6 +108,7 @@ common_redhat_pkgs:
- unzip - unzip
- acl - acl
common_debian_pkgs: common_debian_pkgs:
- apt-transport-https
- ntp - ntp
- acl - acl
- lynx-cur - lynx-cur
......
#Variables for rabbitmq
--- ---
#
# 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
#
#
# Defaults for role rabbitmq
#
#Setting this to false ensures rabbit will never be upgraded if the wrong version is installed
CHECK_RABBIT_VERSION: true
rabbitmq_app_dir: "{{ COMMON_APP_DIR }}/rabbitmq" rabbitmq_app_dir: "{{ COMMON_APP_DIR }}/rabbitmq"
rabbitmq_data_dir: "{{ COMMON_DATA_DIR }}/rabbitmq" rabbitmq_data_dir: "{{ COMMON_DATA_DIR }}/rabbitmq"
...@@ -31,17 +44,27 @@ RABBITMQ_CLUSTERED_HOSTS: [] ...@@ -31,17 +44,27 @@ RABBITMQ_CLUSTERED_HOSTS: []
# https://www.rabbitmq.com/production-checklist.html # https://www.rabbitmq.com/production-checklist.html
RABBITMQ_VM_MEMORY_HIGH_WATERMARK: 0.4 RABBITMQ_VM_MEMORY_HIGH_WATERMARK: 0.4
RABBITMQ_VERSION: 3.6.6-1
# Internal role variables below this line # Internal role variables below this line
# option to force deletion of the mnesia dir # option to force deletion of the mnesia dir
rabbitmq_refresh: false rabbitmq_refresh: false
extra_repos:
- {repo: "deb https://www.rabbitmq.com/debian/ testing main", key: "https://www.rabbitmq.com/rabbitmq-signing-key-public.asc"}
- {repo: "deb https://packages.erlang-solutions.com/ubuntu precise contrib", key: "https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc"}
# We mirror the deb package for rabbitmq-server because # We mirror the deb package for rabbitmq-server because
# nodes need to be running the same version # nodes need to be running the same version
rabbitmq_pkg_url: "http://files.edx.org/rabbitmq_packages/rabbitmq-server_3.2.3-1_all.deb" rabbitmq_pkg_url: "https://files.edx.org/rabbitmq_packages/rabbitmq-server_{{ RABBITMQ_VERSION }}_all.deb"
rabbitmq_pkg: "rabbitmq-server" rabbitmq_pkg: "rabbitmq-server"
rabbitmq_debian_pkgs: rabbitmq_debian_pkgs:
# why is is this needed?
- python-software-properties - python-software-properties
# erlang dependencies for rabbitmq
- erlang
- erlang-nox
# for installing the deb package with # for installing the deb package with
# dependencies # dependencies
- gdebi - gdebi
......
...@@ -3,7 +3,20 @@ ...@@ -3,7 +3,20 @@
# There is a bug with initializing multiple nodes in the HA cluster at once # There is a bug with initializing multiple nodes in the HA cluster at once
# http://rabbitmq.1065348.n5.nabble.com/Rabbitmq-boot-failure-with-quot-tables-not-present-quot-td24494.html # http://rabbitmq.1065348.n5.nabble.com/Rabbitmq-boot-failure-with-quot-tables-not-present-quot-td24494.html
- name: Install python-software-properties if debian - name: trust extra repositories
apt_key:
url: "{{ item.key }}"
state: present
with_items: "{{ extra_repos }}"
- name: add extra repositories
apt_repository:
repo: "{{ item.repo }}"
state: present
update_cache: yes
with_items: extra_repos
- name: install python-software-properties if debian
apt: apt:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
...@@ -12,17 +25,26 @@ ...@@ -12,17 +25,26 @@
- name: Fetch the rabbitmq server deb - name: Fetch the rabbitmq server deb
get_url: get_url:
url: "{{ rabbitmq_pkg_url }}" url: "{{ rabbitmq_pkg_url }}"
dest: "/var/tmp/{{ rabbitmq_pkg_url | basename }}" dest: "/var/tmp/{{ rabbitmq_pkg_url|basename }}"
# If we don't set pipefail first, `||` will be looking at the exit code of the last command in the pipe
- name: Check if rabbit is installed - name: Check if rabbit is installed
shell: 'dpkg -s rabbitmq-server >/dev/null 2>&1 || echo "not installed"' shell: |
register: is_installed set -o pipefail
dpkg -s rabbitmq-server | grep Version | sed -r 's/.*: (.*)/\1/' || echo 'not installed'
args:
executable: /bin/bash
register: installed_version
- name: Fail if wrong rabbit version is installed
fail: Expected rabbitmq version {{ RABBITMQ_VERSION }}, found {{ installed_version.stdout }}
when: CHECK_RABBIT_VERSION and installed_version.stdout is defined and installed_version.stdout not in [RABBITMQ_VERSION, 'not installed']
- name: Install rabbit package using gdebi - name: Install rabbit package using gdebi
shell: "gdebi --n {{ rabbitmq_pkg_url|basename }}" shell: "gdebi --n {{ rabbitmq_pkg_url|basename }}"
args: args:
chdir: /var/tmp chdir: /var/tmp
when: is_installed.stdout is defined and is_installed.stdout == "not installed" when: installed_version.stdout is defined and installed_version.stdout == "not installed"
- name: Stop rabbit cluster - name: Stop rabbit cluster
service: service:
......
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