私は django アプリケーションと、同じサーバー上で実行されているその 2 つのインスタンス (運用環境とステージング) を持っています。私は virtualenv を使用しており、各インスタンスには独自の環境があります。それらは次のように構成されています。
- 実稼働(myapp.com): サーバーはポート 8001 で実行されます。Apache は 80 から 8001 にプロキシします。
- ステージング(myapp.com:5000): サーバーはポート 5001 で実行されます。Apache は 5000 から 5001 にプロキシします。
さて、サーバーを手動で立ち上げたところ、すべてが完全に機能しました!
今、私はスーパーバイザーを使用して、それらを個別に管理および展開しようとしています。これにより、組織が改善され、展開が容易になります。私が得たものは本当に奇妙なものです!本番サーバーは正常に動作しますが、ステージング サーバーは本番サーバーとして応答します。
Supervisord を使用しない場合は、myapp.com と myapp.com:5000 にアクセスし、それぞれ実稼働コードとステージング コードが実行されていることを確認します。ただし、supervisord を使用すると、両方で製品コードが表示されます。奇妙なことに、スーパーバイザーがリクエストを間違ったプロセスに送信しているようです... :S
私がしようとしていることをすることは可能ですか?同じ Supervisor.conf で 2 つの Web サーバーを実行することに関する既知の問題はありますか? 誰か手がかりを持っていますか?=/
Supervisor.conf(関連部分)
;;;;;;;;;; supervisord configuration ;;;;;;;;;;
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
;umask=022 ; (process file creation umask;default 022)
;user=chrism ; (default is current user, required if root)
;identifier=supervisor ; (supervisord identifier, default is 'supervisor')
;directory=/tmp ; (default is not to cd during start)
;nocleanup=true ; (don't clean up tempfiles at start;default false)
;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
;environment=KEY=value ; (key value pairs to add to environment)
;strip_ansi=false ; (strip ansi escape codes in logs; def. false)
;;;;;;;;;; applications configuration ;;;;;;;;;;
[program:staging]
command=python manage.py celeryd -B --loglevel=info --settings=settings.staging
command=python manage.py run_gunicorn --workers=2 --bind=127.0.0.1:5001 --settings=settings.staging
autostart=false
[program:production]
command=python manage.py celeryd -B --loglevel=info --settings=settings.production
command=python manage.py run_gunicorn --workers=2 --bind=127.0.0.1:8001 --settings=settings.production
autostart=false
obs: ウェブサーバーの初期化に使用されるコマンドは、上記のプログラム セクションのものです。
どうもありがとう!