1

What I'm trying to do is to make 2 sites one for developing and one for live using which share same instalation and database. I want to see same content like on live site when I developing theme or module when the changes ready I want to push them via git to live server. Is it possible to make something like this. example.com - live developing.example.com -developing

I also found this http://drupal.org/node/22267 but I'm not sure how to setup :)

cheers

5

I understand your intention, but no. This is not the usual approach and has the potential to bring you all sorts of pains later on the line.

Once a project is deployed, you really need 2 databases. Say your live application needs a new feature, you would want to update your "dev" site with live server's data. So ...

  1. You pull data from live server. Hint: drush sql-sync makes it as simple as drush sql-sync @live @dev.

  2. You develop the feature ...

  3. Push the code to production ... drush rsync @dev @live or whatever you use. (Git is also great for this btw)

  4. Now we have to update the db changes and this is where it gets funky. If you have added or altered tables and data you cannot just sync the db because you will overwrite whatever data your users have posted since you pulled. The common way to handle this is having update hooks to insert the changes in your db. Following this approach, the update hook was deployed in step #3. All that is left to do is ..

  5. Run live.com/update.php. This will trigger your update hooks and insert changes to db.

A few things to keep in mind that make this procedure dead easy:

Drush in conjunction with drush aliases and multiple settings.php for each environnment will make transferring code and data back and forth a breeze.

Happy coding, cheers

  • Wow thanks I will try all this tips :) Thanks a lot! – Nikola Mar 1 '13 at 19:19
  • No problem! If the answer is of value, remember to click the up arrow for that is the payoff for people that help you, and of course also accept the best answer so others that stumble on your posts know what worked best for you. Thanks friend – stefgosselin Mar 1 '13 at 19:44

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.