Skip to content

Commit d898fc1

Browse files
jabubakekurtisvg
authored andcommitted
Simplifying to GCS_BUCKET_NAME instead of GCS_APP_LOCATION (GoogleCloudPlatform#1205)
1 parent c12d964 commit d898fc1

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

memorystore/redis/gce_deployment/deploy.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
# [START memorystore_deploy_sh]
17-
if [ -z "$GCS_APP_LOCATION" ]; then
18-
if [ -z "$BUCKET"]; then
19-
echo "Must set \$BUCKET. For example: BUCKET=my-bucket-name"
17+
if [ -z "$GCS_BUCKET_NAME" ]; then
18+
echo "Must set \$GCS_BUCKET_NAME. For example: GCS_BUCKET_NAME=my-bucket"
2019
exit 1
21-
fi
22-
GCS_APP_LOCATION="gs://$BUCKET/gce/"
23-
echo $GCS_APP_LOCATION
2420
fi
2521

2622
if [ -z "$ZONE" ]; then
@@ -37,7 +33,7 @@ cd ..
3733
mvn clean package
3834

3935
#Copy the WAR artifact to the GCS bucket location
40-
gsutil cp -r target/${WAR} ${GCS_APP_LOCATION}
36+
gsutil cp -r target/${WAR} gs://"$GCS_BUCKET_NAME"/gce/
4137

4238
cd gce_deployment
4339

@@ -48,7 +44,7 @@ gcloud compute instances create my-instance \
4844
--machine-type=g1-small \
4945
--scopes cloud-platform \
5046
--metadata-from-file startup-script=startup-script.sh \
51-
--metadata app-location=${GCS_APP_LOCATION},app-war=$WAR \
47+
--metadata gcs-bucket=$GCS_BUCKET_NAME,app-war=$WAR \
5248
--zone $ZONE \
5349
--tags http-server
5450

memorystore/redis/gce_deployment/startup-script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ set -ex
1818

1919
# Talk to the metadata server to get the project id and location of application binary.
2020
PROJECTID=$(curl -s "http://metadata.google.internal/computeMetadata/v1/project/project-id" -H "Metadata-Flavor: Google")
21-
GCS_APP_LOCATION=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/attributes/app-location" -H "Metadata-Flavor: Google")
21+
GCS_BUCKET_NAME=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/attributes/gcs-bucket" -H "Metadata-Flavor: Google")
2222
WAR=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/attributes/app-war" -H "Metadata-Flavor: Google")
2323

24-
gsutil cp "$GCS_APP_LOCATION"** .
24+
gsutil cp gs://"$GCS_BUCKET_NAME"/gce/"$WAR" .
2525

2626
# Install dependencies from apt
2727
apt-get update

0 commit comments

Comments
 (0)