Created
July 25, 2012 19:50
Aeolus Conductor Development Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Use this script to install everything *system-wide* (as opposed to using | |
# bundler) to enable development. For example, ruby, rails, deltacloud, | |
# imagefactory, postgres, etc. | |
# | |
# Note: this works well for Fedora 16 and 17. For RHEL 6, some of the | |
# the dependencies may need to be manually downloaded and installed | |
# (e.g., rubygem-paranoia) | |
yum install -y postgresql-server postgresql postgresql-devel ruby ruby-devel ruby-rdoc rubygems-devel git libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel gcc gcc-c++ make | |
# The following list created from | |
# grep Requires aeolus-conductor.spec.in | grep -v aeolus | grep -v 'Requires(' | grep -v '%' | perl -p -e 's/^(Build)?Requires\: (.*)$/$2/' | perl -p -e "s/^(.*)\$/\'\$1\' \\\\/" | sort | uniq | |
for i in 'curl' \ | |
'deltacloud-core' \ | |
'deltacloud-core-ec2' \ | |
'deltacloud-core-rhevm' \ | |
'deltacloud-core-vsphere' \ | |
'httpd >= 2.0' \ | |
'imagefactory' \ | |
'imagefactory-jeosconf-ec2-fedora' \ | |
'imagefactory-jeosconf-ec2-rhel' \ | |
'iwhd' \ | |
'mod_ssl' \ | |
'mongodb-server' \ | |
'ntp' \ | |
'postgresql' \ | |
'postgresql-server' \ | |
'rsyslog-relp' \ | |
'rubygem(builder)' \ | |
'rubygem(capybara) >= 1.0.0' \ | |
'rubygem(compass) >= 0.11.5' \ | |
'rubygem(compass-960-plugin) >= 0.10.4' \ | |
'rubygem(cucumber)' \ | |
'rubygem(cucumber-rails)' \ | |
'rubygem(database_cleaner) >= 0.5.0' \ | |
'rubygem(delayed_job) >= 2.1.4' \ | |
'rubygem(deltacloud-client) >= 0.4.0' \ | |
'rubygem(factory_girl)' \ | |
'rubygem(factory_girl_rails)' \ | |
'rubygem(fastercsv)' \ | |
'rubygem(haml) >= 3.1' \ | |
'rubygem(json)' \ | |
'rubygem(launchy)' \ | |
'rubygem(ldap_fluff)' \ | |
'rubygem(minitest)' \ | |
'rubygem(mustache) >= 0.99.4' \ | |
'rubygem(net-ldap)' \ | |
'rubygem(nokogiri) >= 1.4.0' \ | |
'rubygem(oauth)' \ | |
'rubygem(paranoia)' \ | |
'rubygem(pg)' \ | |
'rubygem(rack-restful_submit)' \ | |
'rubygem(rails) >= 3.0.7' \ | |
'rubygem(rails_warden)' \ | |
'rubygem(rake)' \ | |
'rubygem(rest-client) >= 1.6.1' \ | |
'rubygem(rspec-rails) >= 2.6.1' \ | |
'rubygem(ruby-net-ldap)' \ | |
'rubygem(sass)' \ | |
'rubygem(simple-navigation)' \ | |
'rubygem(thin) >= 1.2.5' \ | |
'rubygem(timecop)' \ | |
'rubygem(uuidtools)' \ | |
'rubygem(vcr)' \ | |
'rubygem(webmock)' \ | |
'rubygem(will_paginate) >= 3.0' \ | |
'systemd-units' \ | |
'system-logos' ; do | |
yum -y install "$i" | |
done | |
# If you need the ldap_fluff rpm, here is one place it exists for now: | |
# http://repos.fedorapeople.org/repos/katello/katello/6Server/x86_64/ | |
# e.g.: | |
# yum install http://repos.fedorapeople.org/repos/katello/katello/6Server/x86_64/rubygem-ldap_fluff-0.1.1-1.git.2.80fbc67.el6.noarch.rpm http://repos.fedorapeople.org/repos/katello/katello/6Server/x86_64/rubygem-net-ldap-0.1.1-2.el6.noarch.rpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Install required libraries, prepare postgres, set up a user for | |
# aeolus development. This script should be run as root. | |
# change this to the system user you are going to use for development | |
dev_username=test | |
os=unsupported | |
if `grep -qs 'Red Hat Enterprise Linux Server release 6' /etc/redhat-release`; then | |
os=rhel6 | |
fi | |
if `grep -qs -P 'Fedora release 1[67]' /etc/fedora-release`; then | |
os=fc | |
fi | |
if [ "$os" == "unsupported" ]; then | |
echo This script has not been tested outside of RHEL6, FC16 and FC17. | |
echo You will need to install development libraries and set up | |
echo postgres manually. | |
exit 1 | |
fi | |
# install needed dependencies | |
yum install -y postgresql-server postgresql postgresql-devel ruby ruby-devel ruby-rdoc git libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel gcc gcc-c++ | |
# install gem and bundler if we need to | |
which gem >/dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
echo "Downloading and installing gem and bundler" | |
mkdir -p /tmp/gem-install | |
cd /tmp/gem-install | |
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz | |
tar -xzf rubygems-1.8.24.tgz | |
cd rubygems* | |
ruby setup.rb | |
fi | |
which bundle >/dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
# install bundler | |
gem install bundler | |
fi | |
# set up postgres | |
# hint: if previous postgres db exists, rm -rf /var/lib/pgsql/data | |
if [ "$os" == "rhel6" ]; then | |
service postgresql initdb | |
else | |
postgresql-setup initdb | |
fi | |
echo 'local all all trust' > /var/lib/pgsql/data/pg_hba.conf | |
echo 'host all all 127.0.0.1/32 trust' >> /var/lib/pgsql/data/pg_hba.conf | |
echo 'host all all ::1/128 trust' >> /var/lib/pgsql/data/pg_hba.conf | |
chown postgres.postgres /var/lib/pgsql/data/pg_hba.conf | |
chmod go-rw /var/lib/pgsql/data/pg_hba.conf | |
if [ "$os" == "rhel6" ]; then | |
service postgresql start | |
else | |
systemctl start postgresql.service | |
fi | |
su - postgres -c "psql -c \"CREATE USER $dev_username WITH PASSWORD 'v23zj59an';\"" | |
su - postgres -c "psql -c \"alter user $dev_username CREATEDB;\"" | |
if [ "$dev_username" == "aeolus" ]; then | |
# add aeolus user and group if needed (need to cp -r /etc/skel to avoid | |
# selinux issue) | |
cp -r /etc/skel /usr/share/aeolus-conductor | |
/usr/sbin/groupadd -g 180 -r aeolus 2>/dev/null | |
/usr/sbin/useradd -u 180 -g aeolus -m -d /usr/share/aeolus-conductor aeolus 2>/dev/null | |
chown aeolus:aeolus /usr/share/aeolus-conductor | |
else | |
useradd $dev_username 2>/dev/null | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Run this as the user you want to develop with, i.e. whatever | |
# $dev_username was in conductor-dev-root-prep.sh. | |
here=`pwd` | |
WORKDIR="$here/w1" | |
this_user=`whoami` | |
using_bundler=yes | |
if [ "$using_bundler" == "yes" ]; then | |
rake_prefix='bundle exec' | |
else | |
rake_prefix='' | |
fi | |
mkdir -p $WORKDIR | |
cd $WORKDIR | |
git clone git://github.com/aeolusproject/conductor.git | |
cd $WORKDIR/conductor | |
git submodule init | |
git submodule update | |
cd $WORKDIR/conductor/src | |
if [ "$using_bundler" == "yes" ]; then | |
# where the gems bundle pulls down will live: | |
mkdir -p $WORKDIR/bundler | |
# only Gemfile (not Gemfile.in) should exist | |
if [ -e Gemfile.in ]; then mv -f Gemfile.in Gemfile; fi | |
# pull down the gem dependencies | |
bundle install --path $WORKDIR/bundler | |
else | |
# only Gemfile.in (not Gemfile) should exist | |
if [ -e Gemfile ]; then mv -f Gemfile Gemfile.in; fi | |
fi | |
# In this example, we use postgres. | |
cp $WORKDIR/conductor/src/config/database.pg \ | |
$WORKDIR/conductor/src/config/database.yml | |
perl -p -i -e "s/username: aeolus/username: $this_user/" \ | |
$WORKDIR/conductor/src/config/database.yml | |
# prefix our database names with our username so we don't clash | |
# with another user (if another user is also doing development) | |
perl -p -i -e "s/database: (conductor.*\$)/database: ${this_user}_\$1/" \ | |
$WORKDIR/conductor/src/config/database.yml | |
# keys for imagefactory | |
$rake_prefix rake dc:oauth_keys | |
# create db schema | |
$rake_prefix rake db:create:all | |
# answer yes to command below | |
echo YES | $rake_prefix rake dc:setup | |
# Precompile some needed stylesheets. | |
$rake_prefix compass compile | |
# Start the server | |
$rake_prefix rails s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment