Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 97 lines (67 sloc) 2.556 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
e413b66 Anatoliy Chakkaev Different job names for production and other envs
authored
73
74 # display last 100 lines of application log
75 task 'log', ->
76 run "tail -n 100 #{roco.sharedPath}/log/#{roco.env}.log"
45070dd Anatoliy Chakkaev Update README.md
authored
77 ```
78
79 ## Deploy
80
81 Current deploy script allows you deploy upstart-controlled applications out of box, just run
82
83 roco deploy:setup:upstart
84
85 to setup upstart script and create dirs, if you use another solution for node daemon management
86 feel free to rewrite start/stop/restart scripts:
87
88 ```coffee-script
89 namespace 'deploy', ->
f0909e8 Anatoliy Chakkaev Update README.md
authored
90 task 'start', (done) -> run "cd #{roco.currentPath}; forever start server.js"
91 task 'stop', (done) -> run "cd #{roco.currentPath}; forever stop"
45070dd Anatoliy Chakkaev Update README.md
authored
92 ```
93
94 ## License
95
e413b66 Anatoliy Chakkaev Different job names for production and other envs
authored
96 MIT
Something went wrong with that request. Please try again.