Skip to content

Commit 73f2c3d

Browse files
committed
Add supervisord contrib example
Useful for running a development instance really quickly. Doesn't yet support: * ipdb/pdb, but still supports rdb * color log output
1 parent faa2308 commit 73f2c3d

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
.ropeproject/
1616
_build
1717
bower_components/
18+
contrib/supervisord.log
1819
deploy/.vagrant
1920
dist/*
2021
local_settings.py

contrib/readme.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Running Read the Docs via Supervisord
2+
=====================================
3+
4+
This is the easiest way to start all of the commands you'll need for development
5+
in an environment relatively close to the production evironment. All you need is
6+
``supervisord`` and ``redis-server``. Installation of ``redis-server`` is
7+
outside the scope of this documentation, but once installed, all you need to run
8+
from ``supervisord`` is::
9+
10+
pip install supervisord
11+
cd contrib/
12+
supervisord
13+
14+
This will bring up a web instance for the dashboard, a web instance for
15+
documentation serving, two celery instances, and redis-server.
16+
17+
Debugging
18+
---------
19+
20+
Because supervisord doesn't redirect stdin to the various processes, ``ipdb``
21+
and ``pdb`` will hang. You can still use ``pdb`` through telnet though!:
22+
23+
def method_you_want_to_test(self):
24+
...
25+
from celery.contrib import rdb; rdb.set_trace()
26+
...
27+
28+
This will pause and give you a telnet port to connect to. Then simply::
29+
30+
% telnet 127.0.0.1 6900

contrib/supervisord.conf

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[supervisord]
2+
nodaemon = True
3+
directory = ../
4+
loglevel = error
5+
strip_ansi = False
6+
environment = PYTHONUNBUFFERED=1
7+
8+
[program:redis]
9+
command = redis-server
10+
directory = ../
11+
priority = 0
12+
stdout_logfile=/dev/stdout
13+
stdout_logfile_maxbytes=0
14+
stderr_logfile=/dev/stderr
15+
stderr_logfile_maxbytes=0
16+
17+
[program:main]
18+
command = python manage.py runserver 8000
19+
directory = ../
20+
priority = 100
21+
stopasgroup=True
22+
stdout_logfile=/dev/stdout
23+
stdout_logfile_maxbytes=0
24+
stderr_logfile=/dev/stderr
25+
stderr_logfile_maxbytes=0
26+
27+
[program:serve]
28+
command = python manage.py runserver 8001
29+
directory = ../
30+
priority = 100
31+
stopasgroup=True
32+
stdout_logfile=/dev/stdout
33+
stdout_logfile_maxbytes=0
34+
stderr_logfile=/dev/stderr
35+
stderr_logfile_maxbytes=0
36+
37+
[program:build]
38+
command = celery worker -A readthedocs -Q default,celery,web,builder -l DEBUG
39+
process_name = build-%(process_num)s
40+
directory = ../
41+
priority = 100
42+
numprocs = 2
43+
stopasgroup=True
44+
stdout_logfile=/dev/stdout
45+
stdout_logfile_maxbytes=0
46+
stderr_logfile=/dev/stderr
47+
stderr_logfile_maxbytes=0

0 commit comments

Comments
 (0)