Re: [web2py] Re: Website/Sqlite Backup

2012-07-12 Thread villas
Regarding use with Apache wsgi and Sqlite.

Does anyone know whether it is safe to copy a Sqlite DB file after Apache 
has been stopped.  I mean,  would stopping Apache leave the DB file in a 
good state for copying?



Re: [web2py] Re: Website/Sqlite Backup

2012-07-12 Thread Jonathan Lundell
On 12 Jul 2012, at 4:56 AM, villas wrote:
 Regarding use with Apache wsgi and Sqlite.
 
 Does anyone know whether it is safe to copy a Sqlite DB file after Apache has 
 been stopped.  I mean,  would stopping Apache leave the DB file in a good 
 state for copying?

This issue is not so much Apache as any clients of the database potentially 
doing a write during your copy. Stopping Apache will stop your web2py app from 
writing on behalf of incoming requests, but not from (say) system cron, if you 
happened to be using that, or perhaps the scheduler.

An alternative is to copying the file is to use the command-line interface 
(sqlite3) and its .backup command. There's also a backup API that you can use.

Re: [web2py] Re: Website/Sqlite Backup

2012-07-12 Thread villas
Jonathan,  
Thanks for your comments.  

I believe there would only be my web apps writing to the DB,  so from what 
you say it's probably OK to do the copy after I stop Apache although this 
is still not the favoured solution.

For the record,  the other (better) solutions are:
1. Use Sqlite commandline interface and use the backup command. 
2. Use python with the built-in iterdump() method.
3. You mentioned the backup API but this seems to be for C,  so I will 
discount that.

With regards 1,  it seems that this has to be installed separately and I 
did not wish to add another dependency of something which has to be 
installed.  

Therefore,  for the moment, I am favouring 2 because,  from what I have 
read,  iterdump() is good and reliable enough.  However, I imagine the 
commandline tool would be the most reliable of all.

It would be nice to find a couple of scripts to schedule, gzip versions 
with date suffixes, and restore etc.  If anyone knows a script like that,  
please post here for future reference.  Backup is important for us all,  so 
it is nice to have all these ideas to hand.  Thanks.


On Thursday, July 12, 2012 3:00:12 PM UTC+1, Jonathan Lundell wrote:

 On 12 Jul 2012, at 4:56 AM, villas wrote:

 Regarding use with Apache wsgi and Sqlite.

 Does anyone know whether it is safe to copy a Sqlite DB file after Apache 
 has been stopped.  I mean,  would stopping Apache leave the DB file in a 
 good state for copying?


 This issue is not so much Apache as any clients of the database 
 potentially doing a write during your copy. Stopping Apache will stop your 
 web2py app from writing on behalf of incoming requests, but not from (say) 
 system cron, if you happened to be using that, or perhaps the scheduler.

 An alternative is to copying the file is to use the command-line interface 
 (sqlite3) and its .backup command. There's also a backup API that you can 
 use.



[web2py] Re: Website/Sqlite Backup

2012-07-11 Thread Massimo Di Pierro
If you pay the $100, dropbox has a 6month restore. I do not know if it will 
save all the versions of the file, or only some snapshot.

On Wednesday, 11 July 2012 03:16:29 UTC-5, villas wrote:

 Hi All,
 I'm looking for any easy way to backup small websites which use Sqlite.  I 
 found an interesting suggestion from Massimo:

  Put web2py in a dropbox folder! Once a day hg commit the entire folder. 

 That sounds good,  but would it make a safe copy of the data?  

 In any case, does anyone have other ideas?

 Regards, David



Re: [web2py] Re: Website/Sqlite Backup

2012-07-11 Thread Jonathan Lundell
On 11 Jul 2012, at 7:25 AM, Massimo Di Pierro wrote:
 If you pay the $100, dropbox has a 6month restore. I do not know if it will 
 save all the versions of the file, or only some snapshot.

I wouldn't count on dropbox to safely back up a live sqlite database, for the 
same reason you can't simply copy the file: you might get the database in an 
inconsistent state. Use the sqlite3 .backup command instead to take a snapshot. 
Send its output to a dropbox folder if you like.

 
 On Wednesday, 11 July 2012 03:16:29 UTC-5, villas wrote:
 Hi All,
 I'm looking for any easy way to backup small websites which use Sqlite.  I 
 found an interesting suggestion from Massimo:
 
  Put web2py in a dropbox folder! Once a day hg commit the entire folder. 
 
 That sounds good,  but would it make a safe copy of the data?  
 
 In any case, does anyone have other ideas?
 
 Regards, David




Re: [web2py] Re: Website/Sqlite Backup

2012-07-11 Thread Massimo Di Pierro
You are right.

On Wednesday, 11 July 2012 09:47:17 UTC-5, Jonathan Lundell wrote:

 On 11 Jul 2012, at 7:25 AM, Massimo Di Pierro wrote:

 If you pay the $100, dropbox has a 6month restore. I do not know if it 
 will save all the versions of the file, or only some snapshot.


 I wouldn't count on dropbox to safely back up a live sqlite database, for 
 the same reason you can't simply copy the file: you might get the database 
 in an inconsistent state. Use the sqlite3 .backup command instead to take a 
 snapshot. Send its output to a dropbox folder if you like.


 On Wednesday, 11 July 2012 03:16:29 UTC-5, villas wrote:

 Hi All,
 I'm looking for any easy way to backup small websites which use Sqlite.  
 I found an interesting suggestion from Massimo:

  Put web2py in a dropbox folder! Once a day hg commit the entire folder.
  

 That sounds good,  but would it make a safe copy of the data?  

 In any case, does anyone have other ideas?

 Regards, David





Re: [web2py] Re: Website/Sqlite Backup

2012-07-11 Thread villas
Thanks guys!  I didn't even know there was a backup command.  That, with 
the dropbox, sounds perfect.  Hope it all works with cron,  I have to 
investigate.  
Best wishes,  David

On Wednesday, July 11, 2012 3:47:17 PM UTC+1, Jonathan Lundell wrote:

 On 11 Jul 2012, at 7:25 AM, Massimo Di Pierro wrote:

 If you pay the $100, dropbox has a 6month restore. I do not know if it 
 will save all the versions of the file, or only some snapshot.


 I wouldn't count on dropbox to safely back up a live sqlite database, for 
 the same reason you can't simply copy the file: you might get the database 
 in an inconsistent state. Use the sqlite3 .backup command instead to take a 
 snapshot. Send its output to a dropbox folder if you like.


 On Wednesday, 11 July 2012 03:16:29 UTC-5, villas wrote:

 Hi All,
 I'm looking for any easy way to backup small websites which use Sqlite.  
 I found an interesting suggestion from Massimo:

  Put web2py in a dropbox folder! Once a day hg commit the entire folder.
  

 That sounds good,  but would it make a safe copy of the data?  

 In any case, does anyone have other ideas?

 Regards, David