Skip to content

HTTPS clone URL

Subversion checkout URL

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