diff --git a/memorystore/redis/gce_deployment/deploy.sh b/memorystore/redis/gce_deployment/deploy.sh index 06f8e5ec21b..fcbf874617f 100755 --- a/memorystore/redis/gce_deployment/deploy.sh +++ b/memorystore/redis/gce_deployment/deploy.sh @@ -14,13 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # [START memorystore_deploy_sh] -if [ -z "$GCS_APP_LOCATION" ]; then - if [ -z "$BUCKET"]; then - echo "Must set \$BUCKET. For example: BUCKET=my-bucket-name" +if [ -z "$GCS_BUCKET_NAME" ]; then + echo "Must set \$GCS_BUCKET_NAME. For example: GCS_BUCKET_NAME=my-bucket" exit 1 - fi - GCS_APP_LOCATION="gs://$BUCKET/gce/" - echo $GCS_APP_LOCATION fi if [ -z "$ZONE" ]; then @@ -37,7 +33,7 @@ cd .. mvn clean package #Copy the WAR artifact to the GCS bucket location -gsutil cp -r target/${WAR} ${GCS_APP_LOCATION} +gsutil cp -r target/${WAR} gs://"$GCS_BUCKET_NAME"/gce/ cd gce_deployment @@ -48,7 +44,7 @@ gcloud compute instances create my-instance \ --machine-type=g1-small \ --scopes cloud-platform \ --metadata-from-file startup-script=startup-script.sh \ - --metadata app-location=${GCS_APP_LOCATION},app-war=$WAR \ + --metadata gcs-bucket=$GCS_BUCKET_NAME,app-war=$WAR \ --zone $ZONE \ --tags http-server diff --git a/memorystore/redis/gce_deployment/startup-script.sh b/memorystore/redis/gce_deployment/startup-script.sh index 5bd5ab72bbe..fe7d00c1c2e 100644 --- a/memorystore/redis/gce_deployment/startup-script.sh +++ b/memorystore/redis/gce_deployment/startup-script.sh @@ -18,10 +18,10 @@ set -ex # Talk to the metadata server to get the project id and location of application binary. PROJECTID=$(curl -s "http://metadata.google.internal/computeMetadata/v1/project/project-id" -H "Metadata-Flavor: Google") -GCS_APP_LOCATION=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/attributes/app-location" -H "Metadata-Flavor: Google") +GCS_BUCKET_NAME=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcs-bucket" -H "Metadata-Flavor: Google") WAR=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/attributes/app-war" -H "Metadata-Flavor: Google") -gsutil cp "$GCS_APP_LOCATION"** . +gsutil cp gs://"$GCS_BUCKET_NAME"/gce/"$WAR" . # Install dependencies from apt apt-get update