Created
September 17, 2012 14:26
-
-
Save Glideh/3737658 to your computer and use it in GitHub Desktop.
A pretty fabfile to deploy a symfony2 project
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
from fabric.api import * | |
from fabric.colors import green | |
env.hosts = ['my_user@my_host'] | |
env.password = 'my_password' | |
env.app_path = 'my/app/path' | |
def commit(): | |
print(green("Commit last modifs...")) | |
local('git add -A && git commit') | |
def pushpull(): | |
with cd(env.app_path): | |
print(green("Pushing to the ref...")) | |
local('git push') | |
print(green("Pulling to the Prod...")) | |
run('git pull') | |
def colstat(): | |
print(green("Prod Collecting Static Files...")) | |
with cd(env.app_path): | |
run('php app/console assets:install web --symlink') | |
def cacheclear(): | |
print(green("Prod Clearing Cache...")) | |
with cd(env.app_path): | |
sudo('php app/console cache:clear --env=prod', user='www-data') | |
def httpdrst(): | |
print(green("Prod Restarting Apache...")) | |
sudo('apache2ctl restart') | |
def deploy(): | |
pushpull() | |
colstat() | |
cacheclear() | |
# syncdb() | |
# httpdrst() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assuming that we should use ssh key instead of plain password set here and ACLs for
www-data
instead of usingsudo
s