abelana-gcp

module
v0.0.0-...-f48b261 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2016 License: Apache-2.0

README

This repository is deprecated and no longer maintained, the sample has been moved to GoogleCloudPlatform/abelana.

Copyright (C) 2016 Google Inc.

Cloud-Abelana-Go

Abelana v2

Is a Java cloud app, with an Android app and iOS (swift) app - please check it out.

Abelana v1

Architecture

Abelana (means "Share" in Zulu) is a project that allows users to take photos and share them with their friends.

This project contains sample code for the Google Cloud Platform. A companion Android Client is helpful to see.

The Cloud apps were written by Les Vogel and Francesc Campoy Flores. For questions and comments, please join the Google Group.

Disclaimer: This sample application is for educational purposes only and is not a Google product or service.

This is a work in progress

It is incomplete
Please be patient!

The goal of this project is to help you learn how to create your applications in the cloud. We will be supporting this project with videos and additional material.

Project setup, installation, and configuration

(Not yet enough to get it running)

How do I, as a developer, bring this project up as my own Google Cloud Platform project?

  1. Grab the project from GitHub
  • Following the Go guidelines, the project belongs in your GOPATH (ours is ~/go).
  • The files go into $GOPATH/src/github.com/GoogleCloudPlatform/abelana-gcp.
  • There are 3 Appe Engine applications:
    • default - the main website, supports identity-toolkit sign-on. (We took their sample).
    • endpoints - Where most of the action occurs.
    • notice - Takes Object Change Notifications from Google Cloud Storage and connects with the Image magick for resizing and re-encoding. Then uploads to GCS, and notifies endpoints.
  • There is also a third party directory of code we modified.
  • The GCE app
    • imagemagick - the docker component for hosting imagemagick.
  • Redis -- Not much there, you should modify the config files for your instance yourself.
  1. Create a Cloud Project
  1. Click on Permissions.
  • Take note of the App Engine Service Account. You'll need this later.
  1. Click on Credentials. You'll need the following:
  • Client ID for Android application

    • Please see this page, you only need step 1 #5.
  • Client ID for web application.

  • Service Account

    • Generate and download a new P12 key.
  • Public API Access

    • Key for browser applications.
    • Key for server applications.
  1. Click on APIs. You will need the following:
  • Google Cloud Storage
  • Google Cloud Storage JSON API
  • Google Compute Engine
  • Google Compute Engine Autoscaler API
  • Google Compute Engine Instance Group Manager API
  • Google Compute Engine Instance Group Updater API
  • Google Compute Engine Instance Groups API
  • Google+ API
  • Identity Toolkit API
  1. Details for the Android Client
  • How we create create the secretKey that resides on Android, used to access Cloud Storage:

    static SecureRandom sr = new SecureRandom();
    
    byte[] android = new byte[32];
    byte[] server = new byte[32];
    byte[] password = new byte[32];
    
    sr.nextBytes(android);
    sr.nextBytes(server);
    
    System.out.println("android:  "+ Base64.encodeToString(android, Base64.NO_PADDING | Base64.URL_SAFE));
    System.out.println("server:   "+ Base64.encodeToString(server, Base64.NO_PADDING | Base64.URL_SAFE));
    
    for(int i = 0; i<32; i++) password[i] = (byte) (android[i] ^ server[i]);
    System.out.println("passphrase: "+ Base64.encodeToString(key, Base64.NO_PADDING | Base64.URL_SAFE));
    
    • Changing the password on the p12 file:
      • openssl pkcs12 -in < key.p12 > -nocerts -passin pass:notasecret -nodes -out /tmp/me.pem
      • openssl pkcs12 -export -in /tmp/me.pem -out < mykey.p12 > -name privatekey -passout < New Passphrase >
      • This mykey.p12 gets copied to the res/raw directory of your Android app
  1. Generating signing key
  • cd endpoints/private
  • openssl ecparam -name secp384r1 -genkey -noout -out signing-key.pem
  1. Storage > Cloud Storage > Storage browser
  • Create two buckets, we typically use xxxx & xxxx-in
  • Add the service account you created earlier as a writer to each bucket.
    (This is where your images are loaded)

