Deploy from Windows to Linux using SSH

ssh
Standard

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:

  1. Tars up all the files for mywebapp
  2. Transfers them using ssh
  3. 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 philip.murphy@my-build-server.com "sudo -u builduser tar -C /var/www/html/mywebapp -xmf -"
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s