From 023f92f9e3eec7de6c1286549000be79189a4fde Mon Sep 17 00:00:00 2001 From: Thomas Wiest Date: Mon, 15 Dec 2014 16:00:47 -0500 Subject: changed atomic proxy to use pre-built container images --- .../files/proxy_container/Dockerfile | 33 ----------- .../files/proxy_container/ipc-watcher.rb | 67 ---------------------- .../files/proxy_container/start.sh | 35 ----------- .../files/proxy_container/supervisord.conf | 19 ------ 4 files changed, 154 deletions(-) delete mode 100644 roles/docker_img_proxy/files/proxy_container/Dockerfile delete mode 100755 roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb delete mode 100755 roles/docker_img_proxy/files/proxy_container/start.sh delete mode 100644 roles/docker_img_proxy/files/proxy_container/supervisord.conf (limited to 'roles/docker_img_proxy/files') diff --git a/roles/docker_img_proxy/files/proxy_container/Dockerfile b/roles/docker_img_proxy/files/proxy_container/Dockerfile deleted file mode 100644 index 7b5378bb9..000000000 --- a/roles/docker_img_proxy/files/proxy_container/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# This FROM gives us the proper oo-rhui certs, basic runtime env vars, basic repos, etc. -# Otherwise we can't install anything -FROM rhel6ops - -MAINTAINER Thomas Wiest - -RUN yum -y update ; yum clean all - -# Container Specific RPMs -RUN yum -y install rsyslog rhc-server-common httpd mod_security mod_ssl haproxy15 supervisor ruby ruby193-ruby openshift-origin-util-scl ; yum clean all -# this needs to be on it's own line, otherwise the libra_user group isn't setup properly yet -RUN yum -y install rhc-site-static ; yum clean all - -# WORKKAROUND: for a bug in supervisor that causes it to use 100% cpu -RUN yum -y install https://kojipkgs.fedoraproject.org//work/tasks/8506/7818506/supervisor-2.1-9.el6.noarch.rpm ; yum clean all - -# Setup libra_user group with correct members -RUN usermod -a -G libra_user apache - -# Setup libra_ops group for compatibility with host puppet -RUN groupadd libra_ops - -# Setup ctr-ipc dir -RUN ln -s /shared/var/run/ctr-ipc /var/run/ctr-ipc - -# common -ADD supervisord.conf /etc/supervisord.conf -ADD start.sh /usr/local/sbin/start.sh -ADD ipc-watcher.rb /usr/local/sbin/ipc-watcher.rb - -EXPOSE 80 443 4999 - -CMD ["/usr/local/sbin/start.sh"] diff --git a/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb b/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb deleted file mode 100755 index 202a58124..000000000 --- a/roles/docker_img_proxy/files/proxy_container/ipc-watcher.rb +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - -module OpenShift - module Ops - class Notify - def self.puts(msg) - $stdout.puts "#{Time.now}: #{msg}" - end - end - - class WatchForIpcs - IPC_DIR = '/var/run/ctr-ipc' - POLL_INTERVAL = 10 # second - HAPROXY_CONF = '/etc/haproxy/haproxy.cfg' - HAPROXY_PID_FILE = '/var/run/haproxy.pid' - - def self.wait_for_service() - loop do - Dir.glob("#{IPC_DIR}/service/*").each do |svc_file| - svc = File.basename(svc_file) - action = File.read(svc_file) - Notify.puts "Found IPC service file: #{svc}" - Notify.puts " Action requested: #{action}" - - # Make sure we don't handle this multiple times - FileUtils.rm(svc_file) - - handle_service_ipc(svc, action) - end - - sleep POLL_INTERVAL - end - end - - def self.handle_service_ipc(svc, action) - cmd = nil - case svc - when 'httpd' - case action - when 'restart', 'reload' - cmd = "/usr/sbin/apachectl -k graceful" - end - when 'haproxy' - case action - when 'restart' - cmd = "/usr/sbin/haproxy -f #{HAPROXY_CONF} -p #{HAPROXY_PID_FILE} -sf $(/bin/cat #{HAPROXY_PID_FILE})" - end - end - - if cmd.nil? - Notify.puts " Warning: Not handling #{svc} #{action}" - return - end - - Notify.puts " Running: #{cmd}" - output = %x[#{cmd} 2>&1] - Notify.puts " Output: #{output}" - end - end - end -end - -if __FILE__ == $0 - OpenShift::Ops::WatchForIpcs.wait_for_service() -end diff --git a/roles/docker_img_proxy/files/proxy_container/start.sh b/roles/docker_img_proxy/files/proxy_container/start.sh deleted file mode 100755 index 560e1c6be..000000000 --- a/roles/docker_img_proxy/files/proxy_container/start.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -echo _ -for shared_dir in /etc/haproxy /etc/pki /etc/httpd /var/lib/haproxy /usr/local/bin /usr/local/lib -do - echo "Setting up /shared${shared_dir}..." - rm -rf $shared_dir - ln -s /shared${shared_dir} $shared_dir -done -echo _ - -CTR_CONFIG_FLAG='/shared/var/run/ctr-ipc/flag/ctr_configured' -while ! [ -f "$CTR_CONFIG_FLAG" ] -do - echo "Sleeping 10 seconds, waiting for $CTR_CONFIG_FLAG" - sleep 10 -done - -# Fix broken sym links -echo "Fixing symlink /etc/httpd/logs..." -ln -sf /var/log/httpd /shared/etc/httpd/logs - -echo "Fixing symlink /etc/httpd/modules..." -ln -sf /usr/lib64/httpd/modules /shared/etc/httpd/modules - -echo "Fixing symlink /etc/httpd/run..." -ln -sf /var/run/httpd /shared/etc/httpd/run -echo _ - -echo "Starting rsyslog service..." -service rsyslog start -echo _ - -echo "Starting supervisord" -exec /usr/bin/supervisord diff --git a/roles/docker_img_proxy/files/proxy_container/supervisord.conf b/roles/docker_img_proxy/files/proxy_container/supervisord.conf deleted file mode 100644 index 3459d20db..000000000 --- a/roles/docker_img_proxy/files/proxy_container/supervisord.conf +++ /dev/null @@ -1,19 +0,0 @@ -[supervisord] -http_port = 127.0.0.1:9001 -nodaemon=true -pidfile = /var/run/supervisord.pid - -[supervisorctl] -serverurl = http://127.0.0.1:9001 - -[program:haproxy] -command=/bin/bash -c "echo $$ > /var/run/haproxy.pid && exec /usr/sbin/haproxy -db -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid" -priority=1 - -[program:httpd] -command=/bin/bash -c "source /etc/sysconfig/httpd && exec /usr/sbin/httpd -DFOREGROUND" -priority=500 - -[program:ipc-watcher.rb] -command=/bin/bash -c "/usr/local/sbin/ipc-watcher.rb" -priority=999 -- cgit v1.2.3