community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r1694763 - in /comdev/tools: fixtures/backup_data.json readme.md scripts/backup.sh
Date Sat, 08 Aug 2015 05:35:07 GMT
Author: rgardler
Date: Sat Aug  8 05:35:07 2015
New Revision: 1694763

URL: http://svn.apache.org/r1694763
Log:
initial backup file

Added:
    comdev/tools/fixtures/backup_data.json
Modified:
    comdev/tools/readme.md
    comdev/tools/scripts/backup.sh

Added: comdev/tools/fixtures/backup_data.json
URL: http://svn.apache.org/viewvc/comdev/tools/fixtures/backup_data.json?rev=1694763&view=auto
==============================================================================
--- comdev/tools/fixtures/backup_data.json (added)
+++ comdev/tools/fixtures/backup_data.json Sat Aug  8 05:35:07 2015
@@ -0,0 +1 @@
+[{"fields": {"name": "Apache"}, "model": "events_list.hashtag", "pk": 1}]
\ No newline at end of file

Modified: comdev/tools/readme.md
URL: http://svn.apache.org/viewvc/comdev/tools/readme.md?rev=1694763&r1=1694762&r2=1694763&view=diff
==============================================================================
--- comdev/tools/readme.md (original)
+++ comdev/tools/readme.md Sat Aug  8 05:35:07 2015
@@ -197,10 +197,13 @@ migration again.
 
 In order to backup your data run the script"
 
-    ./scripts/backup.sh
+    ./scripts/backup.sh [dev|stage|local]
 
 Your backup files will be stored in /fixtures in JSON format.
 
+When running in production it is recommended that you run this script
+via a cron job or similar.
+
 TODO: implement a restore script
 
 ## Running Django Commands on your Application Server ###

Modified: comdev/tools/scripts/backup.sh
URL: http://svn.apache.org/viewvc/comdev/tools/scripts/backup.sh?rev=1694763&r1=1694762&r2=1694763&view=diff
==============================================================================
--- comdev/tools/scripts/backup.sh (original)
+++ comdev/tools/scripts/backup.sh Sat Aug  8 05:35:07 2015
@@ -3,11 +3,18 @@ echo "# Backup the data on the selected
 echo "# 'dev' is typically a local machine used for development. Backups will be found in
the mounted volume"
 echo "# 'stage' is typically a remote machine used for testing. Backups will be found in
the container itself."
 echo "# 'local' is typically a remote machine used for production. Backups will be found
in the container itself."
+echo "#"
+echo "# You can provide this value as an argument to this script"
 echo "##################################################################################################"
 
 source ./scripts/config.sh
 
-read -p "What kind of deployment do you want to backup (enter 'dev', 'stage', 'local') "
type
+if [ -n "$1" ]; then 
+  type=$1
+else 
+  read -p "What kind of deployment do you want to backup (enter 'dev', 'stage', 'local')
" type
+fi
+
 case $type in
     "dev")
 	eval "$(docker-machine env $DEV_MACHINE_NAME)"
@@ -23,14 +30,31 @@ case $type in
 	;;
 esac
 
-mkdir fixtures
-
 echo "##################################################################################################"
 echo "# Dumping database to fixtures/backup_data.json"
 echo "##################################################################################################"
 docker exec meetups_app python manage.py dumpdata --format=json events_list > fixtures/backup_data.json
 
+echo "##################################################################################################"
+echo "# Copying file to backup local filesystem"
+echo "##################################################################################################"
+case $type in
+    "local")
+	;;
+    "other")
+	docker-machine scp dev:/home/docker/comdev/meetups/fixtures/backup_data.json ./fixtures/backup_data.json
+	;;
+esac
+
+case $2 in
+  "commit")
+	svn commit fixtures/backup_data.json -m "Latest backup data"
+	;;
+  "other")
+	echo "All done, consider commiting this backup file to SVN"
+	;;
+esac
+
 
-echo "All done"
 
 



Mime
View raw message