@task
def deploy(new_instance=False):
  # Run yum update/install first. We may have new dependencies.
  yum_install()
  # Push and build haproxy.
  haproxy_install()
  # Stage code, environment, and crontab.
  virtualenv_install()
  code_install()
  install_crontab()

  if not new_instance:
    # Remove backend from load balancer and stop. This would fail on non-running instances.
    drain()
    stop()

  # Flip symlinks.
  virtualenv_activate()
  code_activate()

  # Restart backend and re-add to load balancer.
  restart()
  undrain()
Deploy latest environment and code and restart backends.
dataset/ETHPy150Open viewfinderco/viewfinder/fabfile.py/deploy