Commit 8639b8c1785578524fa49ca961f4ae8633e986a5
1 parent
8d4aea0b5b
get doc-wild
Showing 2 changed files with 217 additions and 0 deletions Inline Diff
docs/personal-configuration.md
File was created | 1 | # Personal Configuration | ||
2 | ||||
3 | One of the design choices of Boxen very early on was that we didn't want to | |||
4 | dictate down to users "you can do this, but you can't do that". | |||
5 | We do so as little as possible in the core, and we don't do it at all for | |||
6 | per-user configurations. | |||
7 | ||||
8 | How? The personal manifest. | |||
9 | ||||
10 | Personal manifests live in `modules/people/manifests/<name>.pp`, | |||
11 | where `<name>` is your GitHub username. | |||
12 | A basic personal manifest might look like so: | |||
13 | ||||
14 | ``` puppet | |||
15 | class people::wfarr { | |||
16 | notify { 'hello world': } | |||
17 | } | |||
18 | ``` | |||
19 | ||||
20 | Now, each time `wfarr` runs Boxen it'll automatically print out "hello world" | |||
21 | somewhere during the run. | |||
22 | You can even run `boxen-my-config` to generate a default template for you | |||
23 | and open it up in your editor. |
docs/rails.md
File was created | 1 | # Using Boxen with Rails Projects | ||
2 | ||||
3 | Boxen is designed to work extremely well with Rails. | |||
4 | Let's break down some of the basics: | |||
5 | ||||
6 | ## Project Management | |||
7 | ||||
8 | We make a few assumptions about how you run Rails in development for ease and consistency: | |||
9 | ||||
10 | * You use a web server that listens on a socket | |||
11 | * You use environment variables and something like [dotenv](https://github.com/bkeepers/dotenv) for managing secrets | |||
12 | ||||
13 | A typical Rails app that uses things like MySQL, Resque, and phantomjs | |||
14 | might have a [project definition](../modules/projects/README.md) like so: | |||
15 | ||||
16 | ``` puppet | |||
17 | class projects::rails_app { | |||
18 | include phantomjs | |||
19 | ||||
20 | boxen::project { 'rails_app': | |||
21 | source => 'mycompany/rails_app', | |||
22 | ruby => '1.9.3', | |||
23 | mysql => true, | |||
24 | redis => true, | |||
25 | nginx => true, | |||
26 | } | |||
27 | } | |||
28 | ``` | |||
29 | ||||
30 | This does a few things for you: | |||
31 | ||||
32 | * Clones `https://github.com/mycompany/rails_app.git` to `~/src/rails_app` | |||
33 | * Ensures the default 1.9.3 version of Ruby is installed | |||
34 | * Creates `~/src/rails_app/.ruby-version` with `1.9.3` in it | |||
35 | * Ensures mysql is installed and running | |||
36 | * Creates two mysql databases: `rails_app_test` and `rails_app_development` | |||
37 | * Ensures redis is installed and running | |||
38 | * Ensures nginx is installed and running | |||
39 | * Copies the [template nginx config](../modules/projects/templates/shared/nginx.conf.erb) into the nginx config dir | |||
40 | ||||
41 | It won't necessarily do all of them in that order, but it will gaurantee | |||
42 | that if they run successfully they're all done in a correct order. | |||
43 | ||||
44 | See the section below for some handy configuration tips on how to configure | |||
45 | your app best to work with Boxen. | |||
46 | ||||
47 | ## Configuration | |||
48 | ||||
49 | ### MySQL | |||
50 | ||||
51 | ``` yaml | |||
52 | # config/database.yml | |||
53 | ||||
54 | <% | |||
55 | def boxen?; ENV['BOXEN_HOME']; end | |||
56 | ||||
57 | socket = [ | |||
58 | ENV["BOXEN_MYSQL_SOCKET"], | |||
59 | "/var/run/mysql5/mysqld.sock", | |||
60 | "/tmp/mysql.sock" | |||
61 | ].compact.detect { |f| File.exist? f } | |||
62 | ||||
63 | port = ENV["BOXEN_MYSQL_PORT"] || "3306" | |||
64 | %> | |||
65 | ||||
66 | development: | |||
67 | adapter: mysql2 | |||
68 | database: rails_app_development | |||
69 | username: root | |||
70 | password: | |||
71 | <% if socket %> | |||
72 | host: localhost | |||
73 | socket: <%= socket %> | |||
74 | <% else %> | |||
75 | host: 127.0.0.1 | |||
76 | port: <%= port %> | |||
77 | <% end %> | |||
78 | ||||
79 | test: | |||
80 | adapter: mysql2 | |||
81 | database: rails_app_test | |||
82 | username: root | |||
83 | password: | |||
84 | <% if socket %> | |||
85 | host: localhost | |||
86 | socket: <%= socket %> | |||
87 | <% else %> | |||
88 | host: 127.0.0.1 | |||
89 | port: <%= port %> | |||
90 | <% end %> | |||
91 | ``` | |||
92 | ||||
93 | ### PostgreSQL | |||
94 | ||||
95 | ``` yaml | |||
96 | # config/database.yml | |||
97 | ||||
98 | development: | |||
99 | adapter: postgresql | |||
100 | database: rails_app_development | |||
101 | encoding: unicode | |||
102 | port: <%= ENV["BOXEN_POSTGRESQL_PORT"] || 5432 %> | |||
103 | host: localhost | |||
104 | ||||
105 | test: | |||
106 | adapter: postgresql | |||
107 | database: rails_app_test | |||
108 | encoding: unicode | |||
109 | port: <%= ENV["BOXEN_POSTGRESQL_PORT"] || 5432 %> | |||
110 | host: localhost | |||
111 | ``` | |||
112 | ||||
113 | ### Redis | |||
114 | ||||
115 | ``` ruby | |||
116 | # config/initializers/redis.rb | |||
117 | ||||
118 | $redis = Redis.new(ENV['BOXEN_REDIS_URL'] || 'redis://localhost:6379/') | |||
119 | ``` | |||
120 | ||||
121 | ### Elasticsearch | |||
122 | ||||
123 | ``` ruby | |||
124 | # config/initializers/elasticsearch.rb | |||
125 | ||||
126 | Tire.configure do | |||
127 | url (ENV['BOXEN_ELASTICSEARCH_URL'] || 'http://localhost:9200/') | |||
128 | end | |||
129 | ``` | |||
130 | ||||
131 | ### MongoDB | |||
132 | ||||
133 | ``` yaml | |||
134 | # config/mongo.yml | |||
135 | ||||
136 | development: | |||
137 | host: 127.0.0.1 | |||
138 | port: <%= ENV['GH_MONGODB_PORT'] || 27017 %> | |||
139 | database: rails_app_development | |||
140 | ||||
141 | test: |