Pulp and image builder are now being installed. There is a major blocker
with pulp / puppet integration which prevents pulp from being fully setup 
though. See
the appliance puppet recipe for more details.

To create the appliance, simply run through the following steps which will 
start the appliance via libvirt

$ cd appliance/
$ sudo appliance-creator -n deltacloud -c dcloud.ks --cache /var/tmp/act/
$ sudo virt-image deltacloud/deltacloud.xml

To build an updated deltacloud_appliance puppet recipe rpm,

$ tar czvf deltacloud_appliance.tgz deltacloud_appliance/
$ cp deltacloud_appliance.tgz ~/rpmbuild/SOURCES
$ rpmbuild -ba deltacloud_appliance.spec.
---
 appliance/dcloud.ks                                |  101 ++++++++++++++
 appliance/deltacloud_appliance.spec                |   65 +++++++++
 .../deltacloud_appliance/deltacloud_appliance.pp   |  145 ++++++++++++++++++++
 .../deltacloud_appliance/files/condor_config.local |   21 +++
 .../deltacloud_appliance/files/deltacloud-core     |   74 ++++++++++
 appliance/deltacloud_appliance/files/pg_hba.conf   |    2 +
 6 files changed, 408 insertions(+), 0 deletions(-)
 create mode 100644 appliance/dcloud.ks
 create mode 100644 appliance/deltacloud_appliance.spec
 create mode 100644 appliance/deltacloud_appliance/deltacloud_appliance.pp
 create mode 100644 appliance/deltacloud_appliance/files/condor_config.local
 create mode 100755 appliance/deltacloud_appliance/files/deltacloud-core
 create mode 100644 appliance/deltacloud_appliance/files/pg_hba.conf