e.g.

  • How to make curl requests while authenticated via oauth.
  • How to monitor background jobs.
  • How to run the app through a proxy.
  1. Identity Toolkit
  • TBD
  1. Google Cloud Storage
  • TBD
  1. App Engine Modules
    • In abelana-gcp/endpoints, create a folder called private
    • Create private/gitkit-server-config.json
    {
    

"clientId" : "41652380zzzz-xxxxxxxxxxxxx.apps.googleusercontent.com", "serverApiKey" : "yyyyyyyyyyyyyyyyyyyyyyyy", "widgetUrl" : "https//.appspot.com/gitkit", "cookieName" : "gtoken" }

   * Create **private/abelana-config.json**
   ```json
   {
    "AuthEmail" : "<Service Account Email>@developer.gserviceaccount.com",
    "ProjectID" : "<YOUR PROJECT ID>",
    "Bucket" : "<Your Upload bucket>",
    "RedisPW" : "<YOUR REDIS PASSWORD>",
    "Redis" : "<IP OF YOUR REDIS INSTANCE>:6379",
    "TimelineBatchSize" : 100,
    "UploadRetries" : 5,
    "EnableBackdoor" : false,
    "EnableStubs" : false
}
  1. Redis:
  • Use one click install, to start, you only need 1 instance.
  • Use gcloud instance ssh ... to connect with your instance.
  • Edit /etc/redis/redis.config.
  • Add requirepass "<YOUR REDIS PASSWORD>".
  1. Image Magick

  2. What dependencies does it have (where are they expressed) and how do I install them?

  3. Can I see the project working before I change anything?

  4. How we set up Redis:

  • Use one click install to get us 3 redis instances (master - 2 slaves).
  • For each instance, set it to restart automatically.
  • get the Internal & External IP address for the Master.
  • Add a backup cron job to backup the db every 15 minutes.
  • (Optional) Add firewall entries to all me to access from my development system.
  • Add IP's to app config files.

Testing

How do I run the project's automated tests?

  • Unit Tests

  • Integration Tests

Deploying

How to set up the deployment environment
  • Add-ons, packages, or other dependencies required for deployment.
  • Required environment variables or credentials not included in git.
  • Monitoring services and logging.
How to deploy

Troubleshooting & useful tools

Examples of common tasks

e.g.

  • How to make curl requests while authenticated via oauth.
  • How to monitor background jobs.
  • How to run the app through a proxy.
Suggested Reading

Contributing changes

Licensing

Directories

Path Synopsis
Package abelana is a set of utilities to validate our GitKit and Access Tokens.
Package abelana is a set of utilities to validate our GitKit and Access Tokens.
Godeps/_workspace/src/code.google.com/p/go.net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi
Package googleapi contains the common code shared by all Google API libraries.
Package googleapi contains the common code shared by all Google API libraries.
Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/transport
Package transport contains HTTP transports used to make authenticated API requests.
Package transport contains HTTP transports used to make authenticated API requests.
Godeps/_workspace/src/code.google.com/p/google-api-go-client/oauth2/v2
Package oauth2 provides access to the Google OAuth2 API.
Package oauth2 provides access to the Google OAuth2 API.
Godeps/_workspace/src/code.google.com/p/google-api-go-client/pubsub/v1beta1
Package pubsub provides access to the Cloud Pub/Sub API.
Package pubsub provides access to the Cloud Pub/Sub API.
Godeps/_workspace/src/code.google.com/p/google-api-go-client/storage/v1
Package storage provides access to the Cloud Storage API.
Package storage provides access to the Cloud Storage API.
Godeps/_workspace/src/code.google.com/p/goprotobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
Godeps/_workspace/src/github.com/golang/oauth2
Package oauth2 provides support for making OAuth2 authorized and authenticated HTTP requests.
Package oauth2 provides support for making OAuth2 authorized and authenticated HTTP requests.
Godeps/_workspace/src/github.com/golang/oauth2/google
Package google provides support for making OAuth2 authorized and authenticated HTTP requests to Google APIs.
Package google provides support for making OAuth2 authorized and authenticated HTTP requests to Google APIs.
Godeps/_workspace/src/github.com/golang/oauth2/jws
Package jws provides encoding and decoding utilities for signed JWS messages.
Package jws provides encoding and decoding utilities for signed JWS messages.
Godeps/_workspace/src/google.golang.org/appengine
Package appengine provides basic functionality for Google App Engine.
Package appengine provides basic functionality for Google App Engine.
Godeps/_workspace/src/google.golang.org/appengine/channel
Package channel implements the server side of App Engine's Channel API.
Package channel implements the server side of App Engine's Channel API.
Godeps/_workspace/src/google.golang.org/appengine/datastore
Package datastore provides a client for App Engine's datastore service.
Package datastore provides a client for App Engine's datastore service.
Godeps/_workspace/src/google.golang.org/appengine/delay
Package delay provides a way to execute code outside the scope of a user request by using the taskqueue API.
Package delay provides a way to execute code outside the scope of a user request by using the taskqueue API.
Godeps/_workspace/src/google.golang.org/appengine/file
Package file provides helper functions for using Google Cloud Storage.
Package file provides helper functions for using Google Cloud Storage.
Godeps/_workspace/src/google.golang.org/appengine/image
Package image provides image services.
Package image provides image services.
Godeps/_workspace/src/google.golang.org/appengine/internal
Package internal provides support for package appengine.
Package internal provides support for package appengine.
Godeps/_workspace/src/google.golang.org/appengine/internal/aetesting
Package aetesting provides utilities for testing App Engine packages.
Package aetesting provides utilities for testing App Engine packages.
Godeps/_workspace/src/google.golang.org/appengine/internal/app_identity
Package app_identity is a generated protocol buffer package.
Package app_identity is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/base
Package base is a generated protocol buffer package.
Package base is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/channel
Package channel is a generated protocol buffer package.
Package channel is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/datastore
Package datastore is a generated protocol buffer package.
Package datastore is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/image
Package image is a generated protocol buffer package.
Package image is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/log
Package log is a generated protocol buffer package.
Package log is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/mail
Package mail is a generated protocol buffer package.
Package mail is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/memcache
Package memcache is a generated protocol buffer package.
Package memcache is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/modules
Package modules is a generated protocol buffer package.
Package modules is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/remote_api
Package remote_api is a generated protocol buffer package.
Package remote_api is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/search
Package search is a generated protocol buffer package.
Package search is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/taskqueue
Package taskqueue is a generated protocol buffer package.
Package taskqueue is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/urlfetch
Package urlfetch is a generated protocol buffer package.
Package urlfetch is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/user
Package user is a generated protocol buffer package.
Package user is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/internal/xmpp
Package xmpp is a generated protocol buffer package.
Package xmpp is a generated protocol buffer package.
Godeps/_workspace/src/google.golang.org/appengine/log
Package log provides the means of querying an application's logs from within an App Engine application.
Package log provides the means of querying an application's logs from within an App Engine application.
Godeps/_workspace/src/google.golang.org/appengine/mail
Package mail provides the means of sending email from an App Engine application.
Package mail provides the means of sending email from an App Engine application.
Godeps/_workspace/src/google.golang.org/appengine/memcache
Package memcache provides a client for App Engine's distributed in-memory key-value store for small chunks of arbitrary data.
Package memcache provides a client for App Engine's distributed in-memory key-value store for small chunks of arbitrary data.
Godeps/_workspace/src/google.golang.org/appengine/module
Package module provides functions for interacting with modules.
Package module provides functions for interacting with modules.
Godeps/_workspace/src/google.golang.org/appengine/remote_api
Package remote_api implements the /_ah/remote_api endpoint.
Package remote_api implements the /_ah/remote_api endpoint.
Godeps/_workspace/src/google.golang.org/appengine/search
Package search provides a client for App Engine's search service.
Package search provides a client for App Engine's search service.
Godeps/_workspace/src/google.golang.org/appengine/taskqueue
Package taskqueue provides a client for App Engine's taskqueue service.
Package taskqueue provides a client for App Engine's taskqueue service.
Godeps/_workspace/src/google.golang.org/appengine/urlfetch
Package urlfetch provides an http.RoundTripper implementation for fetching URLs via App Engine's urlfetch service.
Package urlfetch provides an http.RoundTripper implementation for fetching URLs via App Engine's urlfetch service.
Godeps/_workspace/src/google.golang.org/appengine/user
Package user provides a client for App Engine's user authentication service.
Package user provides a client for App Engine's user authentication service.
Godeps/_workspace/src/google.golang.org/appengine/xmpp
Package xmpp provides the means to send and receive instant messages to and from users of XMPP-compatible services.
Package xmpp provides the means to send and receive instant messages to and from users of XMPP-compatible services.
Godeps/_workspace/src/google.golang.org/cloud
Package cloud contains Google Cloud Platform APIs related types and common functions.
Package cloud contains Google Cloud Platform APIs related types and common functions.
Godeps/_workspace/src/google.golang.org/cloud/compute/metadata
Package metadata provides access to Google Compute Engine (GCE) metadata and API service accounts.
Package metadata provides access to Google Compute Engine (GCE) metadata and API service accounts.
Godeps/_workspace/src/google.golang.org/cloud/internal
Package internal provides support for the cloud packages.
Package internal provides support for the cloud packages.
Godeps/_workspace/src/google.golang.org/cloud/pubsub
Package pubsub is a Google Cloud Pub/Sub client.
Package pubsub is a Google Cloud Pub/Sub client.
Godeps/_workspace/src/google.golang.org/cloud/storage
Package storage is a Google Cloud Storage client.
Package storage is a Google Cloud Storage client.
third_party

Jump to

Keyboard shortcuts

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