From 7121eb5ae63754812cc1fc06e3fd70a5678703d4 Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 8 Sep 2014 16:07:09 +0300 Subject: [PATCH 1/5] Added Dockerfile with some small updates --- .dockerignore | 0 Dockerfile | 32 +++++++++++++++++++++ Gemfile | 18 ++++++------ config/database-example.yml | 12 +++++--- config/secrets-example.yml | 2 +- doc/docker/authorized_keys | 1 + lib/tasks/test.rake | 56 +++++++++++++++++++------------------ 7 files changed, 81 insertions(+), 40 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 doc/docker/authorized_keys diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..e69de29bb diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..b80028347 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM gitlab/registry +MAINTAINER Gitlab + +# Set correct environment variables. +ENV HOME /home/app + +# Use baseimage-docker's init process. +CMD ["/sbin/my_init"] + +# App +WORKDIR /home/app/registry +ADD . /home/app/registry +RUN bundle install --deployment + +# Setup nginx +# RUN rm /etc/nginx/sites-enabled/default +# ADD nginx.conf /etc/nginx/sites-enabled/webapp.conf +# RUN rm -f /etc/services/nginx/down + +# RUN rm /etc/nginx/sites-enabled/default +# ADD ./nginx.conf /etc/nginx/sites-enabled/webapp.conf +# RUN rm -f /etc/services/nginx/down + +# Clean up APT when done. +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +## Install an SSH public keys +ADD ./doc/docker/authorized_keys /tmp/authorized_keys +RUN cat /tmp/authorized_keys > /root/.ssh/authorized_keys && rm -f /tmp/authorized_keys + +EXPOSE 80 +EXPOSE 700 diff --git a/Gemfile b/Gemfile index d09f42fd6..d74b2f615 100644 --- a/Gemfile +++ b/Gemfile @@ -76,7 +76,7 @@ group :development do gem 'guard-rubocop', '~> 1.1.0' end -group :development, :test do +group :test do gem 'capybara', '~> 2.4.1' # For feature testing # gem 'capybara-webkit', '1.2.0' # Webkit driver didn't work with turbolinks @@ -86,24 +86,26 @@ group :development, :test do # For cleaning db in feature and epp tests gem 'database_cleaner', '~> 1.3.0' - # EPP client - gem 'epp', '~> 1.4.0' - # Replacement for fixtures gem 'fabrication', '~> 2.11.3' # Library to generate fake data gem 'faker', '~> 1.3.0' - # For debugging - gem 'pry', '~> 0.10.1' - gem 'pry-byebug', '~> 1.3.3' - # Testing framework gem 'rspec-rails', '~> 3.0.2' # Additional matchers for RSpec gem 'shoulda-matchers', '~> 2.6.1', require: false +end + +group :development, :test do + # EPP client + gem 'epp', '~> 1.4.0' + + # For debugging + gem 'pry', '~> 0.10.1' + gem 'pry-byebug', '~> 1.3.3' # For unique IDs (used by the epp gem) gem 'uuidtools', '~> 2.1.4' diff --git a/config/database-example.yml b/config/database-example.yml index 25eeaee5e..37e52ad97 100644 --- a/config/database-example.yml +++ b/config/database-example.yml @@ -3,13 +3,17 @@ default: &default adapter: postgresql encoding: unicode pool: 5 - username: internetee - password: internetee_pwd + username: registry + password: registry_pwd development: <<: *default - database: internetee_development + database: registry_development test: <<: *default - database: internetee_test + database: registry_test + +production: + <<: *default + database: registry_production diff --git a/config/secrets-example.yml b/config/secrets-example.yml index 23fedbe66..9a2adfb5d 100644 --- a/config/secrets-example.yml +++ b/config/secrets-example.yml @@ -5,4 +5,4 @@ test: secret_key_base: generate-your-secret-key-by-rake-secret production: - secret_key_base: + secret_key_base: please-change diff --git a/doc/docker/authorized_keys b/doc/docker/authorized_keys new file mode 100755 index 000000000..99b1e455a --- /dev/null +++ b/doc/docker/authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAz+n4Sln0oxme+9hyrgPud9k0C00Nm0T2YufHcQUAdtJssCfeKp2qo/gy0LmOXTB8efyavFn4NW2GZs8gxJ0BV5GoHLmnERAWDOi/wg3KLl4r/ei+HQX6Po/V7WOMHWzKPSSGtqW7cZc1g0y2ci571ZUmgEBoGoGPfoQToGEn2yV4hQmHIjbwtfNNCHx/i12DCoJnD+3cIvhHf4FbZRBW9Wu0I24iqLcxLOAwGWVsnzi0OqN+rj3DenPQfjcPhSsmTu+8mn2AIwMxWeLZSslEYfyBeo9dLBntj3dnxWpw/MJEfMmWgWKGqMaVGB731ZWDOrRrzgl5+s24YBv9LyYWyQ== diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index cc4a71430..a5999a605 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -1,35 +1,37 @@ -require 'rspec/core/rake_task' -require 'open3' +if Rails.env.test? + require 'rspec/core/rake_task' + require 'open3' -desc 'Run all specs against server' -task 'test' do - test_against_server { Rake::Task['spec'].invoke } -end + desc 'Run all specs against server' + task 'test' do + test_against_server { Rake::Task['spec'].invoke } + end -desc 'Run EPP specs against server' -task 'test:epp' do - test_against_server { Rake::Task['spec:epp'].invoke } -end + desc 'Run EPP specs against server' + task 'test:epp' do + test_against_server { Rake::Task['spec:epp'].invoke } + end -desc 'Run all but EPP specs' -RSpec::Core::RakeTask.new('test:other') do |t| - t.rspec_opts = '--tag ~epp' -end + desc 'Run all but EPP specs' + RSpec::Core::RakeTask.new('test:other') do |t| + t.rspec_opts = '--tag ~epp' + end -desc 'Run all but EPP specs' -RSpec::Core::RakeTask.new('test:all_but_features') do |t| - t.rspec_opts = '--tag ~feature' -end + desc 'Run all but EPP specs' + RSpec::Core::RakeTask.new('test:all_but_features') do |t| + t.rspec_opts = '--tag ~feature' + end -Rake::Task[:default].prerequisites.clear -task default: :test + Rake::Task[:default].prerequisites.clear + task default: :test -def test_against_server - stdin, stdout, stderr, wait_thr = Open3.popen3('unicorn -E test -p 8989') - pid = wait_thr.pid - begin - yield - ensure - `kill #{pid}` + def test_against_server + stdin, stdout, stderr, wait_thr = Open3.popen3('unicorn -E test -p 8989') + pid = wait_thr.pid + begin + yield + ensure + `kill #{pid}` + end end end From 5c430384e278f8e50bc61764cd3b9d0e7a689baf Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Thu, 11 Sep 2014 13:38:19 +0300 Subject: [PATCH 2/5] added phantomjs-binaries, otherwise rake didn't work --- Gemfile | 1 + Gemfile.lock | 288 --------------------------------------------------- 2 files changed, 1 insertion(+), 288 deletions(-) delete mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile index d74b2f615..1552a3153 100644 --- a/Gemfile +++ b/Gemfile @@ -82,6 +82,7 @@ group :test do # gem 'capybara-webkit', '1.2.0' # Webkit driver didn't work with turbolinks gem 'phantomjs', '~> 1.9.7.1', require: 'phantomjs/poltergeist' gem 'poltergeist', '~> 1.5.1' # We are using PhantomJS instead + gem 'phantomjs-binaries', '~> 1.9.2.4' # For cleaning db in feature and epp tests gem 'database_cleaner', '~> 1.3.0' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index cdb0ee83c..000000000 --- a/Gemfile.lock +++ /dev/null @@ -1,288 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.1.4) - actionpack (= 4.1.4) - actionview (= 4.1.4) - mail (~> 2.5.4) - actionpack (4.1.4) - actionview (= 4.1.4) - activesupport (= 4.1.4) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.4) - activesupport (= 4.1.4) - builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.4) - activesupport (= 4.1.4) - builder (~> 3.1) - activerecord (4.1.4) - activemodel (= 4.1.4) - activesupport (= 4.1.4) - arel (~> 5.0.0) - activesupport (4.1.4) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - arel (5.0.1.20140414130214) - ast (2.0.0) - bootstrap-sass (3.2.0.1) - sass (~> 3.2) - builder (3.2.2) - byebug (2.7.0) - columnize (~> 0.3) - debugger-linecache (~> 1.2) - capybara (2.4.1) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - celluloid (0.15.2) - timers (~> 1.1.0) - cliver (0.3.2) - coderay (1.1.0) - coffee-rails (4.0.1) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) - coffee-script (2.2.0) - coffee-script-source - execjs - coffee-script-source (1.7.0) - columnize (0.8.9) - database_cleaner (1.3.0) - debugger-linecache (1.2.0) - diff-lcs (1.2.5) - epp (1.4.0) - hpricot - libxml-ruby - erubis (2.7.0) - execjs (2.2.0) - fabrication (2.11.3) - faker (1.3.0) - i18n (~> 0.5) - ffi (1.9.3) - formatador (0.2.5) - guard (2.6.1) - formatador (>= 0.2.4) - listen (~> 2.7) - lumberjack (~> 1.0) - pry (>= 0.9.12) - thor (>= 0.18.1) - guard-rspec (4.3.1) - guard (~> 2.1) - rspec (>= 2.14, < 4.0) - guard-rubocop (1.1.0) - guard (~> 2.0) - rubocop (~> 0.20) - haml (4.0.5) - tilt - haml-rails (0.5.3) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) - haml (>= 3.1, < 5.0) - railties (>= 4.0.1) - hike (1.2.3) - hpricot (0.8.6) - i18n (0.6.11) - isikukood (0.1.2) - jbuilder (2.1.1) - activesupport (>= 3.0.0, < 5) - multi_json (~> 1.2) - jquery-rails (3.1.0) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.1) - kaminari (0.16.1) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) - kgio (2.9.2) - libv8 (3.16.14.3) - libxml-ruby (2.7.0) - listen (2.7.9) - celluloid (>= 0.15.2) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - lumberjack (1.0.9) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - method_source (0.8.2) - mime-types (1.25.1) - mini_portile (0.6.0) - minitest (5.4.0) - multi_json (1.10.1) - nokogiri (1.6.2.1) - mini_portile (= 0.6.0) - nprogress-rails (0.1.3.1) - parser (2.2.0.pre.4) - ast (>= 1.1, < 3.0) - slop (~> 3.4, >= 3.4.5) - pg (0.17.1) - phantomjs (1.9.7.1) - poltergeist (1.5.1) - capybara (~> 2.1) - cliver (~> 0.3.1) - multi_json (~> 1.0) - websocket-driver (>= 0.2.0) - polyamorous (1.1.0) - activerecord (>= 3.0) - polyglot (0.3.5) - powerpack (0.0.9) - pry (0.10.1) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pry-byebug (1.3.3) - byebug (~> 2.7) - pry (~> 0.10) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rails (4.1.4) - actionmailer (= 4.1.4) - actionpack (= 4.1.4) - actionview (= 4.1.4) - activemodel (= 4.1.4) - activerecord (= 4.1.4) - activesupport (= 4.1.4) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.4) - sprockets-rails (~> 2.0) - railties (4.1.4) - actionpack (= 4.1.4) - activesupport (= 4.1.4) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (2.0.0) - raindrops (0.13.0) - rake (10.3.2) - ransack (1.3.0) - actionpack (>= 3.0) - activerecord (>= 3.0) - activesupport (>= 3.0) - i18n - polyamorous (~> 1.1) - rb-fsevent (0.9.4) - rb-inotify (0.9.5) - ffi (>= 0.5.0) - rdoc (4.1.1) - json (~> 1.4) - ref (1.0.5) - rspec (3.0.0) - rspec-core (~> 3.0.0) - rspec-expectations (~> 3.0.0) - rspec-mocks (~> 3.0.0) - rspec-core (3.0.4) - rspec-support (~> 3.0.0) - rspec-expectations (3.0.4) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.0.0) - rspec-mocks (3.0.4) - rspec-support (~> 3.0.0) - rspec-rails (3.0.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.0.0) - rspec-expectations (~> 3.0.0) - rspec-mocks (~> 3.0.0) - rspec-support (~> 3.0.0) - rspec-support (3.0.4) - rubocop (0.25.0) - parser (>= 2.2.0.pre.4, < 3.0) - powerpack (~> 0.0.6) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.4) - ruby-progressbar (1.5.1) - sass (3.2.19) - sass-rails (4.0.3) - railties (>= 4.0.0, < 5.0) - sass (~> 3.2.0) - sprockets (~> 2.8, <= 2.11.0) - sprockets-rails (~> 2.0) - sdoc (0.4.0) - json (~> 1.8) - rdoc (~> 4.0, < 5.0) - shoulda-matchers (2.6.1) - activesupport (>= 3.0.0) - simpleidn (0.0.5) - slop (3.6.0) - spring (1.1.3) - sprockets (2.11.0) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.1.3) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - therubyracer (0.12.1) - libv8 (~> 3.16.14.0) - ref - thor (0.19.1) - thread_safe (0.3.4) - tilt (1.4.1) - timers (1.1.0) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - turbolinks (2.2.2) - coffee-rails - tzinfo (1.2.2) - thread_safe (~> 0.1) - uglifier (2.5.1) - execjs (>= 0.3.0) - json (>= 1.8.0) - unicorn (4.8.3) - kgio (~> 2.6) - rack - raindrops (~> 0.7) - uuidtools (2.1.4) - websocket-driver (0.3.4) - xpath (2.0.0) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - bootstrap-sass (~> 3.2.0.1) - capybara (~> 2.4.1) - coffee-rails (~> 4.0.0) - database_cleaner (~> 1.3.0) - epp (~> 1.4.0) - fabrication (~> 2.11.3) - faker (~> 1.3.0) - guard (~> 2.6.1) - guard-rspec (~> 4.3.1) - guard-rubocop (~> 1.1.0) - haml-rails (~> 0.5.3) - isikukood - jbuilder (~> 2.0) - jquery-rails - kaminari (~> 0.16.1) - nokogiri (~> 1.6.2.1) - nprogress-rails (~> 0.1.3.1) - pg - phantomjs (~> 1.9.7.1) - poltergeist (~> 1.5.1) - pry (~> 0.10.1) - pry-byebug (~> 1.3.3) - rails (= 4.1.4) - ransack (~> 1.3.0) - rspec-rails (~> 3.0.2) - sass-rails (~> 4.0.3) - sdoc (~> 0.4.0) - shoulda-matchers (~> 2.6.1) - simpleidn (~> 0.0.5) - spring - therubyracer - turbolinks - uglifier (>= 1.3.0) - unicorn - uuidtools (~> 2.1.4) From 39bccc9827717893b980c10341d8698afc51791b Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Thu, 11 Sep 2014 13:44:27 +0300 Subject: [PATCH 3/5] Renamed application name to Registry (befare it was github username Internetee) --- config/application.rb | 2 +- config/initializers/load_validators.rb | 2 +- config/initializers/session_store.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/application.rb b/config/application.rb index d3a18e95b..8e4a6a7c2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,7 +13,7 @@ require 'sprockets/railtie' # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) -module Internetee +module Registry class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers diff --git a/config/initializers/load_validators.rb b/config/initializers/load_validators.rb index 92f534e30..ea84920bf 100644 --- a/config/initializers/load_validators.rb +++ b/config/initializers/load_validators.rb @@ -1 +1 @@ -Internetee::Application.config.autoload_paths += %W(#{Internetee::Application.config.root}/app/validators/) +Registry::Application.config.autoload_paths += %W(#{Registry::Application.config.root}/app/validators/) diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index dbb999454..480996245 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, key: '_internetee_session' +Rails.application.config.session_store :cookie_store, key: '_registry_session' From 47a0fa9b19a8d159325b36c252c6409c6b0d57fa Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Thu, 11 Sep 2014 14:11:56 +0300 Subject: [PATCH 4/5] Reverted Gemfile changes made during Docker implementation --- Gemfile | 21 ++-- Gemfile.lock | 298 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 308 insertions(+), 11 deletions(-) create mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile index 1552a3153..ee2dcaa11 100644 --- a/Gemfile +++ b/Gemfile @@ -76,38 +76,37 @@ group :development do gem 'guard-rubocop', '~> 1.1.0' end -group :test do +group :development, :test do gem 'capybara', '~> 2.4.1' # For feature testing # gem 'capybara-webkit', '1.2.0' # Webkit driver didn't work with turbolinks + gem 'phantomjs-binaries', '~> 1.9.2.4' gem 'phantomjs', '~> 1.9.7.1', require: 'phantomjs/poltergeist' gem 'poltergeist', '~> 1.5.1' # We are using PhantomJS instead - gem 'phantomjs-binaries', '~> 1.9.2.4' # For cleaning db in feature and epp tests gem 'database_cleaner', '~> 1.3.0' + # EPP client + gem 'epp', '~> 1.4.0' + # Replacement for fixtures gem 'fabrication', '~> 2.11.3' # Library to generate fake data gem 'faker', '~> 1.3.0' + # For debugging + gem 'pry', '~> 0.10.1' + gem 'pry-byebug', '~> 1.3.3' + # Testing framework gem 'rspec-rails', '~> 3.0.2' # Additional matchers for RSpec gem 'shoulda-matchers', '~> 2.6.1', require: false -end - -group :development, :test do - # EPP client - gem 'epp', '~> 1.4.0' - - # For debugging - gem 'pry', '~> 0.10.1' - gem 'pry-byebug', '~> 1.3.3' # For unique IDs (used by the epp gem) gem 'uuidtools', '~> 2.1.4' end + diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..c4d3fcffb --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,298 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.1.4) + actionpack (= 4.1.4) + actionview (= 4.1.4) + mail (~> 2.5.4) + actionpack (4.1.4) + actionview (= 4.1.4) + activesupport (= 4.1.4) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + actionview (4.1.4) + activesupport (= 4.1.4) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.4) + activesupport (= 4.1.4) + builder (~> 3.1) + activerecord (4.1.4) + activemodel (= 4.1.4) + activesupport (= 4.1.4) + arel (~> 5.0.0) + activesupport (4.1.4) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.1) + tzinfo (~> 1.1) + arel (5.0.1.20140414130214) + ast (2.0.0) + astrolabe (1.3.0) + parser (>= 2.2.0.pre.3, < 3.0) + bootstrap-sass (3.2.0.2) + sass (~> 3.2) + builder (3.2.2) + byebug (2.7.0) + columnize (~> 0.3) + debugger-linecache (~> 1.2) + capybara (2.4.1) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) + celluloid (0.16.0) + timers (~> 4.0.0) + cliver (0.3.2) + coderay (1.1.0) + coffee-rails (4.0.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.3.0) + coffee-script-source + execjs + coffee-script-source (1.8.0) + columnize (0.8.9) + database_cleaner (1.3.0) + debugger-linecache (1.2.0) + diff-lcs (1.2.5) + epp (1.4.0) + hpricot + libxml-ruby + erubis (2.7.0) + execjs (2.2.1) + fabrication (2.11.3) + faker (1.3.0) + i18n (~> 0.5) + ffi (1.9.3) + formatador (0.2.5) + guard (2.6.1) + formatador (>= 0.2.4) + listen (~> 2.7) + lumberjack (~> 1.0) + pry (>= 0.9.12) + thor (>= 0.18.1) + guard-rspec (4.3.1) + guard (~> 2.1) + rspec (>= 2.14, < 4.0) + guard-rubocop (1.1.0) + guard (~> 2.0) + rubocop (~> 0.20) + haml (4.0.5) + tilt + haml-rails (0.5.3) + actionpack (>= 4.0.1) + activesupport (>= 4.0.1) + haml (>= 3.1, < 5.0) + railties (>= 4.0.1) + hike (1.2.3) + hitimes (1.2.2) + hpricot (0.8.6) + i18n (0.6.11) + isikukood (0.1.2) + jbuilder (2.1.3) + activesupport (>= 3.0.0, < 5) + multi_json (~> 1.2) + jquery-rails (3.1.2) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + json (1.8.1) + kaminari (0.16.1) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) + kgio (2.9.2) + libv8 (3.16.14.5) + libxml-ruby (2.7.0) + listen (2.7.9) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.9) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) + method_source (0.8.2) + mime-types (1.25.1) + mini_portile (0.6.0) + minitest (5.4.1) + multi_json (1.10.1) + nokogiri (1.6.2.1) + mini_portile (= 0.6.0) + nprogress-rails (0.1.3.1) + parser (2.2.0.pre.4) + ast (>= 1.1, < 3.0) + slop (~> 3.4, >= 3.4.5) + pg (0.17.1) + phantomjs (1.9.7.1) + phantomjs-binaries (1.9.2.4) + sys-uname (= 0.9.0) + poltergeist (1.5.1) + capybara (~> 2.1) + cliver (~> 0.3.1) + multi_json (~> 1.0) + websocket-driver (>= 0.2.0) + polyamorous (1.1.0) + activerecord (>= 3.0) + polyglot (0.3.5) + powerpack (0.0.9) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-byebug (1.3.3) + byebug (~> 2.7) + pry (~> 0.10) + rack (1.5.2) + rack-test (0.6.2) + rack (>= 1.0) + rails (4.1.4) + actionmailer (= 4.1.4) + actionpack (= 4.1.4) + actionview (= 4.1.4) + activemodel (= 4.1.4) + activerecord (= 4.1.4) + activesupport (= 4.1.4) + bundler (>= 1.3.0, < 2.0) + railties (= 4.1.4) + sprockets-rails (~> 2.0) + railties (4.1.4) + actionpack (= 4.1.4) + activesupport (= 4.1.4) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rainbow (2.0.0) + raindrops (0.13.0) + rake (10.3.2) + ransack (1.3.0) + actionpack (>= 3.0) + activerecord (>= 3.0) + activesupport (>= 3.0) + i18n + polyamorous (~> 1.1) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + rdoc (4.1.2) + json (~> 1.4) + ref (1.0.5) + rspec (3.0.0) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) + rspec-core (3.0.4) + rspec-support (~> 3.0.0) + rspec-expectations (3.0.4) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.0.0) + rspec-mocks (3.0.4) + rspec-support (~> 3.0.0) + rspec-rails (3.0.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) + rspec-support (~> 3.0.0) + rspec-support (3.0.4) + rubocop (0.26.0) + astrolabe (~> 1.3) + parser (>= 2.2.0.pre.4, < 3.0) + powerpack (~> 0.0.6) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.4) + ruby-progressbar (1.5.1) + sass (3.2.19) + sass-rails (4.0.3) + railties (>= 4.0.0, < 5.0) + sass (~> 3.2.0) + sprockets (~> 2.8, <= 2.11.0) + sprockets-rails (~> 2.0) + sdoc (0.4.1) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + shoulda-matchers (2.6.2) + activesupport (>= 3.0.0) + simpleidn (0.0.5) + slop (3.6.0) + spring (1.1.3) + sprockets (2.11.0) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.1.4) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + sys-uname (0.9.0) + ffi (>= 1.0.0) + therubyracer (0.12.1) + libv8 (~> 3.16.14.0) + ref + thor (0.19.1) + thread_safe (0.3.4) + tilt (1.4.1) + timers (4.0.1) + hitimes + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + turbolinks (2.3.0) + coffee-rails + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (2.5.3) + execjs (>= 0.3.0) + json (>= 1.8.0) + unicorn (4.8.3) + kgio (~> 2.6) + rack + raindrops (~> 0.7) + uuidtools (2.1.5) + websocket-driver (0.3.4) + xpath (2.0.0) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + bootstrap-sass (~> 3.2.0.1) + capybara (~> 2.4.1) + coffee-rails (~> 4.0.0) + database_cleaner (~> 1.3.0) + epp (~> 1.4.0) + fabrication (~> 2.11.3) + faker (~> 1.3.0) + guard (~> 2.6.1) + guard-rspec (~> 4.3.1) + guard-rubocop (~> 1.1.0) + haml-rails (~> 0.5.3) + isikukood + jbuilder (~> 2.0) + jquery-rails + kaminari (~> 0.16.1) + nokogiri (~> 1.6.2.1) + nprogress-rails (~> 0.1.3.1) + pg + phantomjs (~> 1.9.7.1) + phantomjs-binaries (~> 1.9.2.4) + poltergeist (~> 1.5.1) + pry (~> 0.10.1) + pry-byebug (~> 1.3.3) + rails (= 4.1.4) + ransack (~> 1.3.0) + rspec-rails (~> 3.0.2) + sass-rails (~> 4.0.3) + sdoc (~> 0.4.0) + shoulda-matchers (~> 2.6.1) + simpleidn (~> 0.0.5) + spring + therubyracer + turbolinks + uglifier (>= 1.3.0) + unicorn + uuidtools (~> 2.1.4) From bea6faac9fdbc0946309f59b62b66ce10d39cbdf Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Mon, 22 Sep 2014 09:14:34 +0300 Subject: [PATCH 5/5] Docker: added keys and config files --- Dockerfile | 53 +++++++++++++++++---------- doc/docker/apache2/epp-tester.conf | 18 +++++++++ doc/docker/apache2/epp.conf | 21 +++++++++++ doc/docker/apache2/registry-test.conf | 39 ++++++++++++++++++++ doc/docker/apache2/registry.conf | 17 +++++++++ doc/docker/authorized_keys | 1 - doc/docker/ssh/authorized_keys | 3 ++ 7 files changed, 131 insertions(+), 21 deletions(-) create mode 100644 doc/docker/apache2/epp-tester.conf create mode 100644 doc/docker/apache2/epp.conf create mode 100644 doc/docker/apache2/registry-test.conf create mode 100644 doc/docker/apache2/registry.conf delete mode 100755 doc/docker/authorized_keys create mode 100755 doc/docker/ssh/authorized_keys diff --git a/Dockerfile b/Dockerfile index b80028347..90bb41594 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,45 @@ -FROM gitlab/registry +# FROM gitlab/registry +FROM slimmed MAINTAINER Gitlab -# Set correct environment variables. -ENV HOME /home/app +# Initial build +# SSH authorized keys setup +# ADD ./doc/docker/ssh/authorized_keys /root/.ssh/authorized_keys +# +# Apache2 setup +# ADD ./doc/docker/apache2/ /etc/apache2/sites-enabled # Use baseimage-docker's init process. CMD ["/sbin/my_init"] -# App +# Set correct environment variables. +ENV RAILS_ENV production +ENV HOME /home/app + +# Registry WORKDIR /home/app/registry ADD . /home/app/registry -RUN bundle install --deployment +RUN chown -R app:www-data .; chmod -R 750 .; chmod g+s .; umask 027 +RUN setuser app ls -la /home/app/registry/vendor/ +# RUN setuser app ls -la /home/app/registry/vendor/bundle +RUN rm /home/app/registry/vendor/bundle -rf +RUN setuser app bundle install --deployment +RUN setuser app rake assets:precompile -# Setup nginx -# RUN rm /etc/nginx/sites-enabled/default -# ADD nginx.conf /etc/nginx/sites-enabled/webapp.conf -# RUN rm -f /etc/services/nginx/down +# Registry test +WORKDIR /home/app/registry-test +ADD . /home/app/registry-test +RUN chown -R app:www-data .; chmod -R 750 .; chmod g+s .; umask 027 +RUN setuser app bundle install -# RUN rm /etc/nginx/sites-enabled/default -# ADD ./nginx.conf /etc/nginx/sites-enabled/webapp.conf -# RUN rm -f /etc/services/nginx/down +# Ports +# Registry admin: +EXPOSE 80 +# EPP: +EXPOSE 700 +# Test env what jenkins uses +# for debugging only: +# EXPOSE 81 -# Clean up APT when done. +# Clean up when done. RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -## Install an SSH public keys -ADD ./doc/docker/authorized_keys /tmp/authorized_keys -RUN cat /tmp/authorized_keys > /root/.ssh/authorized_keys && rm -f /tmp/authorized_keys - -EXPOSE 80 -EXPOSE 700 diff --git a/doc/docker/apache2/epp-tester.conf b/doc/docker/apache2/epp-tester.conf new file mode 100644 index 000000000..e3a428734 --- /dev/null +++ b/doc/docker/apache2/epp-tester.conf @@ -0,0 +1,18 @@ +Listen 8888 + + ServerName registry.gitlab.eu + ServerAdmin info@gitlab.eu + + PassengerEnabled on + RailsEnv production + DocumentRoot /home/app/epp-tester/public + + ErrorLog /var/log/apache2/epp-tester.error.log + LogLevel info ssl:warn + CustomLog /var/log/apache2/epp-tester.access.log combined + + + Require all granted + Options -MultiViews + + diff --git a/doc/docker/apache2/epp.conf b/doc/docker/apache2/epp.conf new file mode 100644 index 000000000..33ef057aa --- /dev/null +++ b/doc/docker/apache2/epp.conf @@ -0,0 +1,21 @@ + + Listen 700 + + SSLEngine on + SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL + SSLCertificateFile /etc/apache2/ssl/apache.crt + SSLCertificateKeyFile /etc/apache2/ssl/apache.key + + SSLVerifyClient optional_no_ca + + EPPEngine On + EPPCommandRoot /proxy/command + EPPSessionRoot /proxy/session + EPPErrorRoot /proxy/error + + ProxyPass /proxy/ http://localhost:80/epp/ + + EPPAuthURI implicit + EPPReturncodeHeader X-EPP-Returncode + + diff --git a/doc/docker/apache2/registry-test.conf b/doc/docker/apache2/registry-test.conf new file mode 100644 index 000000000..dc4b0cc26 --- /dev/null +++ b/doc/docker/apache2/registry-test.conf @@ -0,0 +1,39 @@ +Listen 81 + + ServerAdmin info@gitlab.eu + + PassengerEnabled on + RailsEnv test + DocumentRoot /home/app/registry-test/public + + ErrorLog /var/log/apache2/registry-test.error.log + LogLevel info ssl:warn + CustomLog /var/log/apache2/registry-test.access.log combined + + + Require all granted + Options -MultiViews + + + + + Listen 701 + + SSLEngine on + SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL + SSLCertificateFile /etc/apache2/ssl/apache.crt + SSLCertificateKeyFile /etc/apache2/ssl/apache.key + + SSLVerifyClient optional_no_ca + + EPPEngine On + EPPCommandRoot /proxy/command + EPPSessionRoot /proxy/session + EPPErrorRoot /proxy/error + + ProxyPass /proxy/ http://localhost:81/epp/ + + EPPAuthURI implicit + EPPReturncodeHeader X-EPP-Returncode + + diff --git a/doc/docker/apache2/registry.conf b/doc/docker/apache2/registry.conf new file mode 100644 index 000000000..938a23602 --- /dev/null +++ b/doc/docker/apache2/registry.conf @@ -0,0 +1,17 @@ + + ServerName registry.gitlab.eu + ServerAdmin info@gitlab.eu + + PassengerEnabled on + RailsEnv production + DocumentRoot /home/app/registry/public + + ErrorLog /var/log/apache2/registry.error.log + LogLevel info ssl:warn + CustomLog /var/log/apache2/registry.access.log combined + + + Require all granted + Options -MultiViews + + diff --git a/doc/docker/authorized_keys b/doc/docker/authorized_keys deleted file mode 100755 index 99b1e455a..000000000 --- a/doc/docker/authorized_keys +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAz+n4Sln0oxme+9hyrgPud9k0C00Nm0T2YufHcQUAdtJssCfeKp2qo/gy0LmOXTB8efyavFn4NW2GZs8gxJ0BV5GoHLmnERAWDOi/wg3KLl4r/ei+HQX6Po/V7WOMHWzKPSSGtqW7cZc1g0y2ci571ZUmgEBoGoGPfoQToGEn2yV4hQmHIjbwtfNNCHx/i12DCoJnD+3cIvhHf4FbZRBW9Wu0I24iqLcxLOAwGWVsnzi0OqN+rj3DenPQfjcPhSsmTu+8mn2AIwMxWeLZSslEYfyBeo9dLBntj3dnxWpw/MJEfMmWgWKGqMaVGB731ZWDOrRrzgl5+s24YBv9LyYWyQ== diff --git a/doc/docker/ssh/authorized_keys b/doc/docker/ssh/authorized_keys new file mode 100755 index 000000000..9266ca452 --- /dev/null +++ b/doc/docker/ssh/authorized_keys @@ -0,0 +1,3 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAz+n4Sln0oxme+9hyrgPud9k0C00Nm0T2YufHcQUAdtJssCfeKp2qo/gy0LmOXTB8efyavFn4NW2GZs8gxJ0BV5GoHLmnERAWDOi/wg3KLl4r/ei+HQX6Po/V7WOMHWzKPSSGtqW7cZc1g0y2ci571ZUmgEBoGoGPfoQToGEn2yV4hQmHIjbwtfNNCHx/i12DCoJnD+3cIvhHf4FbZRBW9Wu0I24iqLcxLOAwGWVsnzi0OqN+rj3DenPQfjcPhSsmTu+8mn2AIwMxWeLZSslEYfyBeo9dLBntj3dnxWpw/MJEfMmWgWKGqMaVGB731ZWDOrRrzgl5+s24YBv9LyYWyQ== +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXF8qkkQg8We6c2eCRQTuQUAffuDcYijlnVNAH0V7eUMxKC/9aPIhHaM9JVY4exXDVEQOK0+KsF6twTtewK8XBFfHXcOV3k+11KOJ1LsfphQIbwS9Qufw2maxCWJHxQwKGViGLqePuecQhfQ3UAVXZ1ZO7qGrLB9JBlRimbItJsG3F2o1T7pJAMucf+zCv5KmMeeddDyhAg2ufQHnuPKIMAgr4XH/TD4mg5tqORXCdk/2apuqUz35WqAyRNt/J66bTJOJ39QJv50cyT6/Bb74MNfJSejsM5EUnKF4Nq7edR8F8tlnXmL/wvvVs81oHywCnMqP8eEISLumy1nhNpgbn martin@gitlab.eu +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC13V94raEKiCzg4sACsIFxiHPcRSUryUHxXpcyHMi7OJvTtszOPR3hZnB36c0NxnznD0t3rH2n5vIX+tBmX+JND7bvM+YKgTGcGN+HvS08nSsvwHLie/UAHkWy/4xFvyKnq8MIZtYxkPdIGph6hFMr5LljJu05V08hZF09HutBsjXw5wmZRUJoD/Jl0FO/pf6WxH1VHjhz0kGuM8VREU2SC8uzV1AIZ86zsaxJld1m0doyt+arnJkPYgjXHHpu/IWzIHYjbVo5W8JmYagDCYxaPHN7EesHAEzFi1LDtq1aIrqWrczKaJGSryxSba6pnYiK69MTojF/SAXMsJ1u5q1P andres.kesk@gmail.com