031cc983dc
Part of the work necessary for bug #995248 Puppet module to do a basic install of etherpad-lite. Currently installs etherpad-lite and node.js. Configures etherpad-lite to use mysql for its DB backend and sets up nginx to reverse proxy etherpad-lite. Change-Id: I3ee1ce4594fcf2a27b520a3ad7a024318f69111a
38 lines
1.4 KiB
Puppet
38 lines
1.4 KiB
Puppet
class etherpad_lite::mysql {
|
|
|
|
include etherpad_lite
|
|
|
|
package { 'mysql-server':
|
|
ensure => present
|
|
}
|
|
|
|
package { 'mysql-client':
|
|
ensure => present
|
|
}
|
|
|
|
service { "mysql":
|
|
enable => true,
|
|
ensure => running,
|
|
hasrestart => true,
|
|
require => [Package['mysql-server'],
|
|
Package['mysql-client']]
|
|
}
|
|
|
|
exec { "create-etherpad-lite-db":
|
|
unless => 'mysql --defaults-file=/etc/mysql/debian.cnf etherpad-lite',
|
|
path => ['/bin', '/usr/bin'],
|
|
command => "mysql --defaults-file=/etc/mysql/debian.cnf -e \"create database \`etherpad-lite\` CHARACTER SET utf8 COLLATE utf8_bin;\"",
|
|
require => [Service['mysql'],
|
|
File["${etherpad_lite::base_install_dir}/etherpad-lite/settings.json"]]
|
|
} ->
|
|
|
|
exec { "grant-etherpad-lite-db":
|
|
unless => "mysql -ueplite -p'`grep password ${etherpad_lite::base_install_dir}/etherpad-lite/settings.json | cut -d: -f2 | sed -e 's/.*\"\(.*\)\".*/\1/'`' etherpad-lite",
|
|
path => ['/bin', '/usr/bin'],
|
|
command => "mysql --defaults-file=/etc/mysql/debian.cnf -e \"grant all on \`etherpad-lite\`.* to 'eplite'@'localhost' identified by '`grep password ${etherpad_lite::base_install_dir}/etherpad-lite/settings.json | cut -d: -f2 | sed -e 's/.*\"\(.*\)\".*/\1/'`';\" mysql",
|
|
require => [Service['mysql'],
|
|
File["${etherpad_lite::base_install_dir}/etherpad-lite/settings.json"]]
|
|
}
|
|
|
|
}
|