Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the best practices to push site updates from dev/stage/testing environment to production?

Tags:

maintenance

Right now I have a development server running a basic LAMP configuration. The production server is a slicehost. But I'm wondering what is the best way to push the instances of the code/db to the stages dev > stage > production. Does it have to do with how you create the stages?

How do you do it without bring the site down? Is it even possible if you don't do load balancing?

I know this is somewhat general, I'm just looking to be pointed in the right direction.

like image 974
gregh Avatar asked Sep 23 '08 19:09

gregh


People also ask

What is staging environment why do we need staging environment what are the best practices in a staging environment?

A staging environment (stage) is a nearly exact replica of a production environment for software testing. Staging environments are made to test codes, builds, and updates to ensure quality under a production-like environment before application deployment.

How would you separate the production and development test environments standard?

It is recommended to separate the production environment from the QA and Test environments by using a user authentication system. This separation allows for complete isolation of data and different users can be given access to each environment.


1 Answers

I use .htaccess to create a "maintenance mode" jiffy where only my IP can see the main site while updating. Everybody else gets to view a short message so they know everything should be back online in a few ticks.

Then I:

  1. Make any DB edits
  2. SVN export/upload the files
  3. Run automated testing and give as much as possible a quick look over to make sure there's nothing hideously wrong
  4. Revert the .htaccess

It's a given but you should test things as much as you can locally before pushing to a live server. Some people use two live servers (like a cryptically name subdomain on the production server) to act as a test-area for live-time updates. This can reduce the main site's actual downtime.

I should stress that it's important not to push updates to a live server without shutting it down beforehand (especially if you're using binaries ala ASPNET) because users trying to use the site while you update will get hideous error messages and you might get locked files.

like image 182
Oli Avatar answered Oct 22 '22 17:10

Oli