Created
March 21, 2014 05:32
-
-
Save adam-singer/9680114 to your computer and use it in GitHub Desktop.
Example of deploying dart to google compute engine without having to compile the dart-sdk from source.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set +o xtrace | |
USER=$USER | |
PROJECT=dart-compute-project | |
INSTANCE_NAME=dart-compute | |
TAGS=dart | |
MACHINE_TYPE=f1-micro | |
NETWORK=default | |
IP=ephemeral | |
IMAGE=https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20140318 | |
SCOPES=https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/compute,https://www.googleapis.com/auth/devstorage.full_control | |
PERSISTENT_BOOT_DISK=true | |
AUTO_DELETE_BOOT_DISK=true | |
ZONE=us-central1-b | |
STARTUP_SCRIPT=startup-script.sh | |
GCUTIL="gcutil --service_version=v1 --project=$PROJECT" | |
$GCUTIL addinstance $INSTANCE_NAME --tags=$TAGS --zone=$ZONE --machine_type=$MACHINE_TYPE --network=$NETWORK --external_ip_address=$IP --service_account_scopes=$SCOPES --image=$IMAGE --persistent_boot_disk=$PERSISTENT_BOOT_DISK --auto_delete_boot_disk=$AUTO_DELETE_BOOT_DISK --metadata_from_file=startup-script:$STARTUP_SCRIPT | |
rc=$? | |
if [[ $rc != 0 ]] ; then | |
echo "Not able to add instance" | |
exit $rc | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Add an addtional source for the latest glibc | |
sudo sed -i '1i deb http://ftp.us.debian.org/debian/ jessie main' /etc/apt/sources.list | |
# Update sources | |
sudo apt-get update | |
# Download latest glibc | |
sudo DEBIAN_FRONTEND=noninteractive apt-get -t jessie install -y libc6 libc6-dev libc6-dbg git screen unzip | |
# Download the latest dart sdk | |
wget http://storage.googleapis.com/dart-archive/channels/dev/release/latest/sdk/dartsdk-linux-x64-release.zip -O dartsdk-linux-x64-release.zip | |
# Unpack the dart sdk | |
unzip -d / dartsdk-linux-x64-release.zip | |
# Make the sdk readable | |
chmod -R go+rx /dart-sdk | |
# Add dart bin to global path | |
echo "export PATH=$PATH:/dart-sdk/bin" > /etc/profile.d/dart-env.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment