Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Deployment to windows/unix servers

Tags:

We have various php projects developed on windows (xampp) that need to be deployed to a mix of linux/windows servers.

We've used capistrano in the past to deploy from windows to the linux servers, but recent changes in architecture and windows servers left the old config not working. The recipe works fine for the linux deployment, but setting up the windows servers has required more time than we have right now. Ideas for the Capistrano recipe are valid answers. obviously the windows/linux servers don't share users, so this complicates it a tad (for the capistrano assumption of same username/password everywhere).

Currently we're using svn-update for the windows servers, which i dislike, since it leaves all the svn files hanging on the production servers. (and we still have to manually svn-update them on windows) And manual updating of files using winscp and syncing the directories with their linux counterparts.

My question is, what tools/setup do you suggest to automatize this deployment scenario: "Various php windows/linux developers deploying to 2+ mixed windows/linux machines"

(ps: we have no problems using linux tools or anything working through cygwin, we simply need to make deployment a simple one-step operation)

edit: Currently we can't work on a all-linux enviroment, we have to deploy to both linux and windows server. We can start the deploy from anywhere, but we'd prefer to be able to do it from either enviroment.

like image 945
rcphq Avatar asked Sep 16 '08 21:09

rcphq


2 Answers

I use 4 different approaches depending on the client environment:

  1. Capistrano and similar tools (effective, but complex)
  2. rsync from + to Windows, Linux, Mac (simple, doesn't enforce discipline)
  3. svn from + to Windows, Linux, Mac (simple, doesn't enforce discipline)
  4. On-server scripts (run through the browser, complex)

There are some requirements that drive what you need:

  • How much discipline you want to enforce
  • If you need database (or configuration) migrations (up and/or down)
  • If you want a static "we're down" page
  • Who can do the update
  • Configuration differences between servers

I strongly suggest enforcing enough discipline to save you from yourself: deploy to a development server, allow for upward migrations and simple database restore, and limit who can update the live server to a small number of responsible admins (where the dev server is open to more developers). Also consider pushing via a cron job (to the development server), so there's a daily snapshot of your incremental changes.

Most of the time, I find that either svn or rsync setups are enough, with a few server-side scripts, especially when the admin set is limited to a few developers.

like image 178
Bruce Avatar answered Nov 09 '22 23:11

Bruce


This will probably sound silly but... I used to have this kind of problem all the time until I decided in the end that if I'm always deploying on Linux, I ought really to at least try developing on Linux also. I did. It was pain free. I never went back.

Now. I am not suggesting this is for everyone. But, if you install VirtualBox you could run a Linux install as a local server on your windows box. Share a folder in the virtual machine and you can use all your known and trusted Windows software and techniques and have the piece of mind of knowing that everything is working well on its target platform.

Plus you'll be able to go back to Capistrano (a fine choice) for deployment.

Best of all, if you thought you knew Linux / Unix wait until you use it everyday on your desktop! Who knows you may even like it :)

like image 45
reefnet_alex Avatar answered Nov 09 '22 23:11

reefnet_alex