Skip to content

Amazon Web Service Guide

Greg Kostin edited this page Mar 28, 2018 · 40 revisions

AMI ID ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20180306 (ami-4e79ed36)

Step 3: Configure Instance Details

Advanced Details

User data (*) As text ( ) As file [ ] Input is already base64 encoded

You can specify user data to configure an instance or run a configuration script during launch. If you launch more than one instance at a time, the user data is available to all the instances in that reservation.

#!/bin/bash

echo "---------------------------------------------------"
echo "                 Start User Root                   "
echo "---------------------------------------------------"
echo "---------------------------------------------------"
echo "                  Update Ubuntu                    "
echo "---------------------------------------------------"
apt-get update
echo "---------------------------------------------------"
echo "                  Upgrade Ubuntu                   "
echo "---------------------------------------------------"
DEBIAN_FRONTEND=noninteractive apt-get --assume-yes --option Dpkg::Options::="--force-confdef" --option Dpkg::Options::="--force-confold" upgrade
echo "---------------------------------------------------"
echo "                 Install Services                  "
echo "---------------------------------------------------"
# apt-get install --assume-yes mysql-server
# mysql_secure_installation
echo "---------------------------------------------------"
echo "                  Start Services                   "
echo "---------------------------------------------------"
# service mysql start
echo "---------------------------------------------------"
echo "             Install Dev Dependencies              "
echo "---------------------------------------------------"
apt-get install --assume-yes build-essential
apt-get install --assume-yes zlib1g-dev
apt-get install --assume-yes clamav
apt-get install --assume-yes git-core
apt-get install --assume-yes default-jdk
apt-get install --assume-yes ruby-dev
echo "---------------------------------------------------"
echo "                Install Bundler                    "
echo "---------------------------------------------------"
gem install bundler
echo "---------------------------------------------------"
echo "                Switch User Ubuntu                 "
echo "---------------------------------------------------"
su ubuntu << 'EOF'
cd /home/ubuntu
echo "---------------------------------------------------"
echo "                 Clone Heliotrope                  "
echo "---------------------------------------------------"
git clone https://github.com/mlibrary/heliotrope.git
echo "---------------------------------------------------"
echo "                 Setup Heliotrope                  "
echo "---------------------------------------------------"
cd heliotrope
bundle install
./bin/bundle exec ./bin/setup
echo "---------------------------------------------------"
echo "                 Configure Heliotrope              "
echo "---------------------------------------------------"
# ./bin/bundle exec ./bin/rails admin
# vi ./config/role_map.yml
echo "---------------------------------------------------"
echo "                 Startup Dev Servers               "
echo "---------------------------------------------------"
fcrepo_wrapper --config .wrap_conf/fcrepo_dev &
solr_wrapper --config .wrap_conf/solr_dev &
echo "---------------------------------------------------"
echo "                 Initialize Heliotrope             "
echo "---------------------------------------------------"
# ./bin/bundle exec ./bin/rails hyrax:default_admin_set:create
echo "---------------------------------------------------"
echo "                 Startup Test Servers              "
echo "---------------------------------------------------"
fcrepo_wrapper --config .wrap_conf/fcrepo_test &
solr_wrapper --config .wrap_conf/solr_test &
echo "---------------------------------------------------"
echo "                 Run Test Suite                    "
echo "---------------------------------------------------"
# ./bin/bundle exec ./bin/rails rubocop
# ./bin/bundle exec ./bin/rails ruumba
# ./bin/bundle exec ./bin/rails lib_spec
# ./bin/bundle exec rspec
EOF