Commit 7cf13dcb90d456b838009ae91f1c99dec0f7f2ec
1 parent
49ce321666
Ohai, some boxen::project love
Showing 2 changed files with 57 additions and 11 deletions Inline Diff
modules/projects/README.md
| # Project Manifests | 1 | 1 | # Project Manifests | |
| 2 | 2 | |||
| Project manifests live in `modules/projects/manifests/$project.pp`. A | 3 | 3 | Project manifests live in `modules/projects/manifests/$project.pp`. A | |
| simple project manifest example: | 4 | 4 | simple project manifest example: | |
| 5 | 5 | |||
| ```puppet | 6 | 6 | ```puppet | |
| class projects::boxen { | 7 | 7 | class projects::trollin { | |
| include qt # requires the qt module in Puppetfile | 8 | 8 | include icu4c | |
| 9 | include phantomjs | |||
| 9 | 10 | |||
| $dir = "${boxen::config::srcdir}/boxen" | 10 | 11 | boxen::project { 'trollin': | |
| 11 | 12 | dotenv => true, | ||
| repository { $dir: | 12 | 13 | elasticsearch => true, | |
| source => 'boxen/boxen' | 13 | 14 | mysql => true, | |
| 15 | nginx => true, | |||
| 16 | redis => true, | |||
| 17 | ruby => '1.9.3', | |||
| 18 | source => 'boxen/trollin' | |||
| } | 14 | 19 | } | |
| 15 | ||||
| ruby::local { $dir: | 16 | |||
| version => 'system', | 17 | |||
| require => Repository[$dir] | 18 | |||
| } | 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). | |||
| 22 | 30 |
modules/projects/templates/shared/nginx.conf.erb
| File was created | 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; |