Changes for page Remote deployment with Ant and ssh
Last modified by Pascal Robert on 2009/02/18 10:53
From version 4.1
edited by Pascal Robert
on 2009/02/18 10:53
on 2009/02/18 10:53
Change comment:
There is no comment for this version
To version 3.1
edited by Pascal Robert
on 2009/02/18 10:53
on 2009/02/18 10:53
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,14 +1,16 @@ 1 -You can do many things with Ant, one of them is the ability to use tools like //[[tar>> url:http://ant.apache.org/manual/CoreTasks/tar.html||shape="rect"]]//, //[[gzip>>url:http://ant.apache.org/manual/CoreTasks/pack.html||shape="rect"]]//, //[[FTP>>url:http://ant.apache.org/manual/OptionalTasks/ftp.html||shape="rect"]]// and //[[scp>>url:http://ant.apache.org/manual/OptionalTasks/scp.html||shape="rect"]]// for remote deployment. At work, we use a shell script on our servers to deploy our apps, and we are using //rsync// to send the applications to the server before calling the shell script. Would be great to actually do this in one step ? It's quite easy!.1 +You can do many things with Ant, one of them is the ability to use tools like //[[tar>>http://ant.apache.org/manual/CoreTasks/tar.html]]//, //[[gzip>>http://ant.apache.org/manual/CoreTasks/pack.html]]//, //[[FTP>>http://ant.apache.org/manual/OptionalTasks/ftp.html]]// and //[[scp>>http://ant.apache.org/manual/OptionalTasks/scp.html]]// for remote deployment. At work, we use a shell script on our servers to deploy our apps, and we are using //rsync// to send the applications to the server before calling the shell script. Would be great to actually do this in one step ? It's quite easy!. 2 2 3 -First, you need to install [[JSch>> url:http://sourceforge.net/projects/jsch/||shape="rect"]]. We use the //jsch-0.1.29// release, we didn't try a later release. Copy the JAR into ///Developer/Java/Ant/lib/// (Mac OS X 10.4) or ///usr/share/ant/lib/// (Mac OS X 10.5).3 +First, you need to install [[JSch>>http://sourceforge.net/projects/jsch/]]. We use the //jsch-0.1.29// release, we didn't try a later release. Copy the JAR into ///Developer/Java/Ant/lib/// (Mac OS X 10.4) or ///usr/share/ant/lib/// (Mac OS X 10.5). 4 4 5 -Next, you need to add this JAR to the Ant lib list inside Eclipse. Open Eclipse's preferences (Eclipse->Preferences), open the //Tab// triangle and click on //Runtime//. Select //Ant Home Entries// and click on //Add External JARs...// Browse up to ///Developer/Java/Ant/lib/// and select //jsch-0.X.XX.jar//. The JAR should now be part of the list of JARs available for Ant. 5 +Next, you need to add this JAR to the Ant lib list inside Eclipse. Open Eclipse's preferences (Eclipse->Preferences), open the //Tab// triangle and click on //Runtime//. Select //Ant Home Entries// and click on //Add External JARs...// Browse up to ///Developer/Java/Ant/lib/// and select //jsch-0.X.XX.jar//. The JAR should now be part of the list of JARs available for Ant. 6 6 7 7 {{warning}} 8 -If you use multiple workspaces, you have to add the JAR to each of your workspaces to the //Ant Home Entries// list. 8 + 9 +If you use multiple workspaces, you have to add the JAR to each of your workspaces to the _Ant Home Entries_ list. 10 + 9 9 {{/warning}} 10 10 11 -Ok, now it's time to actually create a Ant task for deployment. You can add a property like this to //build.properties//: 13 +Ok, now it's time to actually create a Ant task for deployment. You can add a property like this to //build.properties//: 12 12 13 13 {{code}} 14 14 ... ... @@ -33,7 +33,7 @@ 33 33 34 34 {{/code}} 35 35 36 -Wait a minute... Maybe //Ant// will complain because it can't send the password to the remote server. How to fix this ? By creating a SSH public key if you don't already have one. 38 +Wait a minute... Maybe //Ant// will complain because it can't send the password to the remote server. How to fix this ? By creating a SSH public key if you don't already have one. 37 37 38 38 First, check if you already have a public key on your computer: 39 39 ... ... @@ -44,7 +44,7 @@ 44 44 45 45 {{/code}} 46 46 47 -No //id _rsa.pub// file ? Create one:49 +No //id//rsa.pub// file ? Create one~:// 48 48 49 49 {{code}} 50 50 ... ... @@ -60,7 +60,7 @@ 60 60 61 61 {{/code}} 62 62 63 -and put your public key in the //authorized _keys// file:65 +and put your public key in the //authorized//keys// file~:// 64 64 65 65 {{code}} 66 66 ... ... @@ -68,4 +68,4 @@ 68 68 69 69 {{/code}} 70 70 71 -Now, next time that you login by SSH from your computer to the server, it will stop asking for a password and the Ant task will stop complaining. For added security, when you create your key, use a passphrase. Don't forget to put the passphrase into the //sshexec// task. Don't use the passphrase if you put the //build.xml// file in CVS or SVN, because your co-workers will see your passphrase and also they won't be able to use the sshexec task unless they use the same passphrase as you. 73 +Now, next time that you login by SSH from your computer to the server, it will stop asking for a password and the Ant task will stop complaining. For added security, when you create your key, use a passphrase. Don't forget to put the passphrase into the //sshexec// task. Don't use the passphrase if you put the //build.xml// file in CVS or SVN, because your co-workers will see your passphrase and also they won't be able to use the sshexec task unless they use the same passphrase as you.