Skip to content

Instantly share code, notes, and snippets.

@KalikaKay
Created May 8, 2018 18:28
Show Gist options
  • Save KalikaKay/b0487dafdebeeeaf48a073caff3621e0 to your computer and use it in GitHub Desktop.
Save KalikaKay/b0487dafdebeeeaf48a073caff3621e0 to your computer and use it in GitHub Desktop.
Cloud9 Google App

I keep returning to Loyall's website for support.

Putting this here for safe keeping. Assumpgions:

  • You're ready to deploy a website. I my case, it's Hugo.
  • You're on a Cloud9 base workspace environment.

Download and install the Google Cloud SDK

  • Make sure Python 2.7.x (and not higher) is installed

    $ /usr/bin/env python -V

  • Install the the gcloud SDK, you can check the documentation on the Google Cloud official website.

    • Check the gcloud version - you want these things installed.
    Google Cloud SDK 166.0.0
    bq 2.0.25
    core 2017.08.07
    gcloud 
    gsutil 4.27
    
  • install the app-engine-go component.

    • run gcloud components list
    • run gcloud components install app-engine-go if it's not already installed.
  • Create your project at the Google Cloud Console

  • Start with gcloud initialization using gcloud init

  • Create an App Engine application file app.yaml at the root of your workspace (same level as the config.toml file) and add the following content to it.

runtime: go
api_version: go1

handlers:
- url: /.*
  script: _go_app
  • Create the main.go file at the same level.
package main

import "net/http"

func init() {
	http.Handle("/", http.FileServer(http.Dir("public")))
}
  • build your site using hugo
  • Deploy your application $ gcloud app deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment