1

I am about to finish my first Drupal site and I wish to upload it on the server. However, I am going to add content when the site is online but every time I make a change online I would like to add that change to the site on localhost (changes in content, new module additions, etc.). What is the least time consuming way to achieve this? With .html sites it is very easy because you only need to have the .html file saved offline and online and that it is. What things do I need to consider with a Drupal site? I would like to always have the exact same files, modules, content, configuration on the online version and the offline version of my site.

Thanks in advance.

2
  • There are various ways of doing this. I think it will be necessary to know what you are using for your local stack and your server stack before anyone will be able to answer so I would suggest adding that information to your question. – Taylor Taff May 29 '14 at 18:19
  • I don't know what a local stack is? and I don't know what a server stack is? Sorry and thanks for the comment. – Blas Jun 3 '14 at 8:31
1

the best way will be to use Git to keep you code updated and Features to keep you configuration up to date.

A good free source code hosting for git is BitBucket. It gives you unlimited private repositories but limited users. Github gives you unlimited users but you pay for private repositories. Anything you change in code can be hosted in one of those code hostings and you can push it from dev (your local) and pull it from your production environment (live). Git keeps track of all your changes.

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

For site configurations you can use Features

the features module enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together satisfy a certain use-case.

You can use Features module along with: Strongarm

Strongarm gives site builders a way to override the default variable values that Drupal core and contributed modules ship with. It is not an end user tool, but a developer and site builder tool which provides an API and a limited UI.

An example of such a variable is site_frontpage. In Drupal this defaults to node, which ensures that the front page gets content as soon as some exists, but for many Drupal sites this setting is simply wrong. Strongarm gives the site builder a place in the equation - an opportunity to set the site_frontpage to something that makes sense for their site.

and Features Extras

Features Extra provides faux exportables (via Features) of several site-building components

This will be a good way to keep your code and your configuration aligned between two environments.

Second option, if you are not familiar with Git, you can just use an FTP software, download or upload files and then use Backup and Migrate

Back up and restore your Drupal MySQL database and files or migrate a site between environments. Backup and Migrate supports gzip, bzip and zip compression as well as automatic scheduled backups.

With Backup and Migrate you can dump some or all of your database tables to a file download or save to a file on the server or offsite, and to restore from an uploaded or previously saved database dump. You can choose which tables and what data to backup and cache data is excluded by default.

For your files folder you can use an FTP software.

To synronize nodes, you can use Deployment.

The Deploy module is designed to allow developers to easily stage Drupal content from one site to another. Deploy automatically manages dependencies between objects (like node references). It is designed to have a rich API which can be easily extended to be used in a variety of situations.

Here is the documenentation about the module. Create 2 sandboxes and give a try to it. It also works with features.

For code and configuration sync, I strongly suggest you to use Git and Features.

2
  • Brilliant stuff Vincenzo. Thank you very much. Is the content also transferred through git. If I add new content onto the site do I use git to push it and pull it? Thanks in advance. I am reading up on Git but I am not quite sure if it also transfers the content. – Blas Jun 3 '14 at 9:32
  • Hi Blas, unlikely you cannot transfer nodes via git. I'm going to edit my answer and I'm going to add a way to syncronise nodes. – Vincenzo Gambino Jun 7 '14 at 13:18
0

One of the ways to do it is by using Backup Migrate Module with Backup Migrate Files Module for backup of database and files respectively. The steps will consist of taking backup on live server and restoring on localhost, and can be done entirely through the interface.

There are ways by which you can automate it too but that will need configuring some scripts and writing custom code. For that one way to do it is outlined at here (taking backup) and here (restoring backup)

0

I would suggest using source code management system like git for your code deployment to different servers.

And in order to deploy manual configurations which reside in database, you can use features module with other helping modules like strongarm etc. features will pull all your configurations in code by creating feature module, which is easy to deploy on different instances. While creating features just try to keep them as simple as possible, only pull those configurations which are doing manually and always try to make a feature module to serve independent set of related functionalities.

0

The solution would depend on what are you planning to do with the local copy

This is not a new problem and the whole industry is trying to move in this direction. CMS based systems like Drupal have a very involved database component, which cannot be satisfied by just a source control repo like Git. You can host your code on a git repo via Github or beanstalk. That can help keep the code in sync.

When it comes to databases, it would depend on whether you are planning to alter the database on your localhost.

  • If not, then you can simply point to the server database on your local. Thus you can easily mirror the online copy. Combining this with the git repo approach could help keep your local site in sync with the online site.
  • If yes, then there will be need for a manual db update every so often. Here, you can think of your sever db as the "source" whose copy you trust and then you can pull it down at the end of day. There is an easy way do this via rsync commands and a command line insert in to your local db.
  • Alternatively you can also use SequelPro which is very handy in pulling down databases from server.

As mentioned before, the correct approach would depend on what you have in mind for your local site.

2
  • I only need the local site to try out changes to the code before they go live and thats it basically. Then, there will a couple of admin who manipulate the content. But it will just be me dealing with the code. What do you recommend in this case? – Blas Jun 3 '14 at 16:42
  • Then go the Git + SequelPro route, SequelPro makes it so easy to get a copy from server its just basic Export from Server and Import in to your local and Git will keep your code in sync. If you can tell me what Operating System and Local setup you have, It will help provide a better answer – pal4life Jun 3 '14 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.