Commit 6fcf510f21e12c1b0cea71098bf65fad957737ee

Authored by Gust
1 parent 7beea81e

Update fabfile to support centos deploy

Showing 1 changed file with 13 additions and 0 deletions   Show diff stats
fabfile.py
... ... @@ -44,6 +44,7 @@ env.use_shell = False
44 44 PROJECT_PATH = os.path.join(os.path.dirname(__file__))
45 45 REPO_PATH = '/home/{}/{}'.format(APP_USER, APP_NAME)
46 46 SOURCE_VENV = 'source /usr/local/bin/virtualenvwrapper.sh'
  47 +
47 48 WORKON_ENV = '{} && workon {}'.format(SOURCE_VENV, VENV_NAME)
48 49 MANAGE_PATH = os.path.join(REPO_PATH, 'src')
49 50 SETTINGS_PATH = os.path.join(MANAGE_PATH, APP_NAME)
... ... @@ -106,6 +107,7 @@ def install_requirements():
106 107  
107 108 def mkvirtualenv():
108 109 if not exists('~/.virtualenvs/' + VENV_NAME):
  110 +
109 111 with prefix(SOURCE_VENV):
110 112 run('mkvirtualenv ' + VENV_NAME)
111 113 return True
... ... @@ -169,6 +171,7 @@ def bootstrap():
169 171  
170 172 if not exists('/usr/bin/git'):
171 173 package_install('git-core')
  174 + package_install('wget')
172 175  
173 176 if env.is_vagrant:
174 177 groups = ['sudo', 'vagrant']
... ... @@ -244,6 +247,8 @@ def ssh_keygen():
244 247 def deploy(noprovision=False):
245 248 """Deploy and run the new code (master branch)"""
246 249  
  250 + fix_path()
  251 +
247 252 if noprovision is False:
248 253 provision()
249 254 else:
... ... @@ -266,6 +271,14 @@ def deploy(noprovision=False):
266 271 sudo('supervisorctl start all')
267 272  
268 273  
  274 +def fix_path():
  275 + global SOURCE_VENV
  276 + global WORKON_ENV
  277 + if exists('/usr/bin/virtualenvwrapper.sh'):
  278 + SOURCE_VENV = 'source /usr/bin/virtualenvwrapper.sh'
  279 + WORKON_ENV = '{} && workon {}'.format(SOURCE_VENV, VENV_NAME)
  280 +
  281 +
269 282 @task
270 283 def install_solr():
271 284 """Install Solr"""
... ...