Skip to content

Commit 14c38e9

Browse files
brienwrjanja
authored andcommitted
Update documentation to more closely match current usage (#109)
1 parent 4805117 commit 14c38e9

File tree

2 files changed

+55
-25
lines changed

2 files changed

+55
-25
lines changed

README.md

+54-17
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,38 @@ def deps do
1515
end
1616
```
1717

18-
## Configuration
18+
## Quick Start
1919

20-
Configure Bootleg in the deploy config file:
20+
### Configure your release parameters
2121

2222
```elixir
2323
# config/deploy.exs
2424
use Bootleg.Config
2525

26-
config :build_at, "/usr/local/build/myapp/"
27-
config :deploy_to, "/var/www/#{app}" # default
28-
config :releases, "./releases" # path to store releases
29-
config :scm, :git # only one supported right now. Need an alternative? Consider contributing!
26+
role :build, "your-build-server.local", user: "develop", password: "bu1ldm3", workspace "/some/build/workspace"
27+
role :app, ["web1", "web2", "web3"], user: "admin", password: "d3pl0y", workspace "/var/myapp"
28+
```
29+
30+
### build and deploy
31+
32+
```sh
33+
$ mix bootleg.build
34+
$ mix bootleg.deploy
35+
$ mix bootleg.start
3036
```
3137

38+
also see: [Phoenix support](#phoenix-support)
39+
40+
## Configuration
41+
42+
Configure Bootleg in the deploy config file:
43+
3244
```elixir
33-
# config/deploy/production.exs - Create one for each environment you want to build and deploy to
34-
role :build, "build.myapp.com", user, "build", port: "2222"
35-
role :app, ["web1.myapp.com", "web2.myapp.com"], user: "admin"
36-
role :db, ["[email protected]"]
45+
# config/deploy.exs
46+
use Bootleg.Config
47+
48+
role :build, "build.myapp.com", user, "build", port: "2222", workspace: "/tmp/build/myapp"
49+
role :app, ["web1.myapp.com", "web2.myapp.com"], user: "admin", workspace: "/var/www/myapp"
3750
```
3851

3952
## Roles
@@ -52,12 +65,19 @@ role to one host.
5265

5366
### Role and host options
5467

55-
Options are set on roles and on hosts based on the order in which the roles are defined.
68+
Options are set on roles and on hosts based on the order in which the roles are defined. Some are used internally
69+
by bootleg:
70+
71+
* `workspace` - remote path specifying where to perform a build or push a deploy (default `.`)
72+
* `user` - ssh username (default to local user)
73+
* `password` - ssh password
74+
* `identity` - file path of an SSH private key identify file
75+
* `port` - ssh port (default `22`)
5676

5777
#### Examples
5878

5979
```elixir
60-
role :app, ["host1", "host2"], user: "deploy"
80+
role :app, ["host1", "host2"], user: "deploy", identity: "/home/deploy/.ssh/deploy_key.priv"
6181
role :app, ["host2"], port: 2222
6282
```
6383
> In this example, two hosts are declared for the `app` role, both as the user *deploy* but only *host2* will use the non-default port of *2222*.
@@ -125,15 +145,15 @@ mix bootleg.ping production # Check status of running nodes
125145

126146
## Hooks
127147

128-
[VERY MUCH A WIP]
129-
130148
Hooks may be defined by the user in order to perform additional (or exceptional)
131149
operations before or after certain actions performed by bootleg.
132150

133151
Hooks are defined within `config/deploy.exs`. Hooks may be defined to trigger
134152
before or after a task. The following tasks are provided by bootleg:
135153

136-
1. `build` - generation of a release package
154+
1. `build` - build process for creating a release package
155+
1. `compile` - compilation of your project
156+
2. `generate_release` - generation of the release package
137157
2. `deploy` - deploy of a release package
138158
3. `start` - starting of a release
139159
4. `stop` - stopping of a release
@@ -212,7 +232,7 @@ before_task :build do
212232
invoke :custom_event
213233
end
214234

215-
task :custom_task docs
235+
task :custom_task do
216236
IO.puts "World"
217237
end
218238

@@ -275,9 +295,26 @@ remote :app do
275295
end
276296
```
277297

298+
## Phoenix Support
299+
300+
Bootleg builds elixir apps, if your application has extra steps required make use of the hooks
301+
system to add additional functionality. A common case is for building assets for Phoenix
302+
applications. To build phoenix assets during your build, define an after hook handler for the
303+
`:compile` task and place it inside your `config/deploy.exs`.
304+
305+
```elixir
306+
after :compile do
307+
remote :build do
308+
"[ -f package.json ] && npm install || true"
309+
"[ -f brunch-config.js ] && [ -d node_modules ] && ./node_modules/brunch/bin/brunch b -p || true"
310+
"[ -d deps/phoenix ] && mix phoenix.digest || true"
311+
end
312+
end
313+
```
314+
278315
## Help
279316

280-
If something goes wrong, retry with the `--verbose` option.
317+
If something goes wrong, retry with the `--verbose` option.
281318
For detailed information about the bootleg commands and their options, try `mix bootleg help <command>`.
282319

283320
## Examples

USAGE.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
## Distillery
44

5-
### Phoenix Assets
6-
7-
When Phoenix is detected as a dependency, Bootleg will take some extra actions before building a release:
8-
9-
* Brunch will be used to build app assets in production mode
10-
* `mix phoenix.digest` will be called to compress and tag assets for caching
11-
125
### Runtime Configuration
136

147
From the [Distillery docs](https://hexdocs.pm/distillery/runtime-configuration.html#content):
@@ -19,7 +12,7 @@ This means if you are using a 12FA-style environment variable configuration for
1912

2013
One solution is to set `REPLACE_OS_VARS=true` in your build environment and define shell-style variables in configuration strings that Distillery's runtime will automagically replace when first running the build on the target deployment.
2114

22-
config :sauce, api_url: "${SAUCE_API_URL}"
15+
config :sauce, api_url: "${SAUCE_API_URL}"
2316

2417
Another solution is to use [Confex]() or a [configuration wrapper](https://gist.github.com/bitwalker/a4f73b33aea43951fe19b242d06da7b9) that knows how to understand and read configuration values such as `{:system, "VAR"}` from the environment at runtime. However, you may still be at the mercy of your application's dependencies.
2518

0 commit comments

Comments
 (0)