LoginSignup
3
3

More than 5 years have passed since last update.

Fabricでgunicornのデーモン化ができなかったアレ

Posted at

経緯

Djangoでアプリを作っていてfabricとcuisineを使って環境構築をコード化していたんですが、どうにもgunicornがうまくデーモン化されません。
デーモン化のオプションを外すと実行はされるので、設定が間違ってるとかではないと思います。

動かなくて困ってるコマンド

puts(green('Starting gunicorn process...'))
with cd(project_root_path):
    run('gunicorn {}.wsgi:application -c gunicorn_conf.py'.format(project_name))

解決策

pty=Falseにしてやるだけです。理由とかは面倒なので読んでませんw

run('gunicorn {}.wsgi:application -c gunicorn_conf.py'.format(project_name), pty=False)

参考

http://www.fabfile.org/faq.html#init-scripts-don-t-work
ここのInit scripts don’t work!を読むと分かります。
詳しく読んでないですが、なんか上手く動かないことがあるっぽいですね。

僕の場合、nginxやtd-agentの起動とかストップは動きましたが、パッケージとして管理してないgunicornは動かなかったということですね。

とりあえず、これでコマンド一発でサーバーの環境構築とデプロイが済みます

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3