Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 92 lines (64 sloc) 2.422 kb
45070dd Anatoliy Chakkaev Update README.md
authored
1 ## Roco
2
3 Command line tool allows you to execute commands on remote server(s) or locally.
4 Useful for deployment, monitoring and other tasks.
5
6 ## Installation
7
8 npm install roco -g
9
10 ## Usage
11
12 roco deploy:setup # prepare deploy (create directories)
13 roco deploy # update code and restart server
14
15 ## Configuring
16
ef7e670 Anatoliy Chakkaev Update README.md
authored
17 Use one of three ways for configuring your app: package.json, roco.coffee or ENV vars
18
45070dd Anatoliy Chakkaev Update README.md
authored
19 ### package.json
20
21 roco looking for package.json in working directory and set these variables:
22
23 - `pkg.name` as `application`
24 - `pkg.repository.name` as `repository`
25 - `pkg.repository.type` as `scm`
26
27 ### Roco.coffee
28
29 roco looking for Roco.coffee file in `/etc/roco.coffee`, `~/.roco.coffee`, `./Roco.coffee`, `./config/Roco.coffee` paths
30
31 This files can extend behavior of roco and configure variables. Checkout examples to learn how to use it
32
33 ### ENV vars
34
35 - `HOSTS` - comma separated list of hosts
36 - `APP` - name of application
37
38 ## Examples
39
40 ### my ~/.roco.coffee file
41
42 ```coffee-script
43 namespace 'deploy', ->
44 # show status of running application
45 task 'status', ->
46 run "sudo status #{roco.application}"
47
48 namespace 'git', ->
49 # setup remote private repo
50 task 'remote', ->
51 app = roco.application
52 run """
53 mkdir #{app}.git;
54 cd #{app}.git;
55 git --bare init;
56 true
57 """, (res) ->
58 localRun """
59 git remote add origin #{res[0].host}:#{app}.git;
60 git push -u origin master
61 """
62
63 # some tasks for monitoring server state
64 namespace 'i', ->
65 task 'disk', (done) -> run 'df -h', done
66 task 'top', (done) -> run 'top -b -n 1 | head -n 12', done
67 task 'who', (done) -> run 'who', done
68 task 'node', (done) -> run 'ps -eo args | grep node | grep -v grep', done
69 task 'free', (done) -> run 'free', done
70
71 task 'all', (done) ->
72 sequence 'top', 'free', 'disk', 'node', done
73 ```
74
75 ## Deploy
76
77 Current deploy script allows you deploy upstart-controlled applications out of box, just run
78
79 roco deploy:setup:upstart
80
81 to setup upstart script and create dirs, if you use another solution for node daemon management
82 feel free to rewrite start/stop/restart scripts:
83
84 ```coffee-script
85 namespace 'deploy', ->
86 task 'start', (done) -> run "cd #{roco.application}; forever start server.js"
87 task 'stop', (done) -> run "cd #{roco.application}; forever stop"
88 ```
89
90 ## License
91
92 MIT
Something went wrong with that request. Please try again.