Skip to content

Commit

Permalink
adding backupLocalDb.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrant committed Mar 6, 2014
1 parent a61ac1e commit 27cbe51
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backupLocalDB.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
mkdir -p backups
NAME=backups/$1_localhost_`eval date +%Y%m%d_%H%M%S`.sql
mysqldump -u$1 -p$1 $1 > $NAME
gzip $NAME
36 changes: 36 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from fabric.api import run, env, cd, shell_env, execute

env.hosts = ['slice:55555']
ROOT='/home/david/public_html/django/django_kids/public'

def restart():
with cd(ROOT):
run('touch ../../django_kids.ini')

def update():
with cd(ROOT):
run('git pull')

def schema():
with cd(ROOT), shell_env(DJANGO_SETTINGS_MODULE='django_recipes.settings.production'):
run('env/bin/python ./manage.py migrate links')

def backupdb():
with cd(ROOT):
run('./backupLocalDB.sh recipes_kids')

def static():
with cd(ROOT):
run('env/bin/python ./manage.py collectstatic --settings=django_kids.settings.production --noinput --link --clear')

def deploy():
execute(update)
execute(env)
execute(backupdb)
execute(schema)
execute(static)
execute(restart)

def env():
with cd(ROOT):
run('./createVirtualEnv.sh')
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ mock==1.0.1
django-model-utils==2.0
django-widget-tweaks==1.3
pip-tools==0.3.4
fabric==1.8.2

0 comments on commit 27cbe51

Please sign in to comment.