Skip to content

anz-bank/go-slides

Repository files navigation

Go training slides

This projects contains presentations rendered by present.

content/ contains the presentations following the present syntax

This projects is continuously deployed to Appengine at https://gotraining.appspot.com/ when merged into master.

Run locally with

Run the present tool locally with

go run . -base . -content content

For an Appengine like environment run

GAE_ENV=standard go run .

Appengine deployment

The "production" slides are deployed to the gotraining project. There is limited access to this project - slides are automatically deployed when the master branch of this repository is updated (usually merging a PR).

The gotraining-testing project is available with laxer permissions to allow you to deploy pre-release versions of the slides for testing, and should be used to deploy your PR version for review.

You should set up one or both of these projects with the gcloud command so that you can deploy PR versions and/or manually deploy the production version as necessary:

gcloud config configurations create gotraining-testing
gcloud config set account [email protected]
gcloud config set project gotraining-testing

If you are having SSL validation issues (due to a corporate network or otherwise), you can disable SSL validation as a last resort:

gcloud config set auth/disable_ssl_validation

You will need to authenticate the new configuration:

gcloud auth login

Deployment for PR review

When you have a PR open for review, you can deploy the changes under review as an appengine "service" so it can be deployed alongside the master/default version of the slides as well as other open PRs. It can easily be cleaned up when your PR is closed.

  1. Edit app.yaml and add service: prNN to the end of the file (top-level yaml key) where NN is your pull request number. You could put it at the top of the file if that is easier.

  2. Deploy to app engine: gcloud --configuration=gotraining-testing app deploy

  3. In your browser, go to https://prNN-dot-gotraining-testing.appspot.com/

  4. Review the changes as your reviewer will see them

  5. When done, delete the app engine service: gcloud --configuration=gotraining-testing app services delete prNN

  6. Undo changes to app.yaml: git checkout -- app.yaml

Please make sure you do not commit a version of app.yaml with your service: line in it. This should only ever be local to your workspace.

You should also make sure your workspace is clean of changes so what you deploy is what is on the PR branch in github. run git describe --all --dirty and if that outputs a string with -dirty on the end, you have uncommitted changes. Stash them before you deploy (git stash -u) and unstash after (git stash pop). Note that you should check this before modifying the app.yaml file as that will make your workspace dirty. You can run git status and git diff if you need to and ensure the only dirtyness is the service: prNN line in app.yaml.

Manual production Appengine deployment

Request access to GCP gotraining project from a contributor.

Add a new gcloud configuration as described in the Appengine deployment section, using gotraining instead of gotraining-testing.

With the gotraining configuration active, Execute

gcloud app deploy

or test the coudbuild with

gcloud builds submit --config cloudbuild.yaml

Attribution

The Go course materials in this project were collated by @juliaogris with many cues taken from A Tour of Go and Go by Example.

Extra special thanks to @camh-anz for countless reviews, improvement suggestions and code contributions.

Many thanks also to @anzdaddy for suggesting the pingserver comparison, to @pentaphobe for the syntax colouring contribution and to @anzboi for creating go-samplerest - they and @anz-rfc also contributed in many reviews.

@anzboi, @camh-anz, @linuxmonk, @Joshcarp, @juliaogris and @rokane collaborated on an updated version of the materials for a follow up course.

License

This work is copyright Australia and New Zealand Banking Group Limited and licensed under a Creative Commons Attribution 3.0 Unported License.