Merge "playground: builder cleanups"
diff --git a/tools/playground/builder/Dockerfile b/tools/playground/builder/Dockerfile
index 7fa5017..eb7f08f 100644
--- a/tools/playground/builder/Dockerfile
+++ b/tools/playground/builder/Dockerfile
@@ -13,7 +13,7 @@
ENV HOME /root
ENV VEYRON_ROOT /usr/local/veyron
ENV GOPATH /home/playground:$VEYRON_ROOT/veyron/go
-ENV VDLPATH /home/playground:$VEYRON_ROOT/veyron/go
+ENV VDLPATH $GOPATH
# Setup veyron and veyron profiles.
# Note: This will be cached! If you want to re-build the docker image using
@@ -41,10 +41,10 @@
RUN veyron go install veyron.io/veyron/...
# Uncomment the following lines to install a version of the builder tool using
-# the local copy of vbuild.go. This is useful when developing and testing local
-# changes to the builder tool.
+# your local version of the code. This is useful when developing and testing
+# local changes to the builder tool.
# RUN rm $VEYRON_ROOT/veyron/go/bin/builder
-# ADD vbuild.go /usr/local/veyron/veyron/go/src/veyron/tools/playground/builder/vbuild.go
+# ADD builder.go /usr/local/veyron/veyron/go/src/veyron/tools/playground/builder/builder.go
# ADD identity.go /usr/local/veyron/veyron/go/src/veyron/tools/playground/builder/identity.go
# ADD services.go /usr/local/veyron/veyron/go/src/veyron/tools/playground/builder/services.go
# RUN veyron go install veyron/tools/playground/builder
diff --git a/tools/playground/builder/vbuild.go b/tools/playground/builder/builder.go
similarity index 100%
rename from tools/playground/builder/vbuild.go
rename to tools/playground/builder/builder.go
diff --git a/tools/playground/compilerd/update.sh b/tools/playground/compilerd/update.sh
index 523c3c9..e4d07fa 100644
--- a/tools/playground/compilerd/update.sh
+++ b/tools/playground/compilerd/update.sh
@@ -14,61 +14,61 @@
readonly DISK="pg-data-${DATE}"
function unmount() {
- sudo umount /mnt
- gcloud compute --project "google.com:veyron" instances detach-disk --disk="$DISK" $(hostname) --zone us-central1-a
+ sudo umount /mnt
+ gcloud compute --project "google.com:veyron" instances detach-disk --disk="$DISK" $(hostname) --zone us-central1-a
}
function cleanup() {
- if [[ -e /mnt/compilerd ]]; then
- unmount
- # if the disk was still mounted, nothing is using it so go ahead
- # and delete it.
- gcloud compute --project "google.com:veyron" disks delete "${DISK}" --zone "us-central1-a"
- fi
- sudo docker rm "${DISK}" || true
+ if [[ -e /mnt/compilerd ]]; then
+ unmount
+ # if the disk was still mounted, nothing is using it so go ahead
+ # and delete it.
+ gcloud compute --project "google.com:veyron" disks delete "${DISK}" --zone "us-central1-a"
+ fi
+ sudo docker rm "${DISK}" || true
}
trap cleanup EXIT
function main() {
- if [[ ! -e ~/.netrc ]]; then
- echo "Unable to access git, missing ~/.netrc"
- exit 1
- fi
+ if [[ ! -e ~/.netrc ]]; then
+ echo "Unable to access git, missing ~/.netrc"
+ exit 1
+ fi
- gcloud compute --project "google.com:veyron" disks create "${DISK}" --size "200" --zone "us-central1-a" --source-snapshot "pg-data-20140702" --type "pd-standard"
- gcloud compute --project "google.com:veyron" instances attach-disk --disk="$DISK" $(hostname) --zone us-central1-a
- sudo mount /dev/sdb1 /mnt
+ gcloud compute --project "google.com:veyron" disks create "${DISK}" --size "200" --zone "us-central1-a" --source-snapshot "pg-data-20140702" --type "pd-standard"
+ gcloud compute --project "google.com:veyron" instances attach-disk --disk="$DISK" $(hostname) --zone us-central1-a
+ sudo mount /dev/sdb1 /mnt
- # Build the docker image.
- cd ${VEYRON_ROOT}/veyron/go/src/veyron.io/veyron/veyron/tools/playground/builder
- cp ~/.netrc ./netrc
- sudo docker build --no-cache -t playground .
- rm -f ./netrc
+ # Build the docker image.
+ cd ${VEYRON_ROOT}/veyron/go/src/veyron.io/veyron/veyron/tools/playground/builder
+ cp ~/.netrc ./netrc
+ sudo docker build --no-cache -t playground .
+ rm -f ./netrc
- # Export the docker image to disk.
- sudo docker save -o /mnt/playground.tar.gz playground
+ # Export the docker image to disk.
+ sudo docker save -o /mnt/playground.tar.gz playground
- # Copy the compilerd binary from the docker image to the disk.
- sudo docker run --name=${DISK} playground || true
- sudo docker cp ${DISK}:/usr/local/veyron/veyron/go/bin/compilerd /tmp
- sudo mv /tmp/compilerd /mnt/compilerd
- sudo docker rm ${DISK}
+ # Copy the compilerd binary from the docker image to the disk.
+ sudo docker run --name=${DISK} playground || true
+ sudo docker cp ${DISK}:/usr/local/veyron/veyron/go/bin/compilerd /tmp
+ sudo mv /tmp/compilerd /mnt/compilerd
+ sudo docker rm ${DISK}
- # Detach the disk so the backends can mount it.
- unmount
+ # Detach the disk so the backends can mount it.
+ unmount
- # Update the template to use the new disk.
- cd ../compilerd
- sed -i -e s/pg-data-20140820/${DISK}/ pool_template.json
- gcloud preview replica-pools --zone=us-central1-a update-template --template=pool_template.json playground-pool
- git checkout -- pool_template.json
+ # Update the template to use the new disk.
+ cd ../compilerd
+ sed -i -e s/pg-data-20140820/${DISK}/ pool_template.json
+ gcloud preview replica-pools --zone=us-central1-a update-template --template=pool_template.json playground-pool
+ git checkout -- pool_template.json
- # Rolling restart of the replicas.
- INSTANCES=$(gcloud preview replica-pools --zone=us-central1-a replicas --pool=playground-pool list|grep name:|cut -d: -f2)
- for i in ${INSTANCES}; do
- gcloud preview replica-pools --zone=us-central1-a replicas --pool=playground-pool restart ${i}
- sleep 5m
- done
+ # Rolling restart of the replicas.
+ INSTANCES=$(gcloud preview replica-pools --zone=us-central1-a replicas --pool=playground-pool list|grep name:|cut -d: -f2)
+ for i in ${INSTANCES}; do
+ gcloud preview replica-pools --zone=us-central1-a replicas --pool=playground-pool restart ${i}
+ sleep 5m
+ done
}
main "$@"