-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
278 additions
and
77 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,9 @@ NOTES.html | |
SECRETS.md | ||
SECRETS.html | ||
PRIVATE/ | ||
site/ | ||
data/ | ||
|
||
|
||
.project | ||
.pydevproject | ||
|
File renamed without changes.
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
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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
# ![google-drive-backup logo](img/app-logo.png) Make backup copies to google drive | ||
|
||
google-drive-backup is a python script that allows you to make a copy of | ||
a single file or directory to google drive. | ||
|
||
google-drive-backup keeps a yearly, monthly and daily different copies | ||
of your data, so it will be difficult to lose a file even if you realize | ||
the lose time after. | ||
|
||
After finishing the backup it sends a email to keep yo informed on how | ||
the copies went, for easy monitorization. | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
|
||
# Installation procedure | ||
|
||
## Python | ||
|
||
[Python](https://www.python.org) version 3 must be installed to | ||
make this application work. | ||
|
||
Once you have python installed, I recommend to setup a virtual | ||
environment to make this drive-backup working. This will avoid | ||
possible conflicts with dependencies from other projects. | ||
|
||
To do so, make sure that virtualenv is installed in your computer | ||
by running one of the following: | ||
|
||
$ virtualenv | ||
$ python -m venv | ||
|
||
One of both above will work. After that, create a virtual environment. | ||
For this example we will call it ```drive-backup```: | ||
|
||
$ python -m venv drive-backup | ||
|
||
Next step is activate this virtual enviroment, by running the | ||
```activate``` or ```activate.bat``` command. You will see that | ||
this is achieved because the prompt will change: | ||
|
||
$ cd drive-backup | ||
drive-backup$ source ./bin/activate | ||
(drive-backup) drive-backup$ | ||
|
||
Now we are ready to install the google libraries for authentication | ||
and for managing the google api: | ||
|
||
(drive-backup) drive-backup$ pip install --upgrade google-api-python-client | ||
(drive-backup) drive-backup$ pip install google-auth-oauthlib | ||
|
||
## We are ready for deploy the application | ||
|
||
[Grab the latest release](https://github.com/rlunaro/google-drive-backup/releases/) | ||
of the application and uncompress it: | ||
|
||
(drive-backup) drive-backup$ unzip google-drive-backup_XXXX.zip | ||
|
||
## Config many things | ||
|
||
### logging.json | ||
|
||
The entry ```filename``` must be configured to indicate where the log files | ||
will be placed: | ||
|
||
"filename" : "drive-backup.log", | ||
|
||
By default they are left in a file calle ```google-drive.log```, but they | ||
can be left wherever you want. In a linux system, a good place is ```/var/log/drive-backup```. | ||
|
||
BTW, you can configure the maximum size of the logging file and the number | ||
of log files to keep. | ||
|
||
### config.json | ||
|
||
Create a ```config.json``` file by renaming the provided example-config.json: | ||
|
||
$ mv example-config.json config.json | ||
|
||
And do the necessary configurations: | ||
|
||
"emailFrom" : "YOUR GOOGLE EMAIL ACCOUNT HERE", | ||
"emailTo" : ["A LIST OF EMAILS TO NOTIFY, CAN BE LEFT EMPTY"], | ||
|
||
**runBefore, runAfter** | ||
|
||
These are placeholders to run additional commands that must be run | ||
before the backup is made and after the backup is made. You | ||
can leave them empty if you don't have anything to run: | ||
|
||
|
||
"//2" : "config of directories / files to backup", | ||
"runBefore" : [], | ||
"runAfter" : [], | ||
|
||
Or -let's say- you need to run a script to make a full | ||
backup of your database. In that case, you can place | ||
something like: | ||
|
||
"//2" : "config of directories / files to backup", | ||
"runBefore" : [ "/root/full-backup-database.sh" ], | ||
"runAfter" : [ "/root/clean-last-backup.sh" ], | ||
|
||
**resourcesToBackup** | ||
|
||
The next step is to properly configure the list of folders | ||
or files to make backup: | ||
|
||
"resourcesToBackup" : [ "/my_very_important_dir" ], | ||
|
||
__windows users__ bear in mind you will have to use backslashes | ||
and double backslash: | ||
|
||
"resourcesToBackup" : [ "c:\\my_very_important_dir" ], | ||
|
||
**verifyUploadedFiles** | ||
|
||
__I recommend set this to "true"__: it will make an MD5 sum of the | ||
remote and local files and check that they match. | ||
|
||
**dailyPolicyFolder, monthlyPolicyFolder, yearlyPolicyFolder** | ||
|
||
How the folders for daily, monthly and yearly copies be called. | ||
You can leave them as is. | ||
|
||
### drive_backup.sh | ||
|
||
You have to configure properly the script ```drive_backup.sh```. Edit it, and | ||
perform the following change: | ||
|
||
drive_backup_home="PUT-HERE-THE-HOME-OF-YOUR-APPLICATION" | ||
|
||
This is the directory where you have created the virtual environment. | ||
|
||
**VERY IMPORTANT:** give execution permissions to this script by running: | ||
|
||
$ chmod u+x drive_backup.sh | ||
|
||
### drive_backup.cmd | ||
|
||
The same changes done for the linux script have to be made for the windows users | ||
on this line: | ||
|
||
set drive_backup_home=CONFIGURE HERE | ||
|
||
## And we are ready to run | ||
|
||
Now you can run the application like this: | ||
|
||
$ ./drive_backup.sh | ||
|
||
**The first time** you run the application, it will request for permission | ||
to access your google drive and gmail showing a screen like this: | ||
|
||
![step 0](img/oauth_0.png) | ||
|
||
![step 2](img/oauth_1.png) | ||
|
||
![step 2](img/oauth_2.png) | ||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# PRIVACY POLICY OF THE APPLICATION drive-backup | ||
|
||
This application doesn't gather any personal data data. | ||
It is simply a medium to transfer automatically the data | ||
placed in a directory of the user computer to google drive. | ||
|
||
Once this step is done, the application will send an email | ||
reporting the sucess or failure of the operation. | ||
|
||
In every case, the data will remain with the user and | ||
they are never gathered. | ||
|
||
## This application is given with the purpose of it might be useful | ||
|
||
This application is send "as is", **without any garanty**. | ||
It is give with the expectancy that it will useful to third | ||
parties. | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
# POLÍTICA DE PRIVACIDAD DE LA APLICACIÓN drive-backup | ||
|
||
Esta aplicación no recoge datos de caracter personal de ningún | ||
tipo. Simplemente es un medio para transferir automáticamente | ||
los datos situados en un directorio de un ordenador a una | ||
cuenta de google drive titularidad del propio usuario. | ||
|
||
Una vez realizado este paso, la aplicación mandará un correo | ||
electrónico informando del éxito o del fracaso de la operación. | ||
|
||
En todo caso, los datos permanecerán en todo caso a disponibilidad | ||
del usuario y no se recogen con ninguna finalidad. | ||
|
||
## Esta aplicación se entrega gratuitamente con el propósito de que sea útil | ||
|
||
Esta aplicación se entrega "como está", **sin garantía de ningún | ||
tipo**. Se ofrece con la esperanza de que sea util a terceras | ||
personas. | ||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
rem | ||
rem drive_backup.cmd | ||
rem | ||
|
||
set PYTHONIOENCODING=UTF-8 | ||
|
||
if "%drive_backup_home%" == "" goto do_init | ||
|
||
goto skip_init | ||
|
||
:do_init | ||
set drive_backup_home=CONFIGURE HERE | ||
set PYTHONPATH=%drive_backup_home%;%drive_backup_home%\src | ||
set PYTHON_HOME=%drive_backup_home% | ||
set PATH=%PYTHON_HOME%\Scripts\;%PATH% | ||
set PYTHON_EXE=%PYTHON_HOME%\Scripts\python.exe | ||
|
||
:skip_init | ||
|
||
"%PYTHON_EXE%" -u %drive_backup_home%\main.py ^ | ||
--config="config.json" ^ | ||
--logging="logging.json" ^ | ||
%1 %2 %3 %4 %5 | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# | ||
# drive_backup.sh | ||
# | ||
# | ||
|
||
PYTHONIOENCODING=UTF-8 | ||
|
||
if [ -z "$drive_backup_home" ] | ||
then | ||
drive_backup_home="PUT-HERE-THE-HOME-OF-YOUR-APPLICATION" | ||
PYTHONPATH="$drive_backup_home;$drive_backup_home/src" | ||
PYTHON_HOME="$drive_backup_home" | ||
PATH="$PYTHON_HOME/bin:$PATH" | ||
PYTHON_EXE="$PYTHON_HOME/bin/python" | ||
fi | ||
|
||
"$PYTHON_EXE" -u "$drive_backup_home/main.py" \ | ||
--config="config.json" \ | ||
--logging="logging.json" \ | ||
$1 $2 $3 $4 $5 | ||
|
||
|
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
site_name: Drive backup | ||
nav: | ||
- Home: index.md | ||
- Install : install.md | ||
- Privacy policy (english): privacy_en.md | ||
- Privacy policy (spanish): privacy_es.md | ||
|
Oops, something went wrong.