Java Web プロジェクトのデプロイのために gcloud doc を検索しましたが、結果として maven プロジェクトのドキュメントしか得られませんでした。プロジェクトは既に Google クラウド コンソールで作成されており、Google SDK もインストールされています。
1 に答える
0
1 つの方法は、単純に ant で sshexec および scp タスクを使用して Google クラウド マシンに接続し、tarball をデポジットして抽出することです。例としては..:
<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>
上記はテストされていません..gcloudインスタンス化されたグループを処理するより良い方法を探しているときに、これを使用することになりました。
于 2016-05-01T13:52:14.757 に答える