Ohai, some boxen::project love
This commit is contained in:
parent
49ce321666
commit
7cf13dcb90
2 changed files with 57 additions and 11 deletions
|
@ -4,18 +4,26 @@ Project manifests live in `modules/projects/manifests/$project.pp`. A
|
|||
simple project manifest example:
|
||||
|
||||
```puppet
|
||||
class projects::boxen {
|
||||
include qt # requires the qt module in Puppetfile
|
||||
class projects::trollin {
|
||||
include icu4c
|
||||
include phantomjs
|
||||
|
||||
$dir = "${boxen::config::srcdir}/boxen"
|
||||
|
||||
repository { $dir:
|
||||
source => 'boxen/boxen'
|
||||
}
|
||||
|
||||
ruby::local { $dir:
|
||||
version => 'system',
|
||||
require => Repository[$dir]
|
||||
boxen::project { 'trollin':
|
||||
dotenv => true,
|
||||
elasticsearch => true,
|
||||
mysql => true,
|
||||
nginx => true,
|
||||
redis => true,
|
||||
ruby => '1.9.3',
|
||||
source => 'boxen/trollin'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With the above, as long as our app is configured to listen on a **socket** at
|
||||
`"#{ENV['BOXEN_SOCKET_DIR']}"/trollin`, you'll now be able to run its local
|
||||
server and visit http://trollin.dev/ to access the app in dev.
|
||||
|
||||
For further documentation on how to use the `boxen::project` type,
|
||||
take a look at the documentation in the
|
||||
[source](https://github.com/boxen/puppet-boxen/blob/master/manifests/project.pp#L1-L46).
|
||||
|
|
38
modules/projects/templates/shared/nginx.conf.erb
Normal file
38
modules/projects/templates/shared/nginx.conf.erb
Normal file
|
@ -0,0 +1,38 @@
|
|||
upstream <%= name %>.dev {
|
||||
server unix:<%= scope.lookupvar "boxen::config::socketdir" %>/<%= name %>;
|
||||
}
|
||||
|
||||
server {
|
||||
access_log <%= scope.lookupvar "nginx::config::logdir" %>/<%= name %>.access.log main;
|
||||
listen 80;
|
||||
root <%= scope.lookupvar "boxen::config::srcdir" %>/<%= name %>/public;
|
||||
server_name <%= name %>.dev;
|
||||
|
||||
client_max_body_size 50M;
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
|
||||
if ($host ~* "www") {
|
||||
rewrite ^(.*)$ http://<%= name %>.dev$1 permanent;
|
||||
break;
|
||||
}
|
||||
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
|
||||
location / {
|
||||
if (-f $request_filename/index.html) {
|
||||
rewrite (.*) $1/index.html break;
|
||||
}
|
||||
|
||||
if (-f $request_filename.html) {
|
||||
rewrite (.*) $1.html break;
|
||||
}
|
||||
|
||||
if (!-f $request_filename) {
|
||||
proxy_pass http://<%= name %>.dev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue