Commit 7ead4597 by Edward Zarecor

hacking to get consul running in docker-compose

parent b2d65772
FROM edxops/precise-common:v2
MAINTAINER edxops
USER docker
RUN sudo apt-get update
WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays
RUN sudo ansible-playbook consul.yml -c local -t 'install:base,install:configuration'
USER root
#CMD ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
#CMD ["./consul agent -data-dir /tmp/consul -config-dir ./consul-config -client 172.19.0.6 -join edx_node1_1.edx"]
EXPOSE 18080
- name: Deploy forum
hosts: all
sudo: True
gather_facts: True
vars:
serial_count: 1
serial: "{{ serial_count }}"
roles:
- docker
- supervisor
- supervised_rsyslogd
- consul
\ No newline at end of file
---
#
# 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 consul
#
#
# vars are namespaced with the module name.
#
CONSUL_VERSION: "0.5.2"
CONSUL_ARCHITECTURE: "linux_amd64"
# Specify whether we're running in client or server mode
CONSUL_MODE: "client"
CONSUL_CLIENT: "0.0.0.0"
CONSUL_SERVER: "edx_node1_1.edx"
consul_role_name: consul
consul_app_dir: "{{ COMMON_APP_DIR }}/{{ consul_role_name }}"
consul_data_dir: "{{ COMMON_DATA_DIR }}/{{ consul_role_name }}"
consul_config_dir: "{{ COMMON_CFG_DIR }}/{{ consul_role_name }}"
consul_file: "consul_{{ CONSUL_VERSION }}_{{ CONSUL_ARCHITECTURE }}.zip"
consul_url: "https://releases.hashicorp.com/consul/{{ CONSUL_VERSION }}/{{ consul_file }}"
# Sig verified prior to additon
checksums:
darwin_amd64: 87be515d7dbab760a61a359626a734f738d46ece367f68422b7dec9197d9eeea
linux_386: 29306ce398109f954ceeea3af79878be4fb0d949f8af3a27c95ccef2101e8f60
linux_amd64: 171cf4074bfca3b1e46112105738985783f19c47f4408377241b868affa9d445
web_ui: ad883aa52e1c0136ab1492bbcedad1210235f26d59719fb6de3ef6464f1ff3b1
windows_386: 2e866812de16f1a6138a0fd1eebc76143f1314826e3b52597a55ac510ae94be6
services:
# needed for expected JSON format
- service:
name: "test_service"
tags:
- consul_managed
- test
port: 22
check:
script: "/bin/true"
interval: "10s"
#
# OS packages
#
consul_debian_pkgs: []
consul_redhat_pkgs: []
---
#
# 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
#
##
# Role includes for role consul
#
# Example:
#
# dependencies:
# - {
# role: my_role
# my_role_var0: "foo"
# my_role_var1: "bar"
# }
---
#
# 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
#
#
#
# Tasks for role consul
#
# Overview:
#
#
# Dependencies:
#
#
# Example play:
#
#
- name: Create target directory
file: >
path="{{ item }}"
state="directory"
owner={{ supervisor_user }}
group={{ common_web_user }}
mode="0770"
tags:
- install
- install:base
with_items:
- "{{consul_app_dir }}"
- "{{consul_data_dir }}"
- "{{consul_config_dir }}"
- "{{consul_config_dir }}/consul.d/"
- name: Download the Consul binary distrubution
get_url: >
url="{{ consul_url }}"
dest="{{ consul_app_dir }}/{{ consul_file }}"
mode=0440
sha256sum="{{ checksums.linux_amd64 }}"
tags:
- install
- install:base
- name: Unzip the archive
unarchive: >
src="{{ consul_app_dir }}/{{ consul_file }}"
dest="{{ consul_app_dir }}"
tags:
- install
- install:base
- name: Create supervisor script
template: >
src=edx/app/supervisor/conf.available.d/consul.conf.j2
dest={{ supervisor_available_dir }}/consul.conf
owner={{ supervisor_user }}
group={{ common_web_user }}
mode=0644
tags:
- install
- install:configuration
- name: Enable supervisor script
file: >
src={{ supervisor_available_dir }}/consul.conf
dest={{ supervisor_cfg_dir }}/consul.conf
owner={{ supervisor_user }}
group={{ common_web_user }}
mode=0644
state=link
force=yes
tags:
- install
- install:configuration
[program:consul]
command={{ consul_app_dir }}/consul agent -data-dir {{ consul_data_dir }} -config-dir {{ consul_config_dir }} -client {{ CONSUL_CLIENT }} -join {{ CONSUL_SERVER }}
priority=999
user={{ common_web_user }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
stopasgroup=true
stopsignal=QUIT
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