You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by rg...@apache.org on 2015/08/08 07:01:04 UTC
svn commit: r1694757 - in /comdev/tools: fixtures/
fixtures/initial_data.json readme.md scripts/backup.sh
Author: rgardler
Date: Sat Aug 8 05:01:04 2015
New Revision: 1694757
URL: http://svn.apache.org/r1694757
Log:
add a rudimentary backup script
Added:
comdev/tools/fixtures/
comdev/tools/fixtures/initial_data.json
comdev/tools/scripts/backup.sh
Modified:
comdev/tools/readme.md
Added: comdev/tools/fixtures/initial_data.json
URL: http://svn.apache.org/viewvc/comdev/tools/fixtures/initial_data.json?rev=1694757&view=auto
==============================================================================
--- comdev/tools/fixtures/initial_data.json (added)
+++ comdev/tools/fixtures/initial_data.json Sat Aug 8 05:01:04 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=1694757&r1=1694756&r2=1694757&view=diff
==============================================================================
--- comdev/tools/readme.md (original)
+++ comdev/tools/readme.md Sat Aug 8 05:01:04 2015
@@ -175,6 +175,8 @@ not provide any starting data. Log in to
(http:://yourhost.com/admin) and enter at least one
"hashtag". Hashtags are search terms used when searching meetups.com.
+## Migrating to a new DB version on the Dev machine
+
If, rather than creating a clean development environment, you want to
migrate the database in a running instance of the application to a new
version of the application use the following command to generate any
@@ -191,7 +193,17 @@ want to have a default in the final vers
a default, run the migration, then remove the default and run the
migration again.
-### Running Django Commands ###
+## Backup and Restore
+
+In order to backup your data run the script"
+
+ ./scripts/backup.sh
+
+Your backup files will be stored in /fixtures in JSON format.
+
+TODO: implement a restore script
+
+## Running Django Commands on your Application Server ###
From this point development is just like any other Django application,
but to run Django commands in the app container you will need to open
@@ -203,7 +215,7 @@ To run individual commands rather than e
$ docker exec meetups_app python manage.py COMMAND
-### Using the Admin Interface ###
+## Using the Admin Interface ##
To access the admin interface of the application you need an admin
user account. If you used the push.sh script you will have defined an
Added: comdev/tools/scripts/backup.sh
URL: http://svn.apache.org/viewvc/comdev/tools/scripts/backup.sh?rev=1694757&view=auto
==============================================================================
--- comdev/tools/scripts/backup.sh (added)
+++ comdev/tools/scripts/backup.sh Sat Aug 8 05:01:04 2015
@@ -0,0 +1,36 @@
+echo "##################################################################################################"
+echo "# Backup the data on the selected machine 'dev', 'stage' or 'local'"
+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 "##################################################################################################"
+
+source ./scripts/config.sh
+
+read -p "What kind of deployment do you want to backup (enter 'dev', 'stage', 'local') " type
+case $type in
+ "dev")
+ eval "$(docker-machine env $DEV_MACHINE_NAME)"
+ ;;
+ "stage")
+ eval "$(docker-machine env $STAGE_MACHINE_NAME)"
+ ;;
+ "local")
+ ;;
+ *)
+ echo "Unkown option, aborting"
+ exit 255
+ ;;
+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 "All done"
+
+