Commit 6fcf510f21e12c1b0cea71098bf65fad957737ee
1 parent
7beea81e
Exists in
master
and in
39 other branches
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,6 +44,7 @@ env.use_shell = False | ||
44 | PROJECT_PATH = os.path.join(os.path.dirname(__file__)) | 44 | PROJECT_PATH = os.path.join(os.path.dirname(__file__)) |
45 | REPO_PATH = '/home/{}/{}'.format(APP_USER, APP_NAME) | 45 | REPO_PATH = '/home/{}/{}'.format(APP_USER, APP_NAME) |
46 | SOURCE_VENV = 'source /usr/local/bin/virtualenvwrapper.sh' | 46 | SOURCE_VENV = 'source /usr/local/bin/virtualenvwrapper.sh' |
47 | + | ||
47 | WORKON_ENV = '{} && workon {}'.format(SOURCE_VENV, VENV_NAME) | 48 | WORKON_ENV = '{} && workon {}'.format(SOURCE_VENV, VENV_NAME) |
48 | MANAGE_PATH = os.path.join(REPO_PATH, 'src') | 49 | MANAGE_PATH = os.path.join(REPO_PATH, 'src') |
49 | SETTINGS_PATH = os.path.join(MANAGE_PATH, APP_NAME) | 50 | SETTINGS_PATH = os.path.join(MANAGE_PATH, APP_NAME) |
@@ -106,6 +107,7 @@ def install_requirements(): | @@ -106,6 +107,7 @@ def install_requirements(): | ||
106 | 107 | ||
107 | def mkvirtualenv(): | 108 | def mkvirtualenv(): |
108 | if not exists('~/.virtualenvs/' + VENV_NAME): | 109 | if not exists('~/.virtualenvs/' + VENV_NAME): |
110 | + | ||
109 | with prefix(SOURCE_VENV): | 111 | with prefix(SOURCE_VENV): |
110 | run('mkvirtualenv ' + VENV_NAME) | 112 | run('mkvirtualenv ' + VENV_NAME) |
111 | return True | 113 | return True |
@@ -169,6 +171,7 @@ def bootstrap(): | @@ -169,6 +171,7 @@ def bootstrap(): | ||
169 | 171 | ||
170 | if not exists('/usr/bin/git'): | 172 | if not exists('/usr/bin/git'): |
171 | package_install('git-core') | 173 | package_install('git-core') |
174 | + package_install('wget') | ||
172 | 175 | ||
173 | if env.is_vagrant: | 176 | if env.is_vagrant: |
174 | groups = ['sudo', 'vagrant'] | 177 | groups = ['sudo', 'vagrant'] |
@@ -244,6 +247,8 @@ def ssh_keygen(): | @@ -244,6 +247,8 @@ def ssh_keygen(): | ||
244 | def deploy(noprovision=False): | 247 | def deploy(noprovision=False): |
245 | """Deploy and run the new code (master branch)""" | 248 | """Deploy and run the new code (master branch)""" |
246 | 249 | ||
250 | + fix_path() | ||
251 | + | ||
247 | if noprovision is False: | 252 | if noprovision is False: |
248 | provision() | 253 | provision() |
249 | else: | 254 | else: |
@@ -266,6 +271,14 @@ def deploy(noprovision=False): | @@ -266,6 +271,14 @@ def deploy(noprovision=False): | ||
266 | sudo('supervisorctl start all') | 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 | @task | 282 | @task |
270 | def install_solr(): | 283 | def install_solr(): |
271 | """Install Solr""" | 284 | """Install Solr""" |