I have searched out for gcloud doc for java web project deployment but I got only maven project doc in result. Project already created in google cloud console and google sdk also installed.
Asked
Active
Viewed 176 times
0
-
please check this [URL](http://stackoverflow.com/help)it will be useful to lift your content quality up – Willie Cheng May 10 '16 at 03:18
1 Answers
0
One method is to simply connecting to the google cloud machine with sshexec & scp tasks in ant, and deposit a tarball and extract, an example might be..:
<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="username@${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>
The above isn't tested.. ended up using this whilst searching for a better way to handle gcloud instanced groups.

Zech Walden
- 38
- 1
- 6