go-slides

command module
v0.0.0-...-3fa5252 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

README

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 your@email.address
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.

Documentation

Overview

Present displays slide presentations and articles. It runs a web server that presents slide and article files from the current directory.

It may be run as a stand-alone command or an App Engine app.

The setup of the Go version of NaCl is documented at: https://golang.org/wiki/NativeClient

To use with App Engine, copy the files in the tools/cmd/present directory to the root of your application and create an app.yaml file similar to this:

runtime: go111

handlers:
- url: /favicon.ico
  static_files: static/favicon.ico
  upload: static/favicon.ico
- url: /static
  static_dir: static
- url: /.*
  script: auto

# nobuild_files is a regexp that identifies which files to not build.  It
# is useful for embedding static assets like code snippets and preventing
# them from producing build errors for your project.
nobuild_files: [path regexp for talk materials]

When running on App Engine, content will be served from the ./content/ subdirectory.

Present then can be tested in a local App Engine environment with

GAE_ENV=standard go run .

And deployed using

gcloud app deploy

Input files are named foo.extension, where "extension" defines the format of the generated output. The supported formats are:

.slide        // HTML5 slide presentation
.article      // article format, such as a blog post

The present file format is documented by the present package: http://godoc.org/golang.org/x/tools/present

Directories

Path Synopsis
Arrays Buffered channels channels channels continued channels_buffered channels_range channels_unbuffered Closures Constants Defer Defer errors errors errors errors_are_values error_compare errors_presence For Functions Functions goroutines goroutines_helloworld If/Else Interfaces json - marshal / unmarshal json - zero values Maps Methods Packages panic panic_recover panic_recover_wret Pointers Pointers Range select select_timeout Slices Structs Switch Type conversion Values Variables Variadic
Arrays Buffered channels channels channels continued channels_buffered channels_range channels_unbuffered Closures Constants Defer Defer errors errors errors errors_are_values error_compare errors_presence For Functions Functions goroutines goroutines_helloworld If/Else Interfaces json - marshal / unmarshal json - zero values Maps Methods Packages panic panic_recover panic_recover_wret Pointers Pointers Range select select_timeout Slices Structs Switch Type conversion Values Variables Variadic

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL