Create, install, and start basic rails app
This commit is contained in:
parent
c529674de1
commit
6c78a8f79d
1 changed files with 48 additions and 0 deletions
|
@ -29,6 +29,54 @@ class { '::mysql::server': }
|
|||
# install nginx
|
||||
class { 'nginx': }
|
||||
|
||||
# install rails
|
||||
package { 'rails':
|
||||
provider => 'gem',
|
||||
}
|
||||
|
||||
# add rails depends
|
||||
package { ['libsqlite3-dev', 'build-essential', 'nodejs']:
|
||||
before => Exec['install rails app']
|
||||
}
|
||||
|
||||
# add rails user and application
|
||||
user { 'rails':
|
||||
ensure => present,
|
||||
groups => ['sudo'],
|
||||
managehome => true,
|
||||
shell => '/bin/bash',
|
||||
}
|
||||
exec { 'create rails app':
|
||||
command => 'rails new welcome',
|
||||
user => 'rails',
|
||||
environment => ['HOME=/home/rails'],
|
||||
path => '/usr/bin:/usr/local/bin',
|
||||
cwd => '/home/rails',
|
||||
creates => '/home/rails/welcome',
|
||||
require => [
|
||||
Package['rails'],
|
||||
User['rails'],
|
||||
],
|
||||
}
|
||||
exec { 'install rails app':
|
||||
command => 'bundle install --path vendor/bundle',
|
||||
user => 'rails',
|
||||
environment => ['HOME=/home/rails'],
|
||||
path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
cwd => '/home/rails/welcome',
|
||||
unless => 'bundle check',
|
||||
require => Exec['create rails app'],
|
||||
notify => Exec['start rails app'],
|
||||
}
|
||||
exec { 'start rails app':
|
||||
command => 'rails server -d',
|
||||
user => 'rails',
|
||||
environment => ['HOME=/home/rails'],
|
||||
path => '/usr/bin:/usr/local/bin',
|
||||
cwd => '/home/rails/welcome',
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
# A working firewall using iptables or another Linux firewall
|
||||
resources { 'firewall':
|
||||
purge => true,
|
||||
|
|
Loading…
Reference in a new issue