2012-05-07 17:08:58 +04:00
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
|
|
|
|
|
|
<title>Utiliser supervisor — 0bin 0.1 documentation</title>
|
|
|
|
|
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
|
2012-05-07 17:08:58 +04:00
|
|
|
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
var DOCUMENTATION_OPTIONS = {
|
|
|
|
|
URL_ROOT: '../',
|
|
|
|
|
VERSION: '0.1',
|
|
|
|
|
COLLAPSE_INDEX: false,
|
|
|
|
|
FILE_SUFFIX: '.html',
|
|
|
|
|
HAS_SOURCE: true
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/javascript" src="../_static/jquery.js"></script>
|
|
|
|
|
<script type="text/javascript" src="../_static/underscore.js"></script>
|
|
|
|
|
<script type="text/javascript" src="../_static/doctools.js"></script>
|
|
|
|
|
<link rel="top" title="0bin 0.1 documentation" href="../index.html" />
|
2012-05-19 00:18:40 +04:00
|
|
|
|
<link rel="next" title="Personnaliser l’apparence" href="theming.html" />
|
2012-05-07 17:08:58 +04:00
|
|
|
|
<link rel="prev" title="Installation avec Nginx" href="nginx_install.html" />
|
|
|
|
|
</head>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<body role="document">
|
|
|
|
|
<div class="related" role="navigation" aria-label="related navigation">
|
2012-05-07 17:08:58 +04:00
|
|
|
|
<h3>Navigation</h3>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="right" style="margin-right: 10px">
|
|
|
|
|
<a href="../genindex.html" title="General Index"
|
|
|
|
|
accesskey="I">index</a></li>
|
|
|
|
|
<li class="right" >
|
2012-05-19 00:18:40 +04:00
|
|
|
|
<a href="theming.html" title="Personnaliser l’apparence"
|
2012-05-07 17:08:58 +04:00
|
|
|
|
accesskey="N">next</a> |</li>
|
|
|
|
|
<li class="right" >
|
|
|
|
|
<a href="nginx_install.html" title="Installation avec Nginx"
|
|
|
|
|
accesskey="P">previous</a> |</li>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<li class="nav-item nav-item-0"><a href="../index.html">0bin 0.1 documentation</a> »</li>
|
2012-05-07 17:08:58 +04:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="document">
|
|
|
|
|
<div class="documentwrapper">
|
|
|
|
|
<div class="bodywrapper">
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<div class="body" role="main">
|
2012-05-07 17:08:58 +04:00
|
|
|
|
|
|
|
|
|
<div class="section" id="utiliser-supervisor">
|
|
|
|
|
<h1>Utiliser supervisor<a class="headerlink" href="#utiliser-supervisor" title="Permalink to this headline">¶</a></h1>
|
2012-05-19 00:18:40 +04:00
|
|
|
|
<p>Supervisor est un très bon moyen de gérer des processus Python. Nous n’allons
|
|
|
|
|
pas couvrir son installation (qui la plupart du temps se résume à
|
|
|
|
|
apt-get install supervisor ou pip install supervisor), mais voici un rapide
|
|
|
|
|
résumé de comment l’utiliser:</p>
|
|
|
|
|
<p>Créez un fichier de configuration nommé supervisor.ini:</p>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<div class="highlight-python"><div class="highlight"><pre>[unix_http_server]
|
2012-05-19 00:18:40 +04:00
|
|
|
|
file=/tmp/supervisor.sock;
|
|
|
|
|
|
|
|
|
|
[supervisorctl]
|
|
|
|
|
serverurl=unix:///tmp/supervisor.sock;
|
|
|
|
|
|
|
|
|
|
[rpcinterface:supervisor]
|
|
|
|
|
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
|
|
|
|
|
|
|
|
|
|
[supervisord]
|
|
|
|
|
logfile=/tmp/zerobin.log
|
|
|
|
|
logfile_maxbytes=50MB
|
|
|
|
|
logfile_backups=2
|
|
|
|
|
loglevel=trace
|
|
|
|
|
pidfile=/tmp/supervisord.pid
|
|
|
|
|
nodaemon=false
|
|
|
|
|
minfds=1024
|
|
|
|
|
minprocs=200
|
|
|
|
|
user=zerobin
|
|
|
|
|
|
|
|
|
|
[program:zerobin]
|
|
|
|
|
command=/chemin/vers/zerobin/zerobin.py --port 80 --compressed-static
|
|
|
|
|
directory=/chemin/vers/zerobin/
|
2015-05-10 20:53:55 +03:00
|
|
|
|
environment=PYTHONPATH='/chemin/vers/zerobin/'
|
2012-05-19 00:18:40 +04:00
|
|
|
|
user=zerobin
|
|
|
|
|
autostart=true
|
2015-05-10 20:53:55 +03:00
|
|
|
|
autorestart=true
|
|
|
|
|
</pre></div>
|
2012-05-19 00:18:40 +04:00
|
|
|
|
</div>
|
|
|
|
|
<p>Les 4 premières entrées sont juste de la configuration standard et vous pouvez
|
|
|
|
|
les copier telles qu’elles.</p>
|
|
|
|
|
<p>La dernière entrée définie un processus (il peut y en avoir plusieurs)
|
|
|
|
|
que supervisor doit gérer.</p>
|
|
|
|
|
<p>Cela veut dire qu’il va lancer la commande:</p>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<div class="highlight-python"><div class="highlight"><pre>/chemin/vers/zerobin/zerobin.py --port 80 --compressed-static
|
|
|
|
|
</pre></div>
|
2012-05-19 00:18:40 +04:00
|
|
|
|
</div>
|
|
|
|
|
<p>Et ceci dans le dossier, avec l’environnement et l’utilisateur défini, le tout
|
|
|
|
|
en arrière plan en tant que daemon.</p>
|
|
|
|
|
<p><cite>autostart</cite> et <cite>autorestart</cite> permettent simplement de le lancer et de l’oublier:
|
|
|
|
|
supervisor redémarera le processus automatiquement en cas d’arrêt impromptu.</p>
|
|
|
|
|
<p>La première fois que vous lancez supervisor, passez lui le fichier de configuration:</p>
|
|
|
|
|
<div class="highlight-python"><div class="highlight"><pre><span class="n">supervisord</span> <span class="o">-</span><span class="n">c</span> <span class="o">/</span><span class="n">chemin</span><span class="o">/</span><span class="n">vers</span><span class="o">/</span><span class="n">supervisor</span><span class="o">.</span><span class="n">ini</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>Ensuite vous pouvez gérer les processus avec:</p>
|
|
|
|
|
<div class="highlight-python"><div class="highlight"><pre><span class="n">supervisorctl</span> <span class="o">-</span><span class="n">c</span> <span class="o">/</span><span class="n">chemin</span><span class="o">/</span><span class="n">vers</span><span class="o">/</span><span class="n">supervisor</span><span class="o">.</span><span class="n">ini</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>Cela va démarrer un shell depuis lequel vous pouvez faire un start/stop/restart
|
|
|
|
|
sur le service.</p>
|
|
|
|
|
<p>Toutes les erreurs seront logguées dans /tmp/zerobin.log.</p>
|
|
|
|
|
<div class="admonition note">
|
|
|
|
|
<p class="first admonition-title">Note</p>
|
|
|
|
|
<p>Si vous avez installé zerobin dans un virtualenv, vous devriez définir la
|
|
|
|
|
commande pour qu’elle s’éxécute depuis le virtualenv:</p>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<div class="last highlight-python"><div class="highlight"><pre>command=/chemin/vers/le/virtualenv/bin/zerobin --port 80 --compressed-static
|
|
|
|
|
</pre></div>
|
2012-05-19 00:18:40 +04:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2012-05-07 17:08:58 +04:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
2012-05-07 17:08:58 +04:00
|
|
|
|
<div class="sphinxsidebarwrapper">
|
|
|
|
|
<h4>Previous topic</h4>
|
|
|
|
|
<p class="topless"><a href="nginx_install.html"
|
|
|
|
|
title="previous chapter">Installation avec Nginx</a></p>
|
|
|
|
|
<h4>Next topic</h4>
|
|
|
|
|
<p class="topless"><a href="theming.html"
|
2012-05-19 00:18:40 +04:00
|
|
|
|
title="next chapter">Personnaliser l’apparence</a></p>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<div role="note" aria-label="source link">
|
|
|
|
|
<h3>This Page</h3>
|
|
|
|
|
<ul class="this-page-menu">
|
|
|
|
|
<li><a href="../_sources/fr/using_supervisor.txt"
|
|
|
|
|
rel="nofollow">Show Source</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="searchbox" style="display: none" role="search">
|
2012-05-07 17:08:58 +04:00
|
|
|
|
<h3>Quick search</h3>
|
|
|
|
|
<form class="search" action="../search.html" method="get">
|
|
|
|
|
<input type="text" name="q" />
|
|
|
|
|
<input type="submit" value="Go" />
|
|
|
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
|
|
|
<input type="hidden" name="area" value="default" />
|
|
|
|
|
</form>
|
|
|
|
|
<p class="searchtip" style="font-size: 90%">
|
|
|
|
|
Enter search terms or a module, class or function name.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="clearer"></div>
|
|
|
|
|
</div>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<div class="related" role="navigation" aria-label="related navigation">
|
2012-05-07 17:08:58 +04:00
|
|
|
|
<h3>Navigation</h3>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="right" style="margin-right: 10px">
|
|
|
|
|
<a href="../genindex.html" title="General Index"
|
|
|
|
|
>index</a></li>
|
|
|
|
|
<li class="right" >
|
2012-05-19 00:18:40 +04:00
|
|
|
|
<a href="theming.html" title="Personnaliser l’apparence"
|
2012-05-07 17:08:58 +04:00
|
|
|
|
>next</a> |</li>
|
|
|
|
|
<li class="right" >
|
|
|
|
|
<a href="nginx_install.html" title="Installation avec Nginx"
|
|
|
|
|
>previous</a> |</li>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<li class="nav-item nav-item-0"><a href="../index.html">0bin 0.1 documentation</a> »</li>
|
2012-05-07 17:08:58 +04:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2015-05-10 20:53:55 +03:00
|
|
|
|
<div class="footer" role="contentinfo">
|
2012-05-07 17:08:58 +04:00
|
|
|
|
© Copyright 2012, Sam et Max.
|
2015-05-10 20:53:55 +03:00
|
|
|
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
|
2012-05-07 17:08:58 +04:00
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|