Commit 7cf13dcb90d456b838009ae91f1c99dec0f7f2ec
1 parent
49ce321666
Ohai, some boxen::project love
Showing 2 changed files with 57 additions and 11 deletions Side-by-side Diff
modules/projects/README.md
| ... | ... | @@ -4,19 +4,27 @@ |
| 4 | 4 | simple project manifest example: |
| 5 | 5 | |
| 6 | 6 | ```puppet |
| 7 | -class projects::boxen { | |
| 8 | - include qt # requires the qt module in Puppetfile | |
| 7 | +class projects::trollin { | |
| 8 | + include icu4c | |
| 9 | + include phantomjs | |
| 9 | 10 | |
| 10 | - $dir = "${boxen::config::srcdir}/boxen" | |
| 11 | - | |
| 12 | - repository { $dir: | |
| 13 | - source => 'boxen/boxen' | |
| 11 | + boxen::project { 'trollin': | |
| 12 | + dotenv => true, | |
| 13 | + elasticsearch => true, | |
| 14 | + mysql => true, | |
| 15 | + nginx => true, | |
| 16 | + redis => true, | |
| 17 | + ruby => '1.9.3', | |
| 18 | + source => 'boxen/trollin' | |
| 14 | 19 | } |
| 15 | - | |
| 16 | - ruby::local { $dir: | |
| 17 | - version => 'system', | |
| 18 | - require => Repository[$dir] | |
| 19 | - } | |
| 20 | 20 | } |
| 21 | 21 | ``` |
| 22 | + | |
| 23 | +With the above, as long as our app is configured to listen on a **socket** at | |
| 24 | +`"#{ENV['BOXEN_SOCKET_DIR']}"/trollin`, you'll now be able to run its local | |
| 25 | +server and visit http://trollin.dev/ to access the app in dev. | |
| 26 | + | |
| 27 | +For further documentation on how to use the `boxen::project` type, | |
| 28 | +take a look at the documentation in the | |
| 29 | +[source](https://github.com/boxen/puppet-boxen/blob/master/manifests/project.pp#L1-L46). |
modules/projects/templates/shared/nginx.conf.erb
| 1 | +upstream <%= name %>.dev { | |
| 2 | + server unix:<%= scope.lookupvar "boxen::config::socketdir" %>/<%= name %>; | |
| 3 | +} | |
| 4 | + | |
| 5 | +server { | |
| 6 | + access_log <%= scope.lookupvar "nginx::config::logdir" %>/<%= name %>.access.log main; | |
| 7 | + listen 80; | |
| 8 | + root <%= scope.lookupvar "boxen::config::srcdir" %>/<%= name %>/public; | |
| 9 | + server_name <%= name %>.dev; | |
| 10 | + | |
| 11 | + client_max_body_size 50M; | |
| 12 | + | |
| 13 | + error_page 500 502 503 504 /50x.html; | |
| 14 | + | |
| 15 | + if ($host ~* "www") { | |
| 16 | + rewrite ^(.*)$ http://<%= name %>.dev$1 permanent; | |
| 17 | + break; | |
| 18 | + } | |
| 19 | + | |
| 20 | + location = /50x.html { | |
| 21 | + root html; | |
| 22 | + } | |
| 23 | + | |
| 24 | + location / { | |
| 25 | + if (-f $request_filename/index.html) { | |
| 26 | + rewrite (.*) $1/index.html break; | |
| 27 | + } | |
| 28 | + | |
| 29 | + if (-f $request_filename.html) { | |
| 30 | + rewrite (.*) $1.html break; | |
| 31 | + } | |
| 32 | + | |
| 33 | + if (!-f $request_filename) { | |
| 34 | + proxy_pass http://<%= name %>.dev; | |
| 35 | + break; | |
| 36 | + } | |
| 37 | + } | |
| 38 | +} |