Skip to content

Commit 155057e

Browse files
committed
Initial version. Hardcoded. Download then extract not yet working fully.
1 parent b5e54ec commit 155057e

File tree

2 files changed

+68
-4
lines changed

2 files changed

+68
-4
lines changed

files/extract-magento.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
if [ -z "$1" ]; then
3+
echo "Usage: extract-magento.sh TARGET_MAGENTO_ROOT"
4+
exit 1
5+
fi
6+
TARGET_MAGENTO_ROOT="$1"
7+
8+
if [ -d "$TARGET_MAGENTO_ROOT" ]; then
9+
echo "Error: ${TARGET_MAGENTO_ROOT} folder already exists"
10+
exit 1
11+
fi
12+
13+
echo "Extracting Magento to: ${TARGET_MAGENTO_ROOT}"
14+
[ -d $HOME/tmp ] || mkdir -v $HOME/tmp
15+
[ ! -d $HOME/tmp/magento ] || rm -r $HOME/tmp/magento
16+
tar -C $HOME/tmp -xzf $HOME/dist/magento-bippo-1.6.2.0_1.tar.gz
17+
# Workaround
18+
chmod -c +x $HOME/tmp/magento/mage
19+
mv -v $HOME/tmp/magento "${TARGET_MAGENTO_ROOT}"

manifests/init.pp

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,57 @@
1717

1818
$root = '/home/magento/sites/berbatik'
1919
$mysql_host = 'localhost'
20-
$mysql_user = 'berbatik_magento'
20+
$mysql_user = 'berbatik'
2121
$mysql_password = 'bippo'
2222
$mysql_dbname = 'berbatik_magento'
2323
$url = 'http://www.berbatik.com.vm/'
24+
$use_rewrites = 'yes'
2425
$secure_url = 'http://www.berbatik.com.vm/'
2526
$admin_firstname = 'Berbatik'
2627
$admin_lastname = 'Sysadmin'
27-
$admin_email = '[email protected]'
28+
$admin_email = '[email protected]' # [email protected] is not valid email, WTF?
2829
$admin_username = 'sysadmin'
2930
$admin_password = 'admin123'
3031

32+
file { '/home/magento/scripts/extract-magento.sh':
33+
ensure => file,
34+
source => 'puppet:///modules/magento/extract-magento.sh',
35+
owner => magento,
36+
group => magento,
37+
mode => 0755,
38+
}
39+
3140
if $install {
41+
42+
# TODO: No download or install is need if Magento is already setup
43+
file { magento-dist:
44+
name => '/home/magento/dist',
45+
ensure => directory,
46+
owner => magento,
47+
group => magento,
48+
}
49+
exec { download-magento:
50+
cwd => '/home/magento/dist',
51+
creates => '/home/magento/dist/magento-bippo-1.6.2.0_1.tar.gz',
52+
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',
53+
path => ['/usr/local/bin', '/usr/bin'],
54+
logoutput => true,
55+
user => 'magento',
56+
require => File['magento-dist'],
57+
}
58+
exec { extract-magento:
59+
creates => '/home/magento/sites/berbatik',
60+
command => '/home/magento/scripts/extract-magento.sh /home/magento/sites/berbatik',
61+
logoutput => true,
62+
user => 'magento',
63+
environment => ['HOME=/home/magento'],
64+
require => [ Exec['download-magento'], File['/home/magento/scripts/extract-magento.sh'] ],
65+
}
66+
3267
exec { install-magento:
3368
cwd => $root,
3469
creates => "${root}/app/etc/local.xml",
35-
path => '/usr/bin',
70+
path => ['/usr/local/bin', '/usr/bin'],
3671
command => "php -f install.php -- \
3772
--license_agreement_accepted \"yes\" \
3873
--locale \"id_ID\" \
@@ -55,8 +90,18 @@
5590
--admin_password \"${admin_password}\"",
5691
logoutput => true,
5792
user => 'magento',
58-
require => [Exec["setting-permissions"], Exec["create-magentodb-db"]],
93+
require => [ Exec['extract-magento'] ],
94+
#require => [Exec["setting-permissions"], Exec["create-magentodb-db"]],
5995
}
96+
97+
file { '/home/magento/sites/berbatik/app/etc/local.xml':
98+
ensure => file,
99+
owner => magento,
100+
group => magento,
101+
mode => 0400,
102+
require => Exec['install-magento'],
103+
}
104+
60105
}
61106

62107
}

0 commit comments

Comments
 (0)