Setting up Compute Engine with our Virtual Machine

Setting up compute engine involves several steps.

Setting up your machine

You need to make use of Compute Engine to have a working space in which you can install arbitrary python libraries. We have set up a Virtual Machine for you. To access this virtual machine, you will need to give us your email address so we can give you permissions.

Setting up Permissions and Service Accounts

To create an instance, you need to first give yourself the proper permissions to use it. To do this, go to the IAM & Admin menu, and select both the role 'Compute Instance Admin (beta)' and 'App Engine Admin' for your account. Also be sure to check the box allowing HTTP access. 
Next you will need to create a service account that also has proper permissions. I called mine cloud-deployer.  When you create your service account, be sure to select the following roles: Project owner; App engine admin; Compute Instance Admin (beta)

That creation process downloads a file. You need to upload it to your vm. For now just take not of it.

Setting up your Virtual Machine

To set up Compute Engine, use the Linux Quickstart . ( However, instead of the Debian image described in the tutorial in step 4 of 'Create a virtual machine instance', you will need to select a custom image, called idata-class, that will be provided after we set up your permissions. Here is a picture of the screen where you select the custom byte:

In addition, when you create the instance, you will need to specify a service account

Here is what your network looks like on your instance page. The green checkmark indicates that it is running. You can now check if your instance is working by clicking on the word 'SSH' on the VM instances page:
...which will open a shell in a browser window:

Initializing Debian (things we couldn't do for you)

Once you have that shell open, type the following commands:
git clone
git lfs install
cd interactive-data-ml
cp -R jupyter/ ~/.jupyter
ln -s interactive-data-ml public_html

Running Software Services

Some software services you may want to run include jupyter and appspot

Running your Jupyter Notebook (Optional)

First, you will need to set your VM to allow connections to your notebook. At the command line in your shell, you can type
gcloud compute firewall-rules create allow-http --description "Incoming http allowed." --allow tcp:9999 --format json
or if you have any trouble with that, just do it in the GUI:

You are now ready to run your jupyter notebook:
jupyter notebook
which you can load up by opening the external IP listed above (when it is running) at port 9999. Setting up to run Appspot (optional)
Remember the file we mentioned? Now you need to upload it.
It will be uploaded to your home directory. You need to activate your account now:
gcloud auth activate-service-account --key-file [filename]

You can also make sure the appengine api is enabled here:

You can finally run your appspot app by by typing:
cd interactive-data-ml/appspot # or wherever appspot is located
gcloud auth application-default login # follow the directions here
gcloud app deploy

However, you may get an error "Google App Engine Admin API has not been used in project 441883349
05 before or it is disabled. Enable it by visiting [url] then retry."

If you enter the URL given in your browser, and click the big blue 'enable' button, you can try again and it should work. 

Setting up your server to include a website

We have provided everything you need to include a website except the actual files. You can however copy them from the git repository using the following commands:

ln -s /var/www .
cd www
ln -s ~/interactive-data-ml/mlapp/ .
export FLASK_APP=/var/www/mlapp/

Once you have done this, you should be able go to your VM's ip address/mlapp and see the code running.