Backing up data on the Dropbox service. Backup with Dropbox Backup file server to dropbox

Is a pretty interesting cloud service. What does it mean? Only that you can store your folders and files on a third-party server without taking up space on your computer. And it's free to do it. But, as soon as we register with, we only have 2 GB of free space.

However, this is enough for a start, and you can increase your quota by inviting friends from. But you will learn about all the intricacies of this wonderful service later, and now - how to make a backup copy (backup) of your website using Dropbox and, of course, save it.

Other Dropbox-related publications:

In principle, everyone should know perfectly well how to do this using special plugins or methods of the hosting provider, but the fact is that such methods always have one significant drawback - we either take up space to reserve the site on our computer, or that the same volume is spent on our server. What's not good - sometimes backups take up a lot of space. And if there are several tens of megabytes on the computer, it seems that it is not a pity, then the space on the server is our money. In addition, by storing a backup copy on our PC, we risk losing it someday. We reinstalled the operating system, caught a virus - but you never know what. Dropbox lets you forget your worries. I created a backup, and forgot about it - everything is safe and sound. But for this we will need to install one small plugin on the site, which will help to contact our account in Dropbox and place your backup copy of the site there. The plugin is called wp Time Machine.

A backup copy of our site, created with this plugin and saved in Dropbox, will contain absolutely all data about our site - pages, posts, comments, images and media files, themes and, as well as a copy in standard sql format. Here is such a useful functionality. A backup is a necessary thing, and even now, when many hosters make backups of our sites automatically, it doesn't hurt to have your own - just in case. So let's start by installing the wp Time Machine plugin on the site. And don't forget - we must have a Dropbox account, or just sign up right now. This procedure will take us just a couple of minutes - fill in a few fields with your data, receive a letter and activate your account. If the account already exists, then simply enter it - we know how this is done:

The plugin, as usual, we will install from our admin panel. In the "Plugins" menu, go to "Add new" and in the "Search" field, type in the name of the plugin - wp Time Machine. This is how it looks in practice:

Site backup Is all the contents of our WordPress site in a zipped form (zip or tar.gz), including all our posts, pages, comments, images and media files, as well as all (activated and inactive) plugins and themes, etc. After the plugin is uploaded to the site, we just need to activate it, and we can go to the plugin settings. First you need to configure the plugin in the "Plugin Options" item. Here we must determine in what format our backup will be saved, as well as configure the saving of logs, cache and other little things, which, in principle, can not be touched.

After that, in the general settings, enter your e-mail from Dropbox, the password from it, and assign a folder where our backup will be saved. The name of the folder can be absolutely anything - the main thing is to enter it in English, otherwise, instead of the name of the folder, we will see crackers.

After these simple steps, click on the "Generate wp Time Machine archive" button, and wait until our backup is created. While we are waiting, the following picture will be spinning on the screen. This will take 3-4 minutes, depending on the size of the site:

After the copy is created, we will see the following message in the admin panel:

And a new folder will appear in our Dropbox with the name that we have defined for it. All backups of our website will be there.

In the backup, we will not see a copy of the WordPress builder itself and its configuration file. This is done for the same security purposes. But the wp-content directory and all of its contents will definitely be present. Therefore, if you need to get the most complete copy of the site, then save the wp-config.php file yourself, and you can also put it in Dropbox.

When creating a backup, the following files get into our new Dropbox folder:

1.wpTimeMachine-content-files.zip - archive of our site (entire directory / wp-content).
2.wpTimeMachine-data-files.sql - a copy of our database, which stores all posts, pages, comments, etc.
3.wpTimeMachine-htaccess.txt - .htaccess server configuration file.
4. wpTimeMachine-Instructions.txt - user manual in English.
5. wpTimeMachine-RestorationScript.sh - a shell script that will help to automatically return.

If we use Dropbox on a computer, we can see that a new one has been added to our folders, which contains a backup with all the above files:

It is very convenient to use the client on a computer. With one click of a button in the admin panel of our WordPress site, we automatically make a backup copy of the site on the Dropbox server and on our computer. You can immediately use the wpTimeMachine-content-files.zip archive. For example, we need a copy of just one file, so don't create a copy of the entire site because of this, if it already exists. I went into the backup on my computer, took what you need, and everything is simple and easy.

Among the additional features of the plugin, one can also name an interesting trick - the ability to store a backup on the equally popular Amazon S3 service (see), or simply prescribe in the settings to save on a third-party FTP server. For this, of course, we need to know the access information to it - password, login, address. That is, apart from the computer and Dropbox, you can put your copy anywhere. This completes the work with the plugin and the Dropbox service, and we can be absolutely sure about all the data on our site. I have everything for now. By the way, I plan to make a series of interesting publications on the service, so to be continued. Before communication on the waves

Hello.

Every day, hundreds of sites die on the vastness of the world wide web, whether because of webmasters who honestly throw up their resources without waiting for staggering earnings.

Whether for technical reasons of hosting, or because of various ailments in the form of syphilis, herpes, computer worms and others.

But the essence remains unchanged, the site no longer exists ... And waking up in the morning, a webmaster who earns at least a penny on the site, finding that the site no longer exists, will tear the hair on his head and other places, cursing everything in the world that is not made backups of his favorite brainchild.

And all why? Most likely, it was just too lazy to set up automatic backups, day after day, living with the thought that nothing would happen and putting it off until later.

So let's not take "good" manners from such webmasters and set up automatic backups of all blog files to a remote Dropbox service.

What is good about this option for creating a backup?

The best part about this option is full automatic operation, that is, even if you went to the dacha, dig potatoes, or drive worms in the trees, the plugin will still work, sending file archives to Dropbox every day.

The second pleasantness is absolutely FREE, you do not need to pay for additional hosting space, which costs 185748593 million rubles, dropbox provides 2GB for storing any files, which is quite enough for backups.

Well, as it is customary to highlight three points, the third pleasantness will be a higher reliability of the safety of backups.

The hard disk on the home computer or laptop is constantly in operation: the kids put toys one by one, watching movies, listening to music, all this brings the railway closer to death every minute.

Also, special attention should be paid to our wonderful power grids, which give out 180-230 volts, instead of the required 220 volts, at night.

What do we need to create automatic backups?

First of all, you need to go to the Dropbox service and register, I will describe the registration process below.

How do I get 2 GB of storage from Dropbox?

We go to the site, pay attention, the link is affiliate, many users bypass such links.

They get to the site and quietly rejoice in their souls with the thoughts "Fuck Borka, he won't be able to get enough of it on me!"

Thus, such users protect themselves from various goodies. For example, if you take the guys who register using my affiliate link, they will receive 3 months of free use of this hosting as a gift. Trifle? But it's nice ...

Believe it or not, I myself used to be like that, here's a tunic in a tunic as described above, about a line and with different thoughts ...

But times go by, everything changes, including my attitude to such links. Do not think, I in no way force you to join the ranks of my referrals, this is a purely personal decision of everyone, I just poured out my soul and my observations on this matter.

So, the Dropbox website is open, and you are in front of a welcome page that describes the main benefits of this service. To broaden your horizons about this service, you can read the offered information.

After reading, we are looking for the cherished button, get 2 GB for personal needs - REGISTER.

The registration procedure is very simple, fill out the fields provided, agree to the terms of service and register.

Choose the type of account, in my case it is “ Basic Dropbox account"And click continue.

Just a few seconds of waiting and the software will start downloading to your computer.

If for some reason this did not happen automatically, click on the appropriate link to re-download, the manual method will pass 99.9%.

After successful download, run this file, the program will be installed on your computer.

After installation, you will see a window where you need to enter the email address and password specified during registration, click enter. A joyful welcome window will appear.

This will mean that you have received your cherished 2GB of space.

By default, this folder for storing files is located on the C drive (system drive). To change the location, you need to do some simple steps.

Lower your gaze to the lower right corner where you have your watch. There will be a small, blue box, right-click on it and go to the settings.

Go to the "Account" tab. Click the "Move" button and indicate the path where you want to store this folder, I indicated the path: D: \\ Dropbox.

To make sure the settings are applied, go to your local drive "D" and see if there is a folder named Dropbox.

Getting started installing and configuring the WordPress Backup to Dropbox plugin

So that you do not wander on the Internet and do not look for this plugin, I have prepared for you a link that will lead you to the site with the plugin.

