Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #9 from clauded/master
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
tremblaysimon committed May 29, 2015
2 parents 952916c + 2d6d299 commit 5fea4a9
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 87 deletions.
174 changes: 93 additions & 81 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,81 +10,136 @@
#
# class { 'igo': }
#
class igo(
class igo (

$usedByVagrant = $::igo::params::usedByVagrant,
$igoRootPath = $::igo::params::igoRootPath,
$databaseName = $::igo::params::databaseName,
$databaseUser = $::igo::params::databaseUser,
$databasePassword = $::igo::params::databasePassword,
$pgUser = $::igo::params::pgUser,
$appUser = $::igo::params::appUser,
$appGroup = $::igo::params::appGroup,
$mapserverVersion = $::igo::params::mapserVerversion,
$cphalconVersion = $::igo::params::cphalconVersion,
$pgsqlScriptPath = $::igo::params::pgsqlScriptPath,
$librairieGitRepo = $::igo::params::librairieGitRepo,
$mapserverVersion = $::igo::params::mapserVerversion,
$igoGitRepo = $::igo::params::igoGitRepo,
$pgUser = $::igo::params::pgUser
$igoVersion = $::igo::params::igoVersion,
$librairieGitRepo = $::igo::params::librairieGitRepo,
$librairieVersion = $::igo::params::librairieVersion,
$cphalconGitRepo = $::igo::params::cphalconGitRepo,
$cphalconVersion = $::igo::params::cphalconVersion,

) inherits ::igo::params {

$igoAppPath = "${igoRootPath}/igo"
$execPath = [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ]

package { 'git':
ensure => present,
}
file { "$igoRootPath":
ensure => 'directory',
owner => $appUser,
group => $appGroup,
mode => '0775',
}
if $usedByVagrant == true {
file { "$igoAppPath":
ensure => 'link',
target => '/vagrant',
force => true,
require => File[$igoRootPath]
}

$requiredIgoAppPath = File["$igoAppPath"]
}
else {
} else {
vcsrepo { "$igoAppPath":
ensure => present,
provider => git,
source => "$igoGitRepo",
require => Package['git'],
source => $igoGitRepo,
revision => $igoVersion,
require => [
Package['git'],
File[$igoRootPath],
],
}

$requiredIgoAppPath = Vcsrepo["$igoAppPath"]
}

file { "$igoRootPath":
ensure => 'directory',
owner => $appUser,
group => $appGroup,
mode => '0775',
vcsrepo { "${igoRootPath}/librairie":
ensure => present,
provider => git,
source => $librairieGitRepo,
depth => 1,
require => [
Package['git'],
File[$igoRootPath],
],
}
file { "${igoAppPath}/interfaces/navigateur/app/cache":
owner => $appUser,
group => $appGroup,
mode => '0775',
require => $requiredIgoAppPath,
}
file { "${igoAppPath}/pilotage/app/cache":
owner => $appUser,
group => $appGroup,
mode => '0775',
require => $requiredIgoAppPath,
}
file { "${igoAppPath}/config/config.php":
owner => $appUser,
group => $appGroup,
content => template('igo/config.php.erb'),
require => $requiredIgoAppPath,
}
class { '::igo::apache':
igoRootPath => $igoRootPath,
igoAppPath => $igoAppPath,
appUser => $appUser,
appGroup => $appGroup
}
class { 'php':
class { 'php':
}
class { 'php::devel':
}

php::module { "curl":
php::module { 'curl':
}
php::module { "intl":
php::module { 'intl':
}
php::module { "mapscript":
php::module { 'mapscript':
}
php::module { "pgsql":
php::module { 'pgsql':
}

# TODO: check for other distribution names
package { [ 'cgi-mapserver', 'mapserver-bin' ]:
ensure => $mapserverVersion,
}
package { [ 'gdal-bin', 'gcc', 'make', 'libpcre3-dev', 'git' ]:
package { [ 'gdal-bin', 'gcc', 'make', 'libpcre3-dev', ]:
ensure => present,
}
class { 'postgresql::server':
vcsrepo { "${srcPath}/cphalcon":
ensure => present,
provider => git,
source => 'https://github.com/phalcon/cphalcon.git',
revision => "phalcon-${cphalconVersion}",
require => Package['git'],
}
exec { 'installAndBuild-cphalcon':
command => "./install",
cwd => "${srcPath}/cphalcon/build",
path => $execPath,
creates => '/usr/lib/php5/20121212/phalcon.so',
require => [
Vcsrepo["${srcPath}/cphalcon"],
Class['php::devel'],
],
}
php::ini { 'createPHPiniPhalcon':
target => '30-phalcon.ini',
value => 'extension=phalcon.so',
require => Exec['installAndBuild-cphalcon'],
}
class { 'postgresql::server':
}
class { 'postgresql::server::postgis':
}
Expand All @@ -97,73 +152,30 @@
ensure => present,
}
exec { 'psql-postgis':
command => "psql -d ${databaseName} -f ${pgsqlScriptPath}/postgis.sql",
command =>
"psql -d ${databaseName} -f ${pgsqlScriptPath}/postgis.sql && \
touch ${pgsqlEtcPath}/psql-postgis.done",
path => $execPath,
user => $pgUser,
creates => "${pgsqlEtcPath}/psql-postgis.done",
require => Postgresql::Server::Extension['plpgsql'],
}
exec { 'psql-postgis_comments':
command => "psql -d ${databaseName} -f ${pgsqlScriptPath}/postgis_comments.sql",
command =>
"psql -d ${databaseName} -f ${pgsqlScriptPath}/postgis_comments.sql && \
touch ${pgsqlEtcPath}/psql-postgis_comments.done",
path => $execPath,
user => $pgUser,
creates => "${pgsqlEtcPath}/psql-postgis_comments.done",
require => Exec['psql-postgis'],
}
exec { "psql-spatial_ref_sys":
command => "psql -d ${databaseName} -f ${pgsqlScriptPath}/spatial_ref_sys.sql",
command =>
"psql -d ${databaseName} -f ${pgsqlScriptPath}/spatial_ref_sys.sql && \
touch ${pgsqlEtcPath}/psql-spatial_ref_sys.done",
path => $execPath,
user => $pgUser,
creates => "${pgsqlEtcPath}/psql-spatial_ref_sys.done",
require => Exec['psql-postgis_comments'],
}
vcsrepo { "${srcPath}/cphalcon":
ensure => present,
provider => git,
source => 'https://github.com/phalcon/cphalcon.git',
revision => "phalcon-${cphalconVersion}",
require => Package['git'],
}
exec { 'installAndBuild-cphalcon':
command => "./install",
cwd => "${srcPath}/cphalcon/build",
path => $execPath,
require => [
Vcsrepo["${srcPath}/cphalcon"],
Class['php::devel'],
],
}

php::ini { 'createPHPiniPhalcon':
target => '30-phalcon.ini',
value => 'extension=phalcon.so',
}

vcsrepo { "${igoRootPath}/librairie":
ensure => present,
provider => git,
source => $librairieGitRepo,
depth => 1,
require => [
Package['git'],
Class['apache'],
File[$igoRootPath],
],
}

file { "${igoAppPath}/interfaces/navigateur/app/cache":
owner => $appUser,
group => $appGroup,
mode => '0775',
require => "$requiredIgoAppPath",
}
file { "${igoAppPath}/pilotage/app/cache":
owner => $appUser,
group => $appGroup,
mode => '0775',
require => "$requiredIgoAppPath",
}
file { "${igoAppPath}/config/config.php":
owner => $appUser,
group => $appGroup,
content => template("igo/config.php.erb"),
require => "$requiredIgoAppPath",
}
}
19 changes: 13 additions & 6 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class igo::params {

include ::postgresql::globals

$usedByVagrant = false

$igoRootPath = '/var/igo'
Expand All @@ -15,13 +17,18 @@
$appGroup = 'vagrant'

$mapserverVersion = '6.4.1-2'
$cphalconVersion = 'v1.3.1'

# TODO: File path change depends on OS.
$pgsqlScriptPath = '/usr/share/postgresql/9.3/contrib/postgis-2.1'
$srcPath = '/usr/src'

$igoGitRepo = 'https://github.com/infra-geo-ouverte/igo.git'
$igoVersion = 'master'

$librairieGitRepo = 'https://github.com/infra-geo-ouverte/igo-lib.git'
$librairieVersion = 'master'

$cphalconGitRepo = 'https://github.com/phalcon/cphalcon.git'
$cphalconVersion = 'v1.3.1'

$pgsqlEtcPath = "/etc/postgresql/${::postgresql::globals::default_version}"
$pgsqlScriptPath = "/usr/share/postgresql/${::postgresql::globals::default_version}/contrib/postgis-${::postgresql::globals::default_postgis_version}"
$srcPath = '/usr/src'

$igoGitRepo = 'https://github.com/infra-geo-ouverte/igo.git'
}

0 comments on commit 5fea4a9

Please sign in to comment.