This repository has been archived by the owner on Aug 2, 2019. It is now read-only.
/
app.pp
72 lines (63 loc) · 2.14 KB
/
app.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class joindin::app {
# Initialize database structure
exec { 'init-db':
creates => '/tmp/.patched',
command => "/vagrant/src/scripts/patchdb.sh \
-t /vagrant/joindin-api -d ${params::dbname} -u ${params::dbuser} \
-p ${params::dbpass} -i && touch /tmp/.patched",
require => Exec['create-db'],
}
# Patch database structure
exec { 'patch-db':
command => "/vagrant/src/scripts/patchdb.sh \
-t /vagrant/joindin-api -d ${params::dbname} -u ${params::dbuser} \
-p ${params::dbpass}",
require => [
Exec['create-db'],
Exec['init-db'],
],
}
# Generate seed data
exec { 'seed-data':
creates => '/tmp/seed.sql',
command => 'php /vagrant/joindin-api/tools/dbgen/generate.php > /tmp/seed.sql',
require => [
Package['php'],
Exec['init-db'],
]
}
# Seed database
exec { 'seed-db':
creates => '/tmp/.seeded',
command => "mysql ${params::dbname} < /tmp/seed.sql && touch /tmp/.seeded",
require => [
Exec['init-db'],
Exec['seed-data'],
],
}
# Set database config for application
file { 'database-config':
path => '/vagrant/src/system/application/config/database.php',
content => template('joindin/database.php.erb'),
}
# Set database config for application
file { 'api-database-config':
path => '/vagrant/joindin-api/src/database.php',
content => template('joindin/database.php.erb'),
}
# Set core config for application
file { 'application-config':
path => '/vagrant/src/system/application/config/config.php',
source => '/vagrant/src/system/application/config/config.php.dist',
replace => no,
}
# Create directory for user-generated content
file { 'upload-directory':
ensure => directory,
path => '/tmp/ctokens',
mode => '0644',
owner => 'apache',
group => 'apache',
require => Service['apache'],
}
}