Prerequisites
- Go 1.6.
- Google App Engine SDK for Go 1.9.35+.
Once installed, make sure the SDK root dir is in
$PATH. You can verify it's been setup correctly by runninggoapp version, which should output something likego version go1.6 (appengine-1.9.35).
Setup
git clone https://github.com/GoogleChrome/ioweb2016.gitcd ioweb2016npm install
If you plan on modifying source code, be a good citizen and:
- Install EditorConfig plugin for your favourite editor. The plugin should automatically pick up the .editorconfig settings.
- Obey the pre-commit hook that's installed as part of
gulp setup. It will check for JavaScript and code style errors before committing to themasterbranch.
Run gulp serve to start the app.
Normally the app is running in "dev" environment but you can change that
by providing --env argument to the gulp task:
# run in dev mode, default:
gulp serve
# set app environment to production:
gulp serve --env prod
# or run as if we were in staging:
gulp serve --env stage
Not that this does not change the way the backend code is compiled or the front-end is built. It merely changes a "environment" variable value, which the app takes into account when rendering a page or responding to a request.
Running in stage or prod requires real credentials when accessing external services.
You'll need to run a one-off gulp decrypt which will decrypt a service account private key.
Other arguments are:
--no-watchdon't watch for file changes and recompile relative bits.--openopen serving url in a new browser tab on start.--reloadenable live reload. Always watches for file changes;--no-watchwill have no effect.
Run gulp. This will create dist directory with both front-end and backend parts, ready for deploy.
Note: Build won't succeed if either gulp jshint or gulp jscs reports errors.
You can also serve the build from dist by running gulp serve:dist,
and navigating to http://localhost:8080.
serve:dist runs the app in prod mode by default. You can change that
by providing the --env argument as with other serve tasks. For instance:
# run in stage instead of prod
gulp serve:dist --env stage
To deploy complete application on App Engine:
- Run
gulp serve:distwhich will build the app indistdirectory and start local server. - Perform any necessary manual checks.
- Run
GAE_SDK/goapp deploy -application io-webapp-2016 -version <v> dist/backend/.
Backend is written in Go, hosted on Google App Engine.
cd backend && goapp test will run backend server tests. You'll need to make sure
there's a server.config file in the backend dir.
A list of tools to help in a debugging process. NOT available in prod
http://HOST/io2016/debug/srvget?url=<some-url>
The backend will GET some-url and respond back with the original
status code, content-type header and the content.
Useful for browsing original CMS data on staging GCS bucket:
When setting up your own version of the Google IO Web app you need to create new Firebase databases,
set them up and configure the app to use them.
First, create one or more (depending on how many shards you need) Firebase databases from
http://firebase.com and note their Databases URLs.
In the backend/server.config file list the Firebase Databases URLs in the firebase.shards attribute.
For each Firebase databases you need to configure configure Login and Auth:
- Open the Auth settings page:
https://<firebase-app-id>.firebaseio.com/?page=Auth - If the database is going to be used on prod enter
events.google.comin theAuthorized Domains for OAuth Redirectsfield or whichever domain your app will be served from in prod. - Below click on the
Googletab thenEnable Google Authentication - Provide the
Google Client IDthat you are using for auth.
Run the following command to deploy the Firebase Security rules to all shards:
gulp deploy:firebaserules
Note: You may be prompted to log in to Firebase if you haven't previously done so.
By default the above will deploy rules to the dev Firebase shards.
To deploy the rules to other environments' shards run:
gulp deploy:firebaserules --env {prod|stage}
http://HOST/io2016/debug/push
Follow instructions on that page.
On staging server this is go/iowastaging/debug/push
http://HOST/io2016/debug/sync
- dev server: localhost:3000/io2016/debug/sync
- staging: go/iowastaging/debug/sync
Frontend tests are run via https://github.com/Polymer/web-component-tester
Configuration is in wct.conf.js.
To run tests, install wct globally:
npm install -g web-component-tester
and run:
wct
Apache 2.0 © 2016 Google Inc.