name: Deployment with Supervisord

sort: 2

Supervisord

Supervisord Python ile oluşturulmuş çok kullanışlı bir process (süreç) yöneticisidir. Supervisord deamon olmayan uygulamalarınızı deamon uygulamaya çevirir.

Eğer Supervisord kullanarak nginx’i yönetmek isterseniz deamon özelliğini kapatıp nginx’i deamon olmayan modda çalıştırmanız gerekmektedir.

Supervisord Kurulumu

  1. Kurulum dosyalarını yükleme

    1. wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
    2. sh setuptools-0.6c11-py2.7.egg
    3. easy_install supervisor
    4. echo_supervisord_conf >/etc/supervisord.conf
    5. mkdir /etc/supervisord.conf.d
  2. config /etc/supervisord.conf

    1. [include]
    2. files = /etc/supervisord.conf.d/*.conf
  3. Yönetmek için yeni bir uygulama oluşturulur

    1. cd /etc/supervisord.conf.d
    2. vim beepkg.conf

    Konfigürasyonlar :

    1. [program:beepkg]
    2. directory = /opt/app/beepkg
    3. command = /opt/app/beepkg/beepkg
    4. autostart = true
    5. startsecs = 5
    6. user = root
    7. redirect_stderr = true
    8. stdout_logfile = /var/log/supervisord/beepkg.log

Supervisord Yönetimi

Supervisord iki komut ile çalışır, supervisord ve supervisorctl :

  • supervisord: Supervisord’u hazır hale getirir ve config edilmiş processleri çalıştırır.
  • supervisorctl stop programxxx: programxxx processlerini durdurur. programxxx [program:beepkg] adıyla config edilir. (beepkg)
  • supervisorctl start programxxx: Process çalıştırır.
  • supervisorctl restart programxxx: Processleri tekrar çalıştırır.
  • supervisorctl stop groupworker: Groupworker grubundaki tüm processleri tekrar çalıştırır.
  • supervisorctl stop all: Tüm processleri durdurur. Not : start, stop, restart ve stop son configleri yenilemez (reload yapmaz)
  • supervisorctl reload: Tüm configleri yeniler
  • supervisorctl update: Tüm processleri değişen configleriyle beraber yeniler.

Not : stop komutuyla manuel olarak durdurulan processler, reload veya update işlemlerinden sonra yeniden başlamayacaklardır.