From 28cfd156f9ad154451523ddee4625e97159080ed Mon Sep 17 00:00:00 2001 From: Michael Kefeder Date: Wed, 25 May 2016 18:52:18 +0200 Subject: [PATCH 1/5] only use REDIS_URL environment variable, easier to use --- qless.ru | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qless.ru b/qless.ru index bac7a42..6618757 100644 --- a/qless.ru +++ b/qless.ru @@ -1,7 +1,8 @@ require 'qless' require 'qless/server' -client = Qless::Client.new(:host => ENV['REDIS_HOST'], :port => ENV['REDIS_PORT'].to_i, :db => ENV['DB_NUM'].to_i ) +# use REDIS_URL="redis://some-host:7000/3" +client = Qless::Client.new QlessServer = Rack::Builder.app do if ENV['QLESS_BASIC_AUTH_USER'] && ENV['QLESS_BASIC_AUTH_PASSWORD'] @@ -10,7 +11,12 @@ QlessServer = Rack::Builder.app do end end - map(ENV['HTTP_PATH']) { run Qless::Server.new(client) } + gui_path = '/qless' + if ENV['HTTP_PATH'] + gui_path = ENV['HTTP_PATH'] + end + + map(gui_path) { run Qless::Server.new(client) } end run QlessServer From b1dd846d25dfd79d96c409e96fb0e130740a55ef Mon Sep 17 00:00:00 2001 From: Michael Kefeder Date: Wed, 25 May 2016 18:52:48 +0200 Subject: [PATCH 2/5] based on debian for smaller docker image, no ppa needed, patch to load jquery from local file not from CDN --- Dockerfile | 22 +++++++++++++--------- local_js.patch | 13 +++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 local_js.patch diff --git a/Dockerfile b/Dockerfile index f316955..50c4cad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM ubuntu:14.04 +# direct debian works too but is bigger by 40MiB +#FROM debian:jessie +FROM philcryer/min-jessie # Prevent docker's default encoding of ASCII. # # https://oncletom.io/2015/docker-encoding/ @@ -6,17 +8,19 @@ ENV LANG C.UTF-8 ENV LANGUAGE en_US:C ENV LC_ALL C.UTF-8 -# PPA for Ruby 2.1 -RUN apt-get update -RUN apt-get install -y python3-software-properties software-properties-common -RUN add-apt-repository ppa:chris-lea/redis-server -RUN apt-add-repository ppa:brightbox/ruby-ng -RUN apt-get update -RUN apt-get install -y ruby2.1 redis-tools git +RUN echo "deb http://ftp.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list && \ + apt-get update && \ + apt-get install -y ruby2.1 git curl && \ + apt-get install -t jessie-backports -y redis-tools && \ + rm -rf /var/lib/apt/lists/* -RUN gem install bundler +RUN gem2.1 install bundler ADD . /qless WORKDIR /qless RUN bundle install + +# make jquery local +RUN curl -o "$(find /var/lib/gems/ -wholename */lib/qless/server/static/js -type d)/jquery.min.js" https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js && \ + patch -d "$(find /var/lib/gems/ -wholename */lib/qless/server -type d)" -p4 < /qless/local_js.patch diff --git a/local_js.patch b/local_js.patch new file mode 100644 index 0000000..2e8b18d --- /dev/null +++ b/local_js.patch @@ -0,0 +1,13 @@ +diff --git a/lib/qless/server/views/layout.erb b/lib/qless/server/views/layout.erb +index cb41fb6..9ac8747 100644 +--- a/lib/qless/server/views/layout.erb ++++ b/lib/qless/server/views/layout.erb +@@ -12,7 +12,7 @@ + + + +- ++ + +