Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

Making a Development Site

0 (0 Likes / 0 Dislikes)
Making a Development Site with Joe Shindelar In this tutorial, we're going to learn how to make a copy of a live site for development purposes. By the end of this tutorial, you'll know how to make a copy of a site that you can use to develop new features and test updates on, without adversely affecting your live site. Before you get started with this tutorial, you'll want to make sure that you're familiar with the concept of development sites and why they are important, have a live site that you want to make a copy of, and that you have access to the database for that site. And optionally, you'll have to have Drush installed if you want to use Drush during the process. See the written version of this tutorial for links to each of these prerequisite tutorials. The first thing that you're that you're going to need to do is make a database dump file from your live site's database, a copy of the database. There are a few different methods you can use to do this. I'm going to use Drush in this demo, but refer to the written version of the tutorial for alternate options. Starting from the root directory of my live site, I'm going to run the Drush command drush sql-dump, and I'm going to save the results to a file named backup.sql. This will create a database backup stored in the file backup.sql. For security reasons, avoid storing this file on your hosting server, anywhere under the Drupal site root. This will prevent others from getting a copy of your database. Next, you'll need to copy all of the files from the webroot of your live site to the webroot of your development site. As an example, I'll just clone the whole directory here, this is my live site, and then give it a new name. I'll just change the name of mine to docroot_development. In your newly created development site, you need to edit the file located at sites, default, settings.php. Go ahead and open this up in your editor of choice. In the file, find the lines near the end that contain the database name. I'll scroll all the way down. So my database configuration here. I need to change this to point at my new database for my development site. So I'm just going to call this one user_guide_development, like so. Make that change, save the file. You may also need to change some of the other parameters here, like the username and password if, for example, the database username and password on your development host are different than they are on your live host. Additionally, you should check whether or not your settings.php file has a value set for the trusted host patterns key. I can see here the documentation for that, and if I scroll down, I can see that in my case, I don't have anything set for trusted host patterns. However, if you do, you need to go ahead and update it as appropriate. Then, back in my terminal, I can change into the directory for my new site, and I can import the database dump file that I created earlier. Note that it's here, backup.sql. It was created when I cloned all the files from the development site. Again, I'm going to use Drush to do this, but there are numerous ways that you could achieve the same thing. I'll use the command drush sql-query --file=backup.sql. I'll also go ahead and use Drush to clear the cache for good measure. If your development and live sites need to have different configuration, then you need to use configuration overrides in your settings.php file. In my settings.php file, as an example, I'm going to override the system site name and change the title or name of my site to Development Site for Anytown Farmer's Market. The config variable will help you maintain override values separately from the standard configuration data. This change will only be reflected on the development site where this modified settings.php file is used. In this tutorial, we learned how to create a database backup from our live site. We also learned how to import the backup into a development copy of our site, as well as how to modify configuration to override settings that we need for our development version of our site.

Video Details

Duration: 4 minutes and 2 seconds
Country: United States
Language: English
License: All rights reserved
Genre: None
Views: 7
Posted by: drupalizeme on Feb 12, 2018

Making a Development Site

Caption and Translate

    Sign In/Register for Dotsub to translate this video.