WS GCP Part2: Prepare a deploy virtual machine (VM) - Gapminder/waffle-server GitHub Wiki

WARNING! This article may change without notice since both GCP and Waffle Server are in active development

This instruction describes setting up a deploy virtual machine (VM), which will be used to manage the deployment of WS to GCP. Be sure you have followed the previous chapter:

WS GCP Part1: Getting started with Google Cloud Web GUI



1. Create a deploy VM

  • Go to Google Cloud Web GUI

  • Press burger menu on the left, go to compute engine - VM instances, wait until compute engine is getting ready… (refresh page after a minute if it doesn’t come through). Possibly you’ll need to agree to enable the billing here

  • Press [Create]

  • Set name to deploy-vm (this choice doesn't influence any further options)

  • See the section for Boot Disk is and press [Change]

  • Pick Ubuntu 16.04 LTS and press [Select]

  • Keep everything else default, scroll down, press [CREATE].

  • Wait until it starts up, then press [SSH] to connect to it.

  • A new tab will open. Wait to get connected. Result:



2. Install all needed software on a fresh Ubuntu instance you've just created

  • Create a file in your home dir, make it executable, start editing:
cd //home/$USER
touch setup.sh
sudo chmod +x setup.sh
nano setup.sh
  • Insert the following into the file (Ctrl+V)
#!/bin/bash
sudo apt-get update
# install docker
sudo apt-get install docker.io

# install nodejs and give it access rights
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo chown -R $USER /usr/local

# install build-essentials
sudo apt-get install -y g++ build-essential
# GCLOUD: Create an environment variable for the correct distribution
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
# GCLOUD: Add the Cloud SDK distribution URI as a package source
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
# GCLOUD: Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
# GCLOUD: Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk && sudo apt-get install kubectl

python -V
npm -v
node -v
git --version
docker -v
gcloud -v
kubectl version
  • Exit and save the file (Ctrl + X, then Y, then Enter)

  • Run the file you’ve created: sudo ./setup.sh (press Yes somewhere midway). The end of the output prints versions of all the components needed for the next steps and it should look like this:

3. Give yourself lots of permissions and restart the VM

sudo usermod -a -G docker $USER
sudo chmod -R 777 ~/.config/
sudo chmod -R 777 /usr/lib/node_modules 
sudo chmod 775 /usr/bin
sudo reboot
  • Press [Reconnect] (or reconnect from the Google cloud web GUI)



Next part: WS GCP Part3: Setting up WS repo and connection to Github

⚠️ **GitHub.com Fallback** ⚠️