Mirroring website using seperate DB and domain?

Here's the scenario; I have a web site I want to mirror, so that there is a production and development copy of the same site. I want to work on the development copy transparently from the production copy.

I know you can use rsync to mirror a web site, but what if the two web sites are running on seperate domains and connecting to a different (though ultimately mirrored) database?

When I move features from the development version to the production, I would like to do so as seamlessly as possible. What should I be looking for?

7 Replies

I did some quick googling on the subject but it looks like everybody is using it (for its intended use) as a version repo.

The problem that I see with that is pushing the repo onto the live site would either require putting the site into maintenance while I ran in to update the configuration (and point it at the right domain/db), or … well that's about the only option.

Unless there's a way to build a git configuration that will grep my config files and do some replacements.

If you first clone the development repo to the production repo, and change some configuration files on the production side, then those changes are likely be preserved when you merge the development repo into the production repo later on. Git doesn't blindly overwrite changed files unless you explicitly tell it do do so. That's the whole point of branching and merging, right?

If the database schema changes significantly, though, that would have to be dumped/reloaded or something like that. You'll probably need a few minutes of downtime there. Likewise, no version control system AFAIK guarantees that your repository will be in a consistent state while you're in the middle of a merge, so if that's really important, you might also want to take down the site during the few seconds while you're merging.

I'm going to have to set up some test repositories and mess with this before I put it into use, but I'm definitely intrigued at the possibilities.

I've only used SVN to manage code that I'm the sole committer for, so the whole concept of merging is foreign to me at this point. I've found some pretty good documentation for git… I just hope I can also find some time to read it! :D

This is what I do more or less

http://blog.obsidianproject.co.uk/2010/ … sites.html">http://blog.obsidianproject.co.uk/2010/01/multi-user-git-and-websites.html

Thanks for that pointer obs. I'm two days out from launching a closed beta of a new site and I'm hoping to implement this during that period so that it's good from the get go.

Can't wait to see how bad I fudge up my site the first time I make a typo… :D

What I tend to do is make my code portable across the test and live sites (relative paths etc) and keep configuration to one file which you can tell git to ignore.

One thing I like about the setup I showed you over using regular sftp is that when you stfp it overwrites the file on the server which can take a second or two during that time someone can get a messed up file. Using git it pushes to a repository then copies the file into place on the server which is almost instant.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct