Created
September 14, 2014 16:24
-
-
Save jacquesbh/349c538bdbf179fd333b to your computer and use it in GitHub Desktop.
Article Fabric and Magento • http://jacques.sh/2014/09/fabric-magento.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@task | |
def backup(): | |
""" Backup Backup Backup """ | |
if not _has_tag('backup'): | |
abort("Hum… What are you doing? Dude, this server is not allowed to backup!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clean cache | |
if _has_tag('redis'): | |
run('redis-cli -n 0 flushdb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@task | |
@parallel | |
def deploy(): | |
""" Deploy Deploy Deploy """ | |
# Pull the sources | |
with cd('/var/www/www.mon-projet.net/') | |
run('git pull') | |
# Clean cache | |
run('redis-cli -n 0 flushdb') | |
# Reindex | |
with cd('/var/www/www.mon-projet.net/shell/') | |
run('php indexer.php reindexall') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@task | |
@parallel | |
def deploy(): | |
""" Deploy Deploy Deploy """ | |
# pull the project | |
if _has_tag('www'): | |
with cd(_get_setting('path')): | |
run('git pull') | |
# clean the cache | |
if _has_tag('redis'): | |
run('redis-cli -n 0 flushdb') | |
# reindex | |
if _has_tag('database'): | |
with cd(_get_setting('path') + 'shell/'): | |
run('php indexer.php reindexall') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _get_setting(setting=False,host=False): | |
""" Returns the host's settings (or the specified one) """ | |
if not host: | |
host = env.host | |
settings = env.settings_by_host[host] | |
if not setting: | |
return settings | |
return settings[setting] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hosts | |
env.hosts = ['[email protected]:22', '[email protected]:22'] | |
# Settings | |
env.settings_by_host = { | |
'front.mon-projet.net': { | |
'tags': 'www', | |
'path': '/var/www/www.mon-projet.net/' | |
}, | |
'back.mon-projet.net': { | |
'tags': 'www redis database', | |
'path': '/var/www/admin.mon-projet.net/' | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment