views:

56

answers:

3

What would you guys recommend as good references for setting up a testing server (xampp on xp pro), a staging server and a production server while also having svn? I'm a noob to "hardcore" development but want to start off on the right foot and set up my environments like the pros do. I have several projects coming up and want to take two steps forward instead of one step forward and two back.

My main areas of least understanding are... keeping file paths correct between all servers and databases (dealing with localhost/site.com/file.html vs www.site.com/file.com), pushing updates to the next server - testing to staging to production, as well as using svn (we will be having several people working on the same projects at the same time).

Each project will have a single server so info on load-balancing and setting up several servers isn't needed. We are also planning to use netbeans or eclipse for svn unless otherwise suggested.

Production and staging servers will be LAMP while testing will be xampp on xp pro. Thanks for all the help!

+1  A: 

3 parts to your question:

1) Configuration file differences between servers - we have Environment folders in our project that we store the config files in to enable keeping multiple versions.

So like:

Solution folder
    |--> Environment
      |--> Development
      |--> Staging
      |--> Production
    |--> Src
      |--> Project folders

Our build scripts are then built to accept a parameter for environment and pull the correct environment folder, overwriting the original files as it deploys them.

2) Pushing code changes to environment servers - in SVN we set up branches per environment for each project. So like:

SVN Root
|--> Project
  |--> Branches
    |--> RB-Development
    |--> RB-Staging
  |--> Trunk

Trunk being our production code.

We also create a new branch for each feature set that we are working on. Then when ready to deploy we merge it to the correct environment branch; a build tool is monitoring those environment branches and auto-deploys to the correct branch when the code is committed.

3) Multiple people using SVN - create branches of the project for each vertical feature set you will be working on. So for a shopping cart type app, you would have features about the customer, products, ordering, etc ... this will reduce the number of people working on the same branch at the same time. Then merge code as needed between those branches and each other or to the environment branches. It sounds more complicated than it really is.

Carlton Jenke
Hi Carlton,Do you have any examples of your environment folders/ config files that you could share? I'm not exactly sure what should go in them. Thanks for your input!
Chad
A: 

Well. Have your application store development and production configuration. Things like database access and paths. There's no reason for keeping same paths for different servers (especially if you mix unix and windows)

Pavels
+1  A: 

In response to Chad's request for more examples of the environment folders & config files, here is further info:

We have any settings used by the project split into config files; we are building websites, so those config files are referenced from the web.config.

For instance in our Configuration folder we have a ConnectionStrings.config with this inside (filling in your info instead of the []s of course):

<connectionStrings>
    <add name="APP"
      connectionString="Data Source=[];Initial Catalog=[];uid=[];password=[]"
      providerName="System.Data.SqlClient" />
</connectionStrings>

Path to it is:

Site root
|--> Configuration

So it is referenced in the web config with this:

<connectionStrings configSource="Configuration\ConnectionStrings.config" />

So in our solution folder we would have this structure:

Solution folder
|--> Environments
  |--> Development
    |-->Configuration
      |--> ConnectionStrings.config
  |--> Production
    |-->Configuration
      |--> ConnectionStrings.config
  |--> Staging
    |-->Configuration
      |--> ConnectionStrings.config
|--> Src
  |--> Project folder (site root)
    |--> Configuration
      |--> ConnectionStrings.config

Same thing with any other settings, normally put into our AppSettings.config. So things like the paths to files or any other setting that would change.

<appSettings>
    <add key="FilePath" value="C:\FileStorage"/>
</appSettings>
Carlton Jenke