Just click the big orange Downloud button and the WordPress Backup to Dropbox plugin will download to your PC.

P.s. My bright mind is visited by thoughts, if you are interested in backing up files, then you already know how to install plugins. And I will not describe this process for the three hundredth time.

Install the plugin, activate it and go to the settings. First of all, you need to link the created account on Dropbox with the plugin, for this click the "Authorize" button.

Most likely, it will require you to enter your username and password. If not required, you will see this page.

We grant access. Then we will be congratulated on the successful connection.

We return to the blog admin panel to the plugin WordPress Backup to Dropbox and click the continue button.

After all these manipulations, the settings window for this plugin will open. And at the bottom, a message will flash that a new folder with a specific name has appeared in your Dropbox folder.

The plugin settings are very simple. You just need to set the backup frequency. I have it once a week.

Optionally, you can exclude files and directories that do not need to be backed up. I didn't have any, that is, all files and folders will be sent to the archive.

Now you can sleep soundly and not worry that one day your blog will be gone.

I am 100,000% sure that many will just read the article, make a note to themselves, in the form of "Must try." They'll forget in 10 minutes ... And backups won't be scheduled for that.

Also, this service can be used to share files with friends. To do this, you just need to upload the desired file, program, video, picture to the Dropbox folder.

Sometimes a very convenient thing ...

Well, guys, go for it. That's all for me. If you still have questions, ask them in the comments.

Subscribe to blog updates and receive announcements to your mail.

Best regards, Alexander Mikhed.

For several years now it has been possible for any mortal who wants to rent not only shared hosting, but also a "full-fledged" server with root access and the ability to configure it the way he wants. Configure, for example, a bunch of other services besides the web server.
I did the same a few years ago. First I rented one server, then another, and transferred the settings with pens, finding the necessary files in the / etc directory.

For a couple of years, several friends' blogs have settled on my server, and even a mail server, since I do not want Google to have my mail for a long time. I thought about the safety of data after each article on Habré, but everything was somehow not up to that. And, as they say, admins are divided into three categories: those who do not make backups, those who already do, and those who even check the recoverability from backups. It happened with me, although the hoster is very good, but they had an accident with hard drives. Yes, such that for a week they tried to restore the disks and the preliminary estimates were very disappointing. And I did not have backups. You can imagine what mood I was in those days.

But after a few days, the hoster's technicians managed to recover the data and run all the virtual servers on that node. And I thought about backups. I thought so - the backup should not be on the same server (of course!), It is desirable that it was on my computer, but not in one copy. I thought about installing FTP on my home computer and even sending archives by mail, but these options did not suit me. And I realized that I had to try Dropbox, which I had been using for a couple of years by that time, and I had about 18 free gigs.

Benefits of backing up to Dropbox:

  • Independence from home infrastructure and Internet channel
  • Multiple copies (immediately to all synchronized PCs)
  • In addition to their own storage, backups are also stored in the cloud

