2016-04-29 6 views
0

bereitstellen Ich habe für gcloud doc für Java-Web-Projekt-Bereitstellung gesucht, aber ich habe nur Maven-Projekt doc im Ergebnis. Projekt bereits in Google Cloud Console erstellt und Google SDK installiert.wie man Java-Webprojekt mit ant auf gcloud vm instance

+0

überprüfen Sie bitte diese [URL] (http://stackoverflow.com/help) es wird nützlich sein, um die Qualität Ihrer Inhalte zu erhöhen –

Antwort

0

Ein Verfahren ist mit sshexec & SCP Aufgaben in ant auf die Google Cloud Maschine einfach verbinden und einen tarball und Extrakt abzuscheiden, könnte ein Beispiel sein, ..:

<target name="deploy-staging" description="Deploy to staging"> 
     <input message="Staging Passphrase:" addproperty="my.password"> 
      <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> 
     </input> 
     <!-- Create the new release folder on host--> 
     <sshexec trust="true" 
       host="hosthere" 
       username="username" 
       keyfile="${user.home}/.ssh/keyfile" 
       passphrase="${my.password}" 
       command="mkdir /var/www/releases/${git.revision}" /> 

     <!-- Push the application tarball to the server--> 
     <scp trust="true" 
      file="${basedir}/build/${git.revision}.tar.gz" 
      todir="[email protected]${hosthere}:/var/www/releases/${git.revision}" 
      keyfile="${user.home}/.ssh/keyfile" 
      passphrase="${my.password}"/> 

     <!-- Extract the tarball on the server--> 
     <sshexec trust="true" 
       host="${hosthere}" 
       username="username" 
       keyfile="${user.home}/.ssh/keyfile" 
       passphrase="${my.password}" 
       command="cd /var/www/releases/${git.revision}; tar -xvzf ${git.revision}.tar.gz" /> 
     <sshexec trust="true" 
       host="${hosthere}" 
       username="username" 
       keyfile="${user.home}/.ssh/keyfile" 
       passphrase="${my.password}" 
       command="rm -rf /var/www/current" /> 

     <sshexec trust="true" 
       host="${hosthere}" 
       username="username" 
       keyfile="${user.home}/.ssh/keyfile" 
       passphrase="${my.password}" 
       command="ln -s /var/www/releases/${git.revision} -T /var/www/current" /> 
    </target> 

Die obigen nicht ist testete .. nutzte dies, um nach einer besseren Möglichkeit zu suchen, mit gcloud instant-Gruppen umzugehen.

Verwandte Themen