You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Raghuveer <ra...@infotechsw.com> on 2006/05/11 08:38:27 UTC

deploy by ant

My customer requirement is to use ANT.
i.e
-	Application must use ANT to build and deploy

I have written build.xml for build.

What does "deploy" means.
How can be done the same using ANT.


Re: deploy by ant

Posted by Steve Loughran <st...@apache.org>.
Raghuveer wrote:
> My customer requirement is to use ANT.
> i.e
> -	Application must use ANT to build and deploy
> 
> I have written build.xml for build.
> 
> What does "deploy" means.

"deployment" is the act of getting your program up and running on the 
server.

It could mean


1. to get your war file to the remote site and in the directory of the 
app server

use scp, ssh, copy,

   <!-- SCP logic from JDwA, core-chapter-08.xml -->


   <!--
     init file should look like
     ssh.server=192.168.2.84
     ssh.user=${user.name}
     ssh.dir=SmartFrog/dist/
     ssh.keyfile=${user.home}/.ssh/id_rsa
     ssh.passphrase=secret
     ssh.port=22
     ssh.verbose=true

     the secure/ dir should not be readable by group; in windows lock it 
down
       -->
   <target name="ssh-init" depends="init">
     <fail unless="server">Set the "server" property!</fail>
     <property name="ssh.propfile"
         location="hosts/secure/${server}.ssh.properties"/>
     <loadproperties srcFile="${ssh.propfile}"/>
     <property name="tmp.dir" location="${build.dir}/tmp"/>
     <mkdir dir="${tmp.dir}"/>
     <presetdef name="ssh-cmd">
       <sshexec host="${ssh.server}"
           username="${ssh.user}"
           port="${ssh.port}"
           passphrase="${ssh.passphrase}"
           keyfile="${ssh.keyfile}"/>
     </presetdef>
     <presetdef name="ssh-cp">
       <scp
           passphrase="${ssh.passphrase}"
           keyfile="${ssh.keyfile}"
           port="${ssh.port}"
           verbose="${ssh.verbose}">
       </scp>
     </presetdef>
   </target>


   <target name="ssh-mkdirs" depends="ssh-init">
     <ssh-cmd command="mkdir -p ${ssh.dir}/bin"/>
     <ssh-cmd command="mkdir -p ${ssh.dir}/lib"/>
   </target>

   <target name="ssh-prepare-files" depends="install">
     <fileset id="ssh.fileset" dir="${install.dir}" includes="*.jar"/>
   </target>

   <!-- insert trust="true" to turn on trust -->
   <target name="scp-upload" 
depends="ssh-init,ssh-mkdirs,ssh-stop,ssh-prepare-files">
     <echo>SCP target is ${ssh.server}</echo>
     <property name="ssh.path"
         value="${ssh.user}@${ssh.server}:${ssh.dir}"/>
     <!--copy the binaries-->
     <ssh-cp remoteToDir="${ssh.path}/lib">
       <fileset refid="ssh.fileset"/>
     </ssh-cp>
     <ssh-cp remoteToDir="${ssh.path}/bin">
       <fileset dir="hosts/${server}" includes="default.*"/>
     </ssh-cp>

   </target>

   <target name="ssh-stop" depends="ssh-init">
     <ssh-cmd command="cd ${ssh.dir}; nohup ./sfStopDaemon localhost &amp;"
     failonerror="false"/>
   </target>

   <target name="ssh-start" depends="ssh-init">
     <ssh-cmd command="cd ${ssh.dir}; nohup ./sfStartDaemon &amp;"/>
   </target>

   <target name="scp" depends="scp-upload,ssh-start"
       description="upload the files"/>


2.to configure the app server and the database correctly with the app 
running inside


   You can look at cargo from cargo.codehaus.org to do this

3. to scp up the the files then configure the app server and the 
database correctly with the app running inside on a remote box somewhere 
beyond your own firewall.

This is actually what happens in the example in (1), with the 
server-side workflow all handled by the smartfrog runtime:

http://www.hpl.hp.com/research/smartfrog/presentations/Taming_deployment_with_SmartFrog.pdf

This is not a trivial exercise, but, being automated, means I can roll 
out deployments to my home server from work, bring up the app server 
with the soap stack, have log4j route the output to a logs/ directory 
that one servlet context actually publishes, letting people remotely do 
it. Then we deploy a set of junit tests against that endpoint and three 
others on a different box and do real long haul testing of a SOAP endpoint.

> How can be done the same using ANT.


It depends entirely what you want to do. I think the key goal of the 
(fairly minimal) requirements are that there is some target
	ant deploy
That will get your WAR or EAR file up to the server and into the right 
directory. If the app server (like jboss) has hot deployment of copied 
files, that is enough for a live redeploy. Though I prefer to use catcus 
as cold starts are cleaner.

However, as deployment varies with each project, there is no one 
<deploy> task that does your work.

I will leave you with one warning. Getting deployment right is hard. 
Start now, not a week before you go live.

-Steve








---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: [SPAM-H] - Re: deploy by ant - Email has different SMTP TO: and MIME TO: fields in the email addresses

Posted by "Devaraj, Geethakrishnan" <ge...@ncmr.co.in>.
i'll speak in the sense of a java project..

deploy refers to stopping a server,creating the neccessary jars,wars,running
the scripts,copy the war to the domain folder,start the server..

a target deploy should depend on all these..

and aslo suppose ur server is located remotely u need to add an scp task to
transfer the files.
----- Original Message ----- 
From: "Joe Schmetzer" <jo...@exubero.com>
To: <ra...@infotechsw.com>
Cc: "'Ant Users List'" <us...@ant.apache.org>
Sent: Thursday, May 11, 2006 12:57 PM
Subject: [SPAM-H] - Re: deploy by ant - Email has different SMTP TO: and
MIME TO: fields in the email addresses


> On Thu, 11 May, 2006 7:38 am, Raghuveer wrote:
> > My customer requirement is to use ANT.
> > i.e
> > - Application must use ANT to build and deploy
> >
> > I have written build.xml for build.
> >
> > What does "deploy" means.
>
> Deploy means to make your software available for use by end users. See
> http://en.wikipedia.org/wiki/Software_deployment for some hints.
>
> > How can be done the same using ANT.
>
> 1. Work out all the activities and tasks that need to be done to deploy
> your software.
>
> 2. Automate these activities, using an Ant script, or other suitable
tools.
>
> Good luck!
> -- 
> Joe Schmetzer .:. Renaissance Developer .:. http://www.exubero.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: deploy by ant

Posted by Joe Schmetzer <jo...@exubero.com>.
On Thu, 11 May, 2006 7:38 am, Raghuveer wrote:
> My customer requirement is to use ANT.
> i.e
> -	Application must use ANT to build and deploy
>
> I have written build.xml for build.
>
> What does "deploy" means.

Deploy means to make your software available for use by end users. See
http://en.wikipedia.org/wiki/Software_deployment for some hints.

> How can be done the same using ANT.

1. Work out all the activities and tasks that need to be done to deploy
your software.

2. Automate these activities, using an Ant script, or other suitable tools.

Good luck!
-- 
Joe Schmetzer .:. Renaissance Developer .:. http://www.exubero.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org