What does the script I presented do?

  • Incremental backup of files in the specified folders (on the first and fifteenth numbers there is a full backup)
  • Backup of the entire MySQL database
  • The backup is archived using 7zip, specifying the password (you don't need to store passwords in clear text in Dropbox?)

How it's done?

In short, an "application" is created from the point of view of the Dropbox platform, logged in by the user (that is, by us) and a script is written that uses the authorization data and uploads the backup files to Dropbox.

Or rather?

Step 1 - creating the application
Go to the App Console page, click the "Create app" button, select the "Dropbox API app" type, select the "Files and datastores" item, since we are going to work with files, and in the next paragraph we answer "Yes - My app only needs access to files it creates ”, this means that your application will be limited only to its own subfolder in the App folder, it will not have access to other files. Come up with a name for your application and click "Create app".
You will be presented with a whole page of settings for the created application, but there is no need to configure anything further. But don't close it yet.
Step 2 - download and install the SDK
To write applications that will work with files in your Dropbox, you need to go to the Core API section, where we can download the SDKs we need, read the documentation and take training tours.
Since I believe that Python is the best scripting language for me, I downloaded its SDK and installed it. Installation is very simple, everything is limited to downloading, unzipping the SDK itself and installing it using commands " python setup.py install", or " pip install dropbox".
Step 3 - authorization
The Core API library uses OAuth v2, but Dropbox's Python SDK will take care of how to use it, so you don't have to worry and don't have to write everything from scratch.
It's time to code a small script:

# Enable Dropbox SDK import dropbox # Insert real app_key and app_secret from the created application page from step 1 app_key \u003d "INSERT_APP_KEY" app_secret \u003d "INSERT_APP_SECRET" flow \u003d dropbox.client.DropboxOAuth2FlowNoRedirect authorize (app_key, app_secret user) # .start () print "1. Follow the link:" + authorize_url print "2. Click" Allow "" print "3. Copy the authorization code." code \u003d raw_input ("Insert the authorization code here:") .strip () # If you entered the correct code, then it is sent to the server and the access_token is obtained, which we need access_token, user_id \u003d flow.finish (code) # To check authorization display information about the account client \u003d dropbox.client.DropboxClient (access_token) print "linked account:", client.account_info () # And you need to save the access_token to a file for the script to work further print "access_token:", access_token

Step 4 - create a temporary folder and token file
The backup.py script itself is in the / root folder, it also contains a temporary backup folder and a dropbox_token.txt file. You also need to create them and write the token from the previous step to the file. The token consists of two lines, they are exactly in the file, with a line break.
The last step - write a backup script

Expand

#! / usr / bin / python import os import sys import time import string from os.path import getsize curDate \u003d time.strftime ("% d.% m.% Y", time.gmtime ()) curDay \u003d time.strftime ("% d", time.gmtime ()) backupDelay \u003d time.time () - 86400 if curDay \u003d\u003d "01" or curDay \u003d\u003d "15": backupDelay \u003d 0 print "curDate:", curDate # Include the Dropbox SDK libraries from dropbox import client, rest, session # Get your app key and secret from the Dropbox developer website APP_KEY \u003d "application key" APP_SECRET \u003d "application secret" # ACCESS_TYPE should be "dropbox" or "app_folder" as configured for your app ACCESS_TYPE \u003d "app_folder" sess \u003d session.DropboxSession (APP_KEY, APP_SECRET, ACCESS_TYPE) oauth_token \u003d "" oauth_token_secret \u003d "" f \u003d open ("dropbox_token.txt", "r") if f: oauth_token \u003d string. .readline ()) oauth_token_secret \u003d string.strip (f.readline ()) f.close () print "oauth token found:", oauth_token, oauth_token_secret if oauth_token \u003d\u003d "" or oauth_token_secret \u003d\u003d "": request_token \u003d sess. obtain _request_token () # Authorize the application on dropbox site url \u003d sess.build_authorize_url (request_token) print "url:", url print "Please visit this website and press the" Allow "button, then hit" Enter "here." raw_input () # This will fail if the user didn "t visit the above URL and hit" Allow "access_token \u003d sess.obtain_access_token (request_token) f \u003d open (" dropbox_token.txt "," wb ") f.write (access_token. key + "\\ n") f.write (access_token.secret) f.close () else: sess.set_token (oauth_token, oauth_token_secret) client \u003d client.DropboxClient (sess) print "linked account:", client.account_info () def sync_dir (dir): rootdir \u003d dir print "Syncing directory:", rootdir startTime \u003d backupDelay for root, subFolders, files in os.walk (rootdir): for file in files: fname \u003d os.path.join (root, file ) if os.path.getmtime (fname)\u003e startTime: #print root, file os.system ("mkdir -p" backup "+ root +" "") os.system ("cp" "+ fname +" "" backup " + fname + "" ") print" Making dump of MySQL databases ... "os.system (" mysqldump --all-databases -uroot -pROOT_MYSQL_PASSWORD -r backup / backup.sql ") sync_dir (" / var / www ") sync_dir ("/ var / spool / virtual") sync_dir ("/ home / user") backupName \u003d "backup _" + curDate + ". 7z" print "Creating archive w ith name ", backupName os.system (" 7z a -p ARCHIVE_PASSWORD "+ backupName +" backup / * / etc ") f \u003d open (backupName," rb ") if f: fsize \u003d getsize (backupName) uploader \u003d client.get_chunked_uploader ( f, fsize) print "Uploading file", fsize, "bytes ..." while uploader.offset< fsize: try: upload = uploader.upload_chunked() print "." except rest.ErrorResponse, e: # perform error handling and retry logic print "error uploading file!" uploader.finish("/"+backupName) f.close() print "File uploaded successfully." print "Deleting temp files..." os.system("rm -r backup/*") os.system("rm " + backupName);

Afterword
  • I added this script to the crontab and runs it every day at 4:00 am.
  • There are three lines in the script with a call to the sync_dir function, in the same way you yourself can configure which folders you need to backup.
  • The script does not delete files that have been deleted from the folder, if you incrementally unzip the full archive and subsequent ones, then the deleted folders / files will remain.
  • I did not delete old backups in Dropbox itself, I clean the folder myself when I think about it.
  • Recently I took a couple more VPS in other countries, and added only a prefix to the name of the backups in the script, so all backups merge into one folder, but they can be distinguished very easily.

You've probably heard of Dropbox -a wonderful cloud file storage and synchronization service. But not everyone knows about the possibility of using Dropbox for the needs of WordPress. In today's tutorial, we'll show you how to use your Dropbox inbox to reserve copy site on WordPress.

To complete this tutorial you will need a registered dropbox account... If you don't have that - register ... The whole procedure will take a couple of minutes.

You can also watch our video tutorial:

What is a WordPress backup?

This is all the content of your WordPress site packed (. zip or. tar.gz), including all posts, pages, comments, images and media, as well as plugins and themes.

Backups are made when moving a site or migrating it in case something goes wrong. Or just generally good form - backups are done automatically on a schedule a couple of times a week to keep your data safe.

In this tutorial, I will describe how to back up a WordPress site. to the Dropbox folder using the plugin as an example.

This plugin is very easy to use. It allows you to save not only the file archive of the site itself, but also. sql a file with a database that can be restored through phpMyAdmin... The file is also exported. htaccess with additional server configuration settings. You can familiarize yourself with all the possibilities of the plugin at developer page.

It should be noted that for security reasons, when creating a backup, the WordPress engine itself and its configuration file are not saved wp-config.php... Only the directory will be included in the backup archive. / wp-content with all content ( plugins, themes, uploads, etc.)

Therefore, before migrating the site, do not forget to save this file (wp-config.php) or at least the data for accessing the WordPress database.

Installation

Making a backup

After activating the plugin, go to the menu Options -\u003e wp Time Machine.

All you have to do is fill in 3 fields (email and password from your Dropbox mailbox, as well as the name of the folder where the backup will be created). Enter the details and click the button Generate wp Time Machine archive.

Wait while the backup is being created and moved. Do not close your browser window while you see this notification:

Once everything is ready, you will see the following:

Now just press Remove this message... Your backup has already been created and placed in your Dropbox folder.

What happened

Let's see what we got. Go to your mailbox Dropbox and you will see the new directory in the file manager. Inside will be the following files:

When creating a backup, 5 files are placed in the Dropbox folder:

If you have installed dropbox client for the operating system, you can immediately access your backup files simply by going to the Dropbox folder on your computer:

This is very conveniently... By clicking just one button in the WordPress admin area, you automatically get a site backup in " cloud"(on your Dropbox box) and on your computer on your hard drive. You can immediately open the archive wpTimeMachine-content-files.zipand access the files you want.

Additional features

If you go to the WordPress admin in the menu Options -\u003e wp Time Machine -\u003e Show Plugin Options, you will see additional features of the plugin.

Except export to box Dropbox you can also choose a less popular service Amazon S3 or just specify an arbitrary FTP server... Just specify the host, login and password for FTP access, and a backup copy of your site will be created on the specified server.

You can also choose archive format backup -. zip or. tar.gz; enable or disable change log; exclude cache folders from the archive or make sure that all folders in the backup contain the export date in the headers.

Hello dear readers! Today I want to tell you how to do backup site (or backup) using a plugin WordPress Backup to Dropbox... This plugin allows you to copy not only the database, but also all resource files to the cloud service Dropbox.

What is site copying for? Imagine that the result of some unforeseen actions on the hosting was the loss of all files and database of your project. It is good if the hoster regularly makes backups of the site, then you can always contact him in case of force majeure; by the way, which I use, it does just that. But there can always be some change. Well, for some reason, backups have ceased to be carried out, what to do? That's when a copy of the site made by the WordPress Backup to Dropbox plugin helps. By the way, the alternative is.

Before proceeding directly to the description of the plugin's operation, it is necessary to explain the service itself, where copies of files and data will be stored. First, briefly, what is cloud servicesone of which is Dropbox. These services are divided into two components: front end (the part of the user that includes the computer and the application to access), also back end ("Cloud" part of the system). These two components are interconnected by the Internet.

When you sign up, you get the ability to sync files across multiple computers. That is, you can quickly and conveniently share files with your friends. Here's an example that is very revealing: you need to do some work using Microsoft Office, but it is not on your computer; then you can use the cloud service by running the program online.

Of course, now there are many services that provide such services. In addition, each of them has its own pros and cons, rules everywhere, paid services, which include various tariff plans. The more expensive, the more opportunities it gives. I gave a short description of the concept of "cloud service" in general, but we are, of course, interested in Dropbox, since it provides 2 GB of free space for storing files, which is quite enough to make a backup of the site; and also because it is this service that is used for backups by the WordPress Backup to Dropbox plugin.

Dropbox: how to register and download the app

So, let's get to the main thing. First, we register on the official website Dropbox.com. To do this, fill out the following form:

Push the button "Create account"... After that, you will be prompted to save the installation file to your computer:



If the download did not start automatically, that is, a dialog box with a suggestion to save the download file did not appear, click on the link "Restart the download"... Below is a step-by-step instruction for starting the installation of the Dropbox application: run the dropbox.exe download file saved earlier; in the dialog box that appears, which asks for permission to make changes, click "Yes"; to install the application, click "Install".

The installation is standard, nothing complicated. The only thing is that you can choose the drive on which you will install the application. The default is C; but I, for example, find it more convenient to use the D drive, where I installed the application. After installation, the Dropbox folder will be visible:


By clicking on it, you will see that it consists of 3 subfolders:



Yes, I forgot to clarify, folders on your computer will be synced to your Dropbox account, which will look like this:


Well, in short, what is the Dropbox cloud service, for general information it was necessary. Now let's go directly to the description of how to make a website backup (backup) using the WordPress Backup to Dropbox plugin.

WordPress Backup to Dropbox: Install, Configure and Test

1. Download the Backup to Dropbox plugin to your computer. The procedure is standard, if it's not clear, read the instructions for installing plugins for WordPress, which I described in detail. The last step is to activate the extension.

There you click "Authorize":



Click "Allow", the following should be information about a successful connection to your Dropbox account:


4. Now go back to the WordPress admin panel in the same section, click "Continue":


5. Now you need to configure WordPress Backup to Dropbox properly. In the "Settings" section, specify the folder to which the backup will be carried out.


Time in a graph "Day and Time" better to choose night. For example, Wednesday 03:00; usually at this time the load on the server is minimal. "Periodicity" - the frequency with which the site will be backed up. I think once a week is fine for an average website or blog. We put "Weekly".

6. Now let's install the folders that should be excluded from the backup. For the wordpress backup to dropbox plugin, this is the backups subfolder. To do this, click on the wp-content folder and check the box next to the opened backups:


Don't forget to press the button "Save changes"to save the settings. Now all the settings have been made, at a certain time that you specified, an automatic backup of the site will be performed. But that's not all. Let's try to test the plugin. To do this, click "WPB2D", then "Backup log" and "Start backup":


During the site backup, you will see the following picture in the WordPress admin panel:


After the backup is complete, you will see a green checkmark in the lower right corner of your computer panel next to the dropbox logo, and in the admin panel in the Settings section the following entry:


That's it, the site has been successfully backed up, next time it will be performed according to the previously set parameters. This concludes my post today, which, to my surprise, took a lot of time. I hope you now know how to properly backup your site using the Backup to Dropbox plugin. Do not forget, if you are interested in the blog materials, click on the social media buttons located just below.

If you want to quickly master the skill of building your own resource on WordPress, study the thoroughly necessary course by E. Popov “WordPress - Professional Blog in One Day”, a leader in creating high-quality information products. In addition, you can meet others who will help in solving this problem.