I generally develop on Windows and deploy to Linux servers where our Apache and Tomcat instances are running. The following single command is a bit of magic. It does the following:
- Tars up all the files for mywebapp
- Transfers them using ssh
- Extracts them to the correct location and as the correct user (builduser in this example) on the deployment machine.
tar -C c:/opt/apache2/htdocs/mywebapp -cvf - . | ssh firstname.lastname@example.org "sudo -u builduser tar -C /var/www/html/mywebapp -xmf -"