Skip to content

Instantly share code, notes, and snippets.

@amygdala
amygdala / gcp-next-data.md
Created March 28, 2016 16:11 — forked from juliaferraioli/gcp-next-data.md
Test and training image attribution

Before the workshop: Google Cloud Platform setup

Set up a Google Cloud Platform account, and install the Cloud Platform's gcloud SDK, before the workshop starts.

Create a Google Cloud Platform account

If you do not already have a Google Cloud Platform project, go to https://cloud.google.com/ and click the "Free Trial" button.

kind: Service
apiVersion: v1beta1
id: frontend
# the port that this service should serve on
port: 3000
# just like the selector in the replication controller,
# but this time it identifies the set of pods to load balance
# traffic to.
selector:
name: frontend
kind: Service
apiVersion: v1beta1
id: mysql
# the port that this service should serve on
port: 3306
# just like the selector in the replication controller,
# but this time it identifies the set of pods to load balance
# traffic to.
selector:
name: mysql
apiVersion: v1beta1
id: wordpress
desiredState:
manifest:
version: v1beta1
id: frontendController
containers:
- name: wordpress
image: wordpress
ports:
apiVersion: v1beta1
id: mysql
desiredState:
manifest:
version: v1beta1
id: mysql
containers:
- name: mysql
image: mysql
env:
<?php
// Example code for connecting to the Google Cloud Datastore
require_once 'config.php';
require_once 'DatastoreService.php';
require_once 'Google/Client.php';
require_once 'Google/Auth/AssertionCredentials.php';
require_once 'Google/Service/Datastore.php';
@amygdala
amygdala / datastore_connect.php
Last active December 31, 2015 23:59
Part of an example of connecting to the Google Cloud Datastore from a PHP app.
<?php
// Example code for connecting to the Google Cloud Datastore
require_once 'config.php';
require_once 'Google/Client.php';
require_once 'Google/Auth/AssertionCredentials.php';
require_once 'Google/Service/Datastore.php';
// assumes that an array like the following is defined in config.php
<?php
require_once 'Model.php';
/**
* Model class for User objects
*/
class UserModel extends Model {
const USER_MODEL_KIND = 'User';
const USER_EMAIL_PROPERTY_NAME = 'email';
<?php
require_once 'Model.php';
/**
* Model class for feed objects
*/
class FeedModel extends Model {
const FEED_MODEL_KIND = 'FeedModel';