Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Create a Site Archive for Import

Video loading...

  • 0:00
    Manage Drupal Sites with Pantheon Create a Site Archive for Import Addison Berry
  • 0:08
    Okay, so now we're going to create
  • 0:11
    a site archive for importing our site into Pantheon.
  • 0:15
    In this lesson, we're going to take a demo site
  • 0:17
    that we have and we're going to create
  • 0:21
    a single-file site archive option here using 2 different tools.
  • 0:25
    So there are 2 different ways that we can create this single file.
  • 0:28
    First we're going to see how to do it with Backup and Migrate module.
  • 0:31
    And then secondly, we'll take a look at how to do the same thing with Drush
  • 0:35
    using the archive backup command. So this is going to give us one single file
  • 0:40
    that contains our code base, our database, and our files
  • 0:46
    which makes it the simplest and easiest way to get our archive created
  • 0:50
    and easiest way to import this into Pantheon.
  • 0:53
    So you can see I have my demo site set up here. We have content in there
  • 0:58
    and I have users and things like that going on.
  • 1:01
    It's not a fancy site obviously but this is just to show you how the tools work
  • 1:06
    with a Drupal site. Now we're going to be using Backup and Migrate
  • 1:09
    to create the single archive file. Before I do that though, a couple of just sort of housekeeping things
  • 1:15
    that you want to do before you create that archive. The first thing we want to do
  • 1:19
    is stick this in to maintenance mode so that nobody else
  • 1:21
    is actually changing data on the site or doing anything funky like that.
  • 1:25
    So if I go to configuration and development,
  • 1:29
    we can go to maintenance mode and put the site into maintenance mode.
  • 1:34
    The next thing I want to do is I want to clear the cache.
  • 1:37
    So I'll go back to Configuration, go back down to Development,
  • 1:42
    Performance, and we'll just clear all the caches.
  • 1:46
    You could, of course, also do that from Drush and just do drush cc all for that.
  • 1:52
    So with these things done and in place, the site is cleaned up
  • 1:55
    and tidy and ready to go. If we go to Configuration,
  • 1:59
    I already have Backup and Migrate installed and enabled on this site,
  • 2:04
    which is just a good practice anyway for having backups running.
  • 2:07
    Now my default, Backup and Migrate is going to be set to just backup your database,
  • 2:13
    the default database setting. And what we want to do is back up the entire site
  • 2:18
    with the code, the files, and the database. This is going to create
  • 2:21
    that one archive file instead of creating separate files.
  • 2:24
    So we'll do that, and we can just leave everything else at their defaults
  • 2:27
    and say Backup now, and I'm going to download this.
  • 2:30
    So you see, we need to download it. I'm just going to download this to my desktop,
  • 2:34
    make it easy to find. Save that.
  • 2:37
    And that's that. I now have just one tar.gz file that has all of my site in it.
  • 2:45
    So that's how to do it with Backup and Migrate.
  • 2:47
    Let's take a quick look at how to do the exact same thing,
  • 2:49
    but with Drush. So now I'm on the command line. I'm in my terminal.
  • 2:53
    So I want to make sure that I'm in the root of my Drupal site
  • 2:57
    when I go ahead and do this archive command.
  • 3:00
    This is a very simple command. So it's drush and the long form is archive-dump.
  • 3:06
    Or you can just use the short form, which is ard.
  • 3:14
    All I need to do is that command, hit enter,
  • 3:17
    and it's going to go ahead, and again, create that single archive file frame.
  • 3:22
    And you can see it tells me where it has saved it. So it saved it
  • 3:27
    into the default Drush backups directory.
  • 3:31
    That's what happens if you don't give it any destination in particular.
  • 3:35
    Now by default the Drush backups are located in your home directory.
  • 3:40
    So for me, it's my user add1sun$ directory. There's a Drush backups folder
  • 3:45
    and it's in there. Now if you want you can add a destination,
  • 3:52
    and that would tell it where to put the file specifically if you have a particular destination.
  • 3:56
    So let's say I wanted this specifically just to go to my desktop,
  • 3:58
    and I didn't want to hunt around for it. I can do the command like this,
  • 4:02
    drush ard--destination= and then give it the path with the file name of where I actually want that to go.
  • 4:11
    So if I do this command, it's doing the exact same process.
  • 4:15
    It's just placing it in a different location that might be a little easier for me to find.
  • 4:20
    So let's actually go look—I'm going to go into finder
  • 4:23
    and actually see what we've got here. So you can see I have these two files here.
  • 4:28
    So we have this site archive that was created by Backup and Migrate module.
  • 4:36
    This is the second of those Drush commands I ran,
  • 4:39
    because I just gave it a simple name. And again that archive,
  • 4:44
    so the first time I ran the Drush command it placed it in the default location.
  • 4:48
    That default location is in my home folder on my machine in the Drush backups folder.
  • 4:53
    And there's archive dump, and then you can see that we have my file here.
  • 4:59
    So you could do it either way there.
  • 5:02
    And let's just go ahead and open one of these up. And you can see
  • 5:05
    when we go into this folder here, I have my database dump.
  • 5:09
    I have my Drupal site files including my default and files directories.
  • 5:17
    So everything that I need to create a brand new site. I'm all set to import this now into Pantheon.
  • 5:24
    So as a recap in this lesson,
  • 5:27
    we created a single file site archive using two different methods.
  • 5:32
    First we looked at using Backup and Migrate module.
  • 5:34
    And then we looked at using the Drush command archive dump, or ard,
  • 5:40
    to create the single file archive that has our database, our files, and our code base
  • 5:44
    all in one file ready to upload into Pantheon.

Create a Site Archive for Import


In this tutorial you will learn how to create a site archive for an existing Drupal site so that you can import it into Pantheon. You'll learn how to create one single archive file that contains all the components we need: database, code base, and files. First, we'll demonstrate how to create an archive using the Backup and Migrate module, using a Drupal site's UI, and then you'll learn how to accomplish the same task using the Drush archive-dump command. In this tutorial we assume that you either already have Backup and Migrate module installed on your site, or that you have Drush set up and are familiar with the basics of using it.

Sponsored by Pantheon

Log in or sign up to download companion files.