Skip to content

Commit d01d3ee

Browse files
committed
Improve Installation
1 parent cec10fe commit d01d3ee

3 files changed

Lines changed: 82 additions & 6 deletions

File tree

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ $boot2docker ip
3939
$docker run -t -i code /bin/bash
4040
```
4141

42-
Vagrant Installation
42+
Vagrant Installation(Recommended)
4343
--------------------
4444

4545
```
4646
$cd code
47-
vagrant up
47+
$vagrant up
48+
$vagrant ssh
49+
# In ubuntu. we use `supervisor` monitor and control CODE and other services.
50+
#You just go web http://localhost:8200
4851
```
4952

5053
Quick Installation
@@ -57,14 +60,26 @@ Currently supports the following systems:
5760
* opensuse
5861
* archlinux
5962

60-
You only to excute:
63+
You only to execute:
6164

6265
```
63-
bash <(curl -s https://raw.githubusercontent.com/douban/code/master/scripts/install_code.sh)
66+
$bash <(curl -s https://raw.githubusercontent.com/douban/code/master/scripts/install_code.sh)
6467
```
6568

66-
Notes: The install script in `code/scripts` subdirectory, for example ubuntu/debian,
67-
You can see `code/scripts/ubuntu.sh`
69+
Then install & run `supervisor` to monitor and control all services of code.
70+
71+
```
72+
pip install supervisor
73+
sudo wget -O /etc/init.d/supervisor https://raw.githubusercontent.com/Supervisor/initscripts/master/ubuntu
74+
sudo chmod +x /etc/init.d/supervisor
75+
sudo cp scripts/supervisord.conf /etc/supervisord.conf
76+
sudo cp scripts/code.conf /etc/supervisor/conf.d/code.conf
77+
sudo /etc/init.d/supervisor start
78+
# go web http://localhost:8200
79+
```
80+
81+
Notes: The install script in `scripts` subdirectory, for example ubuntu/debian,
82+
You can see `scripts/ubuntu.sh`
6883

6984
FAQ
7085
----

scripts/code.conf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[program:code]
2+
command=/home/vagrant/code/venv/bin/gunicorn -w 1 -b 0.0.0.0:8200 app:app
3+
directory=/home/vagrant/code
4+
startsecs=0
5+
stopwaitsecs=0
6+
redirect_stderr=true
7+
stdout_logfile=/home/vagrant/log/code.log
8+
[program:memcached_7901]
9+
command=memcached -u nobody -l 127.0.0.1 -p 7901 -U 0
10+
redirect_stderr=true
11+
stdout_logfile=/home/vagrant/log/memcached.log
12+
[program:memcached_7902]
13+
command=memcached -u nobody -l 127.0.0.1 -p 7902 -U 0
14+
redirect_stderr=true
15+
stdout_logfile=/home/vagrant/log/memcached.log
16+
[program:memcached_7903]
17+
command=memcached -u nobody -l 127.0.0.1 -p 7903 -U 0
18+
redirect_stderr=true
19+
stdout_logfile=/home/vagrant/log/memcached.log
20+
[program:memcached_11311]
21+
command=memcached -m 64 -p 11311 -u memcache -l 127.0.0.1
22+
redirect_stderr=true
23+
stdout_logfile=/home/vagrant/log/memcached.log
24+
[program:grunt_watch]
25+
directory=/home/vagrant/code
26+
command=grunt watch
27+
redirect_stderr=true
28+
stdout_logfile=/home/vagrant/log/watch.log
29+
[program:webpack_watch]
30+
directory=/home/vagrant/code
31+
command=/home/vagrant/code/node_modules/.bin/webpack --progress --colors --watch
32+
redirect_stderr=true
33+
stdout_logfile=/home/vagrant/log/watch.log

scripts/supervisord.conf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
; supervisor config file
2+
3+
[unix_http_server]
4+
file=/var/run/supervisor.sock ; (the path to the socket file)
5+
chmod=0766 ; sockef file mode (default 0700)
6+
7+
[supervisord]
8+
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
9+
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
10+
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
11+
12+
; the below section must remain in the config file for RPC
13+
; (supervisorctl/web interface) to work, additional interfaces may be
14+
; added by defining them in separate rpcinterface: sections
15+
[rpcinterface:supervisor]
16+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
17+
18+
[supervisorctl]
19+
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
20+
21+
; The [include] section can just contain the "files" setting. This
22+
; setting can list multiple files (separated by whitespace or
23+
; newlines). It can also contain wildcards. The filenames are
24+
; interpreted as relative to this file. Included files *cannot*
25+
; include files themselves.
26+
27+
[include]
28+
files = /etc/supervisor/conf.d/*.conf

0 commit comments

Comments
 (0)