diff --git a/appliance/dcloud.ks b/appliance/dcloud.ks
new file mode 100644
index 0000000..aee3cb9
--- /dev/null
+++ b/appliance/dcloud.ks
@@ -0,0 +1,101 @@
+# Deltacloud appliance kickstart
+
+# Yum repos to use
+repo --name=f13         
--mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-13&arch=$basearch
+repo --name=f13-updates 
--mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f13&arch=$basearch
+repo --name=thincrust   --baseurl=http://www.thincrust.net/repo/noarch/
+
+# local yum repo with:
+#  * ruby 1.8.7
+#  * rails 2.3.8
+#  * patched locale_rails, activerecord, haml, and puppet rpms (to fix issues)
+#  * deltacloud aggregator rpms
+#  * condor-dcloud and libdeltacloud
+#  * deltacloud_appliance
+repo --name=deltacloud_local --baseurl=http://yum.morsi.org/repos/13
+
+# pull pulp in from here
+repo --name=pulp 
--baseurl=http://mmccune.fedorapeople.org/pulp/fedora/13/$basearch
+
+# Firewall / network configuration
+firewall --enable --ssh
+network  --bootproto=dhcp --device=eth0 --onboot=on
+
+# System authorization information
+auth --useshadow --enablemd5
+
+# System keyboard
+keyboard us
+
+# System language
+lang en_US.UTF-8
+
+# System timezone
+timezone  US/Eastern
+
+# System bootloader configuration
+bootloader --append="5" --location=mbr --timeout=1
+
+# Disk partitioning information
+part /  --fstype="ext3" --ondisk=sda --size=3072 --bytes-per-inode=4096
+
+# No need for additional config
+firstboot --disable
+
+%post
+  /sbin/chkconfig --level 35 ace off
+  mkdir /etc/sysconfig/ace
+  echo deltacloud_appliance >> /etc/sysconfig/ace/appliancename
+
+  # start mongodb and httpd for pulp server
+  /sbin/chkconfig --level 35 mongod on
+  /sbin/chkconfig --level 35 httpd on
+
+  /usr/sbin/useradd dcuser -p ""
+  # TODO (here or in deltacloud_appliance.pp) startup firefox on duser's X 
login w/ core & aggregator wuis in tabs
+%end
+
+%packages --excludedocs --nobase --instLangs=en
+...@core
+...@base-x
+...@gnome-desktop
+acpid
+bash
+chkconfig
+dhclient
+e2fsprogs
+grub
+iputils
+kernel
+lokkit
+passwd
+rootfiles
+vim-enhanced
+wget
+bind-utils
+yum
+firefox
+-authconfig
+-checkpolicy
+-dmraid
+-ed
+-fedora-logos
+-fedora-release-notes
+-kbd
+-kpartx
+-kudzu
+-libselinux
+-libselinux-python
+-lvm2
+-mdadm
+-policycoreutils
+-prelink
+-selinux-policy*
+-setserial
+-tar
+-usermode
+-wireless-tools
+-firstboot
+
+deltacloud_appliance
+%end
diff --git a/appliance/deltacloud_appliance.spec 
b/appliance/deltacloud_appliance.spec
new file mode 100644
index 0000000..58a3014
--- /dev/null
+++ b/appliance/deltacloud_appliance.spec
@@ -0,0 +1,65 @@
+%define aceHome /usr/share/ace
+%define pbuild %{_builddir}/%{name}-%{version}
+
+Summary:  DeltaCloud Appliance
+Name:     deltacloud_appliance
+Version:  0.0.1
+Release:  1%{?dist}
+
+Group:    Applications/Internet
+License:  GPLv2+
+URL:      http://deltacloud.org
+Source0:  %{name}-%{version}.tar.gz
+BuildRoot:  %{_tmppath}/%{name}-%{version}
+BuildArch:  noarch
+Requires:   ace-banners
+Requires:   ace-ssh
+Requires:   ace-postgres
+
+# Deltacloud and dependencies
+Requires:   deltacloud-aggregator
+Requires:   deltacloud-aggregator-daemons
+Requires:   deltacloud-aggregator-doc
+Requires:   condor >=  7.5.0
+Requires:   ruby
+Requires:   ruby-rdoc
+Requires:   ruby-devel
+Requires:   rubygem-rails
+Requires:   gcc-c++
+Requires:   libxml2-devel
+Requires:   libxslt-devel
+Requires:   pulp
+Requires:   pulp-client
+
+Requires:   rubygem-thin
+Requires:   rubygem-haml
+
+# To download the image builder, eventually replace with
+# image builder rpm itself:
+Requires:   wget
+
+%description
+Deltacloud appliance
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf %{buildroot}
+%{__mkdir} -p %{buildroot}/%{aceHome}/appliances/%{name}
+%{__cp} -R %{pbuild}/* %{buildroot}/%{aceHome}/appliances/%{name}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%dir %{aceHome}
+%{aceHome}/*
+
+
+%changelog
+* Thu Mar 26 2008 Mohammed Morsi <[email protected]> 0.0.1-1
+- Initial package
diff --git a/appliance/deltacloud_appliance/deltacloud_appliance.pp 
b/appliance/deltacloud_appliance/deltacloud_appliance.pp
new file mode 100644
index 0000000..45c13de
--- /dev/null
+++ b/appliance/deltacloud_appliance/deltacloud_appliance.pp
@@ -0,0 +1,145 @@
+#--
+#  Copyright (C) 2010 Red Hat Inc.
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License, or (at your option) any later version.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+#
+# Author: Mohammed Morsi <[email protected]>
+#--
+
+#
+# deltacloud thincrust appliance
+#
+
+# Modules used by the appliance
+import "appliance_base"
+import "banners"
+import "firewall"
+#import "console"
+
+# Information about our appliance
+$appliance_name = "Deltacloud Appliance"
+$appliance_version = "0.0.1"
+
+# Configuration
+appliance_base::setup{$appliance_name:}
+appliance_base::enable_updates{$appliance_name:}
+banners::all{$appliance_name:}
+firewall::setup{$appliance_name: status=>"enabled"}
+
+# Install required gems
+single_exec{"install_required_gems":
+            command => "/usr/bin/gem install authlogic gnuplot scruffy compass 
builder"
+}
+
+# TODO setup a gem repo w/ latest snapshots of image builder, deltacloud core 
if we need those
+
+# Deltacloud core
+single_exec{"install_deltacloud_core":
+            command => "/usr/bin/gem install deltacloud-client deltacloud-core"
+}
+
+# Image builder
+
+# FIXME when image builder is pushed to rubygems and/or rpm is available
+# install via that means and remove this wget
+single_exec{"download_image_builder":
+            command => "/usr/bin/wget 
http://projects.morsi.org/deltacloud/deltacloud-image-builder-agent-0.0.1.gem 
http://projects.morsi.org/deltacloud/deltacloud-image-builder-console-0.0.1.gem";
+}
+single_exec{"install_image_builder":
+            command => "/usr/bin/gem install 
deltacloud-image-builder-agent-0.0.1.gem 
deltacloud-image-builder-console-0.0.1.gem",
+            require => Single_exec[download_image_builder]
+}
+
+# Pulp
+# Configure pulp to fetch from Fedora
+# FIXME currently major blocker with puppet / pulp:
+#   1) ace's single_exec invokes puppet's execute (lib/puppet/util.rb)
+#   2) puppet execute sets locale environment variables to posix default ('C') 
immediately before running the command (lib/puppet/util.rb line 295)
+#   3) pulp-admin attempts to attain default locale (pulp/client/connection.py 
line 80)
+#   4) the python locale module attempts to parse these locale env vars 
(/usr/lib64/python2.6/locale.py line 471)
+#   5) setting those vars to 'C' causes the locale module to return None 
(locale.py line 409) which causes pulp-admin to thow a fatal exception
+#
+# There is no way to get around this here, since puppet sets the locale env 
vars and then immediately invokes Kernel.exec('pulp-admin...').
+# We can move the pulp-admin command to the kickstart or deltacloud_appliance 
rpm spec for a quick workaround for the time being, though
+# a bug should really be filed against either puppet or pulp.
+#single_exec{"pulp_fedora_config":
+#            command => "/usr/bin/pulp-admin -u admin -p admin repo create 
--id=fedora-repo --feed 
yum:http://download.fedora.redhat.com/pub/fedora/linux/updates/13/x86_64/";
+#}
+
+# Configure and start condor-dcloud
+file {"/var/lib/condor/condor_config.local":
+       source => "puppet:///deltacloud_appliance/condor_config.local",
+       notify          => Service[condor]
+}
+service {"condor" :
+       ensure => running,
+       enable => true
+}
+
+# Configure and start postgres
+single_exec {"initialize_db":
+      command => "/sbin/service postgresql initdb"
+}
+file {"/var/lib/pgsql/data/pg_hba.conf":
+       source => "puppet:///deltacloud_appliance/pg_hba.conf",
+       require => Single_exec[initialize_db]
+}
+service {"postgresql" :
+       ensure => running,
+       enable => true,
+       require => File["/var/lib/pgsql/data/pg_hba.conf"]
+}
+# XXX ugly hack, postgres takes sometime to startup even though reporting as 
running
+# need to pause for a bit to ensure it is running before we try to access the 
db
+single_exec{"postgresql_startup_pause":
+            command => "/bin/sleep 5",
+            require => Service[postgresql]
+}
+single_exec{"create_dcloud_postgres_user":
+            command => "/usr/bin/psql postgres postgres -c \"CREATE USER 
dcloud WITH PASSWORD 'v23zj59an' CREATEDB\"",
+            require => Single_exec[postgresql_startup_pause]
+}
+
+# Create deltacloud database
+single_exec{"create_deltacloud_database":
+            cwd     => "/usr/share/deltacloud-aggregator",
+            environment     => "RAILS_ENV=production",
+            command         => "/usr/bin/rake db:create:all",
+            require => [Single_exec[create_dcloud_postgres_user], 
Single_exec[install_required_gems], Single_exec[install_deltacloud_core]]
+}
+single_exec{"migrate_deltacloud_database":
+            cwd             => "/usr/share/deltacloud-aggregator",
+            environment     => "RAILS_ENV=production",
+            command => "/usr/bin/rake db:migrate",
+            require => Single_exec[create_deltacloud_database]
+}
+
+# install init.d control script for deltacloudd
+file {"/etc/init.d/deltacloud-core":
+      source => "puppet:///deltacloud_appliance/deltacloud-core",
+      mode   => 755
+}
+
+# Startup Deltacloud services
+service {"deltacloud-aggregator" :
+       ensure => running,
+       enable => true,
+       require => [Single_exec[install_required_gems], 
Single_exec[migrate_deltacloud_database]]
+}
+service{"deltacloud-core":
+       ensure => running,
+       enable => true,
+       require => [Single_exec[install_deltacloud_core], 
File["/etc/init.d/deltacloud-core"]]
+}
diff --git a/appliance/deltacloud_appliance/files/condor_config.local 
b/appliance/deltacloud_appliance/files/condor_config.local
new file mode 100644
index 0000000..8e22206
--- /dev/null
+++ b/appliance/deltacloud_appliance/files/condor_config.local
@@ -0,0 +1,21 @@
+CONDOR_HOST = localhost
+ALLOW_WRITE = *
+
+DAEMON_LIST = MASTER, SCHEDD, COLLECTOR, NEGOTIATOR, STARTD
+
+GRIDMANAGER_DEBUG = D_FULLDEBUG
+MAX_GRIDMANAGER_LOG = 500000000
+GRIDMANAGER_JOB_PROBE_INTERVAL = 30
+
+DCLOUD_GAHP = $(SBIN)/dcloud_gahp
+
+CLASSAD_LIFETIME = 0
+
+# for re-advertising classads (i.e. condor_refreshd)
+CONDOR_DEVELOPERS_COLLECTOR = localhost:7890
+COLLECTOR_UPDATE_INTERVAL = 900
+
+# for the event log parsing (i.e. dbomatic)
+EVENT_LOG=$(LOG)/EventLog
+EVENT_LOG_USE_XML=True
+EVENT_LOG_JOB_AD_INFORMATION_ATTRS=Owner,GlobalJobId,Cmd,JobStartDate,JobCurrentStartDate,JobFinishedHookDone
diff --git a/appliance/deltacloud_appliance/files/deltacloud-core 
b/appliance/deltacloud_appliance/files/deltacloud-core
new file mode 100755
index 0000000..efd62d3
--- /dev/null
+++ b/appliance/deltacloud_appliance/files/deltacloud-core
@@ -0,0 +1,74 @@
+#!/bin/bash
+#
+#
+# deltacloud-core       startup script for deltacloud-core server
+#
+# chkconfig: - 97 03
+# description: deltacloud-core is primary server process for the \
+#    Deltacloud Core component.
+#
+
+[ -r /etc/sysconfig/deltacloud-core ] && . /etc/sysconfig/deltacloud-core
+
+ENV="${ENV:-production}"
+DRIVER="${DRIVER:-ec2}"
+LOCKFILE="${LOCKFILE:-/var/lock/subsys/deltacloud-core }"
+
+PROG=/usr/bin/deltacloudd
+
+. /etc/init.d/functions
+
+start() {
+    echo -n "Starting deltacloud-core: "
+
+    $PROG -i $DRIVER -e $ENV&
+    RETVAL=$?
+    if [ $RETVAL -eq 0 ] && touch $LOCKFILE ; then
+      echo_success
+      echo
+    else
+      echo_failure
+      echo
+    fi
+}
+
+stop() {
+    echo -n "Shutting down deltacloud-core: "
+    RETVAL=$?
+    killall deltacloudd
+    if [ $RETVAL -eq 0 ] && rm -f $LOCKFILE ; then
+      echo_success
+      echo
+    else
+      echo_failure
+      echo
+    fi
+}
+
+case "$1" in
+    start)
+      start
+      ;;
+    stop)
+      stop
+      ;;
+    restart)
+      stop
+      start
+      ;;
+    reload)
+      ;;
+    force-reload)
+      restart
+      ;;
+    status)
+      status $PROG
+      RETVAL=$?
+      ;;
+    *)
+      echo "Usage: deltacloud-core {start|stop|restart|status}"
+      exit 1
+  ;;
+esac
+
+exit $RETVAL
diff --git a/appliance/deltacloud_appliance/files/pg_hba.conf 
b/appliance/deltacloud_appliance/files/pg_hba.conf
new file mode 100644
index 0000000..70d83bb
--- /dev/null
+++ b/appliance/deltacloud_appliance/files/pg_hba.conf
@@ -0,0 +1,2 @@
+local all all trust
+host  all all 127.0.0.1 255.255.255.255 trust
-- 
1.7.2.1

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to