簡體   English   中英

通過擴展和最少的停機時間部署到生產環境?

[英]Deploying to production with buildout and minimal downtime?

我有一個 django + wsgi 的擴展,在開發和生產上運行良好。 唯一的問題是,當我對 buildout.cfg 進行更改或添加並且必須運行 bin/buildout 時,網站會從 buildout 開始到完成時離線。 這可能需要 5 分鍾以上。

有沒有辦法在生產中優雅地運行構建? 也許我不知道的一個參數會在不先卸載所有東西的情況下運行構建? 該站點在一台 web 服務器上運行。 負載均衡器和額外的 web 服務器將是一個很好的解決方案,但目前不可行。

歡迎對我的構建腳本提出任何其他評論/建議/批評。

謝謝!

這是我的 buildout.cfg:

[buildout]
download-cache = downloads
unzip = true
parts =
    scripts
    django
    djangoprod

eggs = 
    ${scripts:eggs} 
    ${pipscripts:eggs}

[scripts]
recipe = zc.recipe.egg
unzip = true
download-cache = ${buildout:download-cache}
eggs =
    ipython
    docutils
    feedparser
    pygments
    South
    django-grappelli
    django-extensions
    django-mobile
    django-photologue
    django-filebrowser
    django-indexer
    django-paging
    django-templatetag-sugar
    django-sentry
    MySQL-python

find-links =
    http://dist.repoze.org/
    http://github.com/
    http://bitbucket.org/
    http://googlecode.com/
    http://surfnet.dl.sourceforge.net/

[pipscripts]
recipe = gp.recipe.pip
unzip = true
download-cache = ${buildout:download-cache}
editables = 
    hg+https://bitbucket.org/ubernostrum/django-registration#egg=django_registration
    git://github.com/jtauber/django-mailer.git#egg=django_mailer
eggs = 
    django-registration
    django-mailer
    PIL
install =
    http://effbot.org/downloads/Imaging-1.1.7.tar.gz

[django]
recipe = djangorecipe
download-cache = ${buildout:download-cache}
eggs = ${buildout:eggs}
version = 1.3
project = project

[djangoprod]
recipe = djangorecipe
download-cache = ${django:download-cache}
version = ${django:version}
settings = production
wsgi = true
eggs = ${django:eggs}
project = ${django:project}

Buildout 只會更新配置已更改的部分(或在愚蠢的配方實施的情況下)。 一種選擇是將構建配置復制/簽出到新位置重新運行構建,然后停止舊實例,然后在新安裝上重新啟動實例。 在某些情況下,我們會維護安裝,例如

/data/buildout_<date1>
/data/buildout_<date2>
/data/current

其中 'current' 是指向當前 'buildout_' 安裝的符號鏈接。

當然:在負載均衡器后面運行多個實例,在構建階段從均衡器中刪除一個實例是一種選擇。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM