Skip to content

Commit 2e39d5f

Browse files
authored
Add supervisord contrib example (#3262)
* 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 * Revert to celery concurrency * Updates
1 parent 02cc08f commit 2e39d5f

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-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: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
If you already are running redis-server, this will complain about the port
18+
already being in use, but will still load.
19+
20+
Debugging
21+
---------
22+
23+
To debug, set trace points like normal, with ``pdb``/``ipdb``. Then you can
24+
connect to the process by bringing it to the foreground::
25+
26+
supervisorctl fg main
27+
28+
You'll still see logging to STDERR on the main supervisord process page.

contrib/supervisord.conf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[supervisord]
2+
nodaemon = True
3+
directory = ../
4+
loglevel = error
5+
strip_ansi = False
6+
environment = PYTHONUNBUFFERED=1,READTHEDOCS_INSTANCE=readthedocs.org
7+
8+
[inet_http_server]
9+
port = 127.0.0.1:9001
10+
username = 🍔
11+
password = 🍟
12+
13+
[supervisorctl]
14+
username = 🍔
15+
password = 🍟
16+
17+
[rpcinterface:supervisor]
18+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
19+
20+
[program:redis]
21+
command = redis-server
22+
directory = ../
23+
priority = 0
24+
startretries = 0
25+
stderr_logfile = /dev/stderr
26+
stderr_logfile_maxbytes = 0
27+
28+
[program:main]
29+
command = python manage.py runserver 8000
30+
directory = ../
31+
priority = 100
32+
stopasgroup = True
33+
stderr_logfile = /dev/stderr
34+
stderr_logfile_maxbytes = 0
35+
36+
[program:celery]
37+
command = celery worker -A readthedocsinc -Q default,celery,web,builder -l DEBUG -c 2
38+
directory = ../
39+
priority = 100
40+
stopasgroup = True
41+
stderr_logfile = /dev/stderr
42+
stderr_logfile_maxbytes = 0

0 commit comments

Comments
 (0)