Fix bugs introduced from merge with master. (refs #2221)
authorTim Pierce <twp@curoverse.com>
Tue, 11 Mar 2014 17:54:55 +0000 (13:54 -0400)
committerTim Pierce <twp@curoverse.com>
Tue, 11 Mar 2014 17:54:55 +0000 (13:54 -0400)
* build.rb: be smarter about preparing SSH key and building config.yml
* build.sh: correct the check for ruby 1.9.3

* base: CURL and SSL libraries are now prerequisites
* apiserver: compute_node_domain must be set
* workbench: secret_token needs to be installed before rake precompile

docker/api/production.rb.in
docker/base/Dockerfile
docker/build.rb
docker/build.sh
docker/workbench/Dockerfile

index 8d52babc5f19d45c11edda76d09014c2741ca7d2..967d185f47c179b60acc78be994deed8bb233c1c 100644 (file)
@@ -80,7 +80,7 @@ Server::Application.configure do
   # config.compute_node_nameservers = ['1.2.3.4', '1.2.3.5']
   require 'net/http'
   config.compute_node_nameservers = [ '@@ARVADOS_DNS_SERVER@@' ]
-
+  config.compute_node_domain = false
   config.uuid_prefix = '@@API_HOSTNAME@@'
 
   # Authentication stub: hard code pre-approved API tokens.
index a64d007bf6a92092ea321f5a8772fbfb535d4fa4..e20fd0057a9af6a5c94e9949742867282218fd0b 100644 (file)
@@ -11,7 +11,9 @@ ENV DEBIAN_FRONTEND noninteractive
 #   * Arvados source code in /usr/src/arvados, for preseeding gem installation
 
 RUN apt-get update && \
-    apt-get -q -y install -q -y openssh-server apt-utils git curl locales postgresql-server-dev-9.1 && \
+    apt-get -q -y install -q -y openssh-server apt-utils git curl \
+            libcurl3 libcurl3-gnutls libcurl4-openssl-dev locales \
+            postgresql-server-dev-9.1 && \
     /bin/mkdir -p /root/.ssh && \
     /bin/sed -ri 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
     /usr/sbin/locale-gen && \
index cf39da79cbae8051695cd9aea8d7f987c9155a9e..7c5f3c547210619e84d0d42c44c62b03457d6f6e 100755 (executable)
@@ -35,22 +35,20 @@ def docker_ok?
   return system 'docker images > /dev/null 2>&1'
 end
 
-def find_ssh_key key_name
-  # If the user already has a key loaded in their agent, use one of those
-  agent_keys = `ssh-add -l`
-  if agent_keys.empty?
-    # Use a key named arvados_{key_name}_id_rsa, generating
-    # a passphraseless key if necessary.
-    ssh_key_file = "#{ENV['HOME']}/.ssh/arvados_#{key_name}_id_rsa"
-    unless File.exists? ssh_key_file
-      system 'ssh_keygen', '-f', ssh_key_file, '-P', ''
-    end
-  else
-    # choose an agent key at random
-    ssh_key_file = agent_keys.split("\n").first.split[2]
+# find_or_create_ssh_key arvados_name
+#   Return the SSH public key appropriate for this Arvados instance,
+#   generating one if necessary.
+#
+def find_or_create_ssh_key arvados_name
+  ssh_key_file = "#{ENV['HOME']}/.ssh/arvados_#{arvados_name}_id_rsa"
+  unless File.exists? ssh_key_file
+    system 'ssh-keygen',
+           '-f', ssh_key_file,
+           '-C', "arvados@#{arvados_name}",
+           '-P', ''
   end
 
-  return File.exists?("#{ssh_key_file}.pub") ? "#{ssh_key_file}.pub" : nil
+  return "#{ssh_key_file}.pub"
 end
 
 if not ip_forwarding_enabled?
@@ -91,8 +89,8 @@ if not debootstrap_ok?
   sudo '/usr/bin/apt-get', 'install', 'debootstrap'
 end
 
-# Generate a config.yml if it does not exist
-if not File.exists? 'config.yml'
+# Generate a config.yml if it does not exist or is empty
+if not File.size? 'config.yml'
   print "Generating config.yml.\n"
   print "Arvados needs to know the email address of the administrative user,\n"
   print "so that when that user logs in they are automatically made an admin.\n"
@@ -111,7 +109,7 @@ if not File.exists? 'config.yml'
     config = YAML.load_file 'config.yml.example'
     config['API_AUTO_ADMIN_USER'] = admin_email_address
     config['API_HOSTNAME'] = generate_api_hostname
-    config['PUBLIC_KEY_PATH'] = find_ssh_key(config['API_HOSTNAME'])
+    config['PUBLIC_KEY_PATH'] = find_or_create_ssh_key(config['API_HOSTNAME'])
     config.each_key do |var|
       if var.end_with?('_PW') or var.end_with?('_SECRET')
         config[var] = rand(2**256).to_s(36)
index add3194f52ab412dab965e621bdb24832ebec8f7..a6bb5b843ac55fe2a263aa82a53fd0d04cb1d798 100755 (executable)
@@ -1,9 +1,12 @@
 #! /bin/bash
 
 # make sure Ruby 1.9.3 is installed before proceeding
-if ! ruby -v 2>/dev/null | grep '1\.9\.3' > /dev/null
+if ! ruby -e 'exit RUBY_VERSION >= "1.9.3"' 2>/dev/null
 then
-    echo "Installing Ruby. You may be required to enter your password."
+    echo "Installing Arvados requires at least Ruby 1.9.3."
+    echo "You may need to enter your password."
+    read -p "Press Ctrl-C to abort, otherwise we will install ruby1.9.3 now..." unused
+    
     sudo apt-get update
     sudo apt-get -y install ruby1.9.3
 fi
index 0c5c294916ff51218e00203e19a923e203003594..bd0bf4551eb485e418fc31f0da324edee2c347df 100644 (file)
@@ -6,6 +6,10 @@ MAINTAINER Ward Vandewege <ward@curoverse.com>
 # Update Arvados source
 RUN /bin/mkdir -p /usr/src/arvados/apps
 ADD generated/workbench.tar.gz /usr/src/arvados/apps/
+ADD generated/secret_token.rb /usr/src/arvados/apps/workbench/config/initializers/secret_token.rb
+ADD generated/production.rb /usr/src/arvados/apps/workbench/config/environments/production.rb
+ADD passenger.conf /etc/apache2/conf.d/passenger
+
 
 RUN bundle install --gemfile=/usr/src/arvados/apps/workbench/Gemfile && \
     touch /usr/src/arvados/apps/workbench/log/production.log && \
@@ -23,11 +27,6 @@ RUN \
   a2ensite workbench && \
   a2enmod rewrite
 
-# Set up the production environment
-ADD generated/secret_token.rb /usr/src/arvados/apps/workbench/config/initializers/secret_token.rb
-ADD generated/production.rb /usr/src/arvados/apps/workbench/config/environments/production.rb
-ADD passenger.conf /etc/apache2/conf.d/passenger
-
 ADD apache2_foreground.sh /etc/apache2/foreground.sh
 
 # Start Apache