Skip to content

Commit

Permalink
Initial version. Hardcoded. Download then extract not yet working fully.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceefour committed May 2, 2012
1 parent b5e54ec commit 155057e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 4 deletions.
19 changes: 19 additions & 0 deletions files/extract-magento.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: extract-magento.sh TARGET_MAGENTO_ROOT"
exit 1
fi
TARGET_MAGENTO_ROOT="$1"

if [ -d "$TARGET_MAGENTO_ROOT" ]; then
echo "Error: ${TARGET_MAGENTO_ROOT} folder already exists"
exit 1
fi

echo "Extracting Magento to: ${TARGET_MAGENTO_ROOT}"
[ -d $HOME/tmp ] || mkdir -v $HOME/tmp
[ ! -d $HOME/tmp/magento ] || rm -r $HOME/tmp/magento
tar -C $HOME/tmp -xzf $HOME/dist/magento-bippo-1.6.2.0_1.tar.gz
# Workaround
chmod -c +x $HOME/tmp/magento/mage
mv -v $HOME/tmp/magento "${TARGET_MAGENTO_ROOT}"
53 changes: 49 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,57 @@

$root = '/home/magento/sites/berbatik'
$mysql_host = 'localhost'
$mysql_user = 'berbatik_magento'
$mysql_user = 'berbatik'
$mysql_password = 'bippo'
$mysql_dbname = 'berbatik_magento'
$url = 'http://www.berbatik.com.vm/'
$use_rewrites = 'yes'
$secure_url = 'http://www.berbatik.com.vm/'
$admin_firstname = 'Berbatik'
$admin_lastname = 'Sysadmin'
$admin_email = '[email protected]'
$admin_email = '[email protected]' # [email protected] is not valid email, WTF?
$admin_username = 'sysadmin'
$admin_password = 'admin123'

file { '/home/magento/scripts/extract-magento.sh':
ensure => file,
source => 'puppet:///modules/magento/extract-magento.sh',
owner => magento,
group => magento,
mode => 0755,
}

if $install {

# TODO: No download or install is need if Magento is already setup
file { magento-dist:
name => '/home/magento/dist',
ensure => directory,
owner => magento,
group => magento,
}
exec { download-magento:
cwd => '/home/magento/dist',
creates => '/home/magento/dist/magento-bippo-1.6.2.0_1.tar.gz',
command => 'wget http://192.168.66.17:8080/nexus/service/local/repositories/releases/content/id/co/bippo/commerce/magento-bippo/1.6.2.0_1/magento-bippo-1.6.2.0_1.tar.gz',
path => ['/usr/local/bin', '/usr/bin'],
logoutput => true,
user => 'magento',
require => File['magento-dist'],
}
exec { extract-magento:
creates => '/home/magento/sites/berbatik',
command => '/home/magento/scripts/extract-magento.sh /home/magento/sites/berbatik',
logoutput => true,
user => 'magento',
environment => ['HOME=/home/magento'],
require => [ Exec['download-magento'], File['/home/magento/scripts/extract-magento.sh'] ],
}

exec { install-magento:
cwd => $root,
creates => "${root}/app/etc/local.xml",
path => '/usr/bin',
path => ['/usr/local/bin', '/usr/bin'],
command => "php -f install.php -- \
--license_agreement_accepted \"yes\" \
--locale \"id_ID\" \
Expand All @@ -55,8 +90,18 @@
--admin_password \"${admin_password}\"",
logoutput => true,
user => 'magento',
require => [Exec["setting-permissions"], Exec["create-magentodb-db"]],
require => [ Exec['extract-magento'] ],
#require => [Exec["setting-permissions"], Exec["create-magentodb-db"]],
}

file { '/home/magento/sites/berbatik/app/etc/local.xml':
ensure => file,
owner => magento,
group => magento,
mode => 0400,
require => Exec['install-magento'],
}

}

}

0 comments on commit 155057e

Please sign in to comment.