Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to have a mirror server of my production server so that I can test everything on that server first before implementing on production.

To mirror production server I need to copy current PHP code, uploaded files, database and linux machine users (as my PHP script need these accounts and home directories) from production server to new server and I also need to update all these from production server each time when I need to test anything on staging server because production server gets updated by the users.

I can update everything manually except Linux users and their home directories as they may affect the system. Is there any way to replicate a Linux machine users to another machine at the same time when they are created on production machine or is there any automated staging system .

Thanks!

share|improve this question

4 Answers 4

You should use an automated system management tool such as Puppet or Chef to describe how your production system is configured, then your staging system can be configured identically simply by telling Puppet to use the same manifest on the staging system. This will also keep configuration changes synchronised over time.

share|improve this answer

I think tou can use P2V (except for databases), I have done it on running production debian servers to deploy them on a VMWare ESXi 4 (vmware is just an example) and it works great. For databases, a mysqldump in a cron will do the job or you can use replication but becareful of the load on the main mysql server. Network filesystem is also a good option only if the php files are not modified during the tests. Hope it help.

share|improve this answer
    
Thanks for reply. My main worries are: 1. if once I synchronize a new server with production server and after doing this if a make any change in staging server for testing purpose will it be sync with live server. 2. After testing the things at staging server if I copy that on production server then what would happen. 3. Can I have only two servers, one as production and second may work as staging/development both. –  Acharya Jan 9 '10 at 10:50

Use this as an opportunity to test your backup/restore plan.

Use your regular backups and restore to a testing machine, either in an isolated network or on a virtual machine surrounded by a virtual network.

Be sure to time how long it takes you to restore a working system - you will need that information for calculating downtime in the event of a complete failure. Also, be sure to note how much and what kind of data was entered since the most recent backup.

share|improve this answer

I believe, the important point would be that uid and gid umbers on both systems should be identical, so that you can either just replicate files etc. via rsync or even nfs-mount the directories.

Maybe you could store the non-system/non_local users (uid > 500) in ldap, and configure both machines to look up non-local users in the same ldap? That still would ot automatically create home directories on the testing machine, but rsync/nfs would be able to take care of that. Cheers,

Nik.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.