# * 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 && \
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?
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"
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)
#! /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
# 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 && \
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