Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions appengine/flexible/analytics/app.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
runtime: php
env: flex
vm: true

runtime_config:
document_root: web
document_root: web
34 changes: 0 additions & 34 deletions appengine/flexible/analytics/tests/DeployTest.php

This file was deleted.

2 changes: 1 addition & 1 deletion appengine/flexible/analytics/tests/LocalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Google\Cloud\Samples\AppEngine\Analytics;
namespace Google\Cloud\Test;

use Silex\WebTestCase;

Expand Down
65 changes: 21 additions & 44 deletions appengine/flexible/cloudsql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,43 @@ composer install

Before you can run or deploy the sample, you will need to do the following:

1. Create a [Second Generation Cloud SQL](https://cloud.google.com/sql/docs/create-instance) instance. You can do this from the [Cloud Console](https://console.developers.google.com) or via the [Cloud SDK](https://cloud.google.com/sdk). To create it via the SDK use the following command:
1. Create a [First Generation Cloud SQL](https://cloud.google.com/sql/docs/create-instance) instance. You can do this from the [Cloud Console](https://console.developers.google.com) or via the [Cloud SDK](https://cloud.google.com/sdk). To create it via the SDK use the following command:

$ gcloud beta sql instances create YOUR_INSTANCE_NAME --tier=db-f1-micro --activation-policy=ALWAYS
$ gcloud sql instances create YOUR_INSTANCE_NAME

> Note: the `--tier` option is required to create a `Second Generation` instance. See the
full list of available tiers by running `gcloud sql tiers list`

2. Set the root password on your Cloud SQL instance:
1. Set the root password on your Cloud SQL instance:

$ gcloud sql instances set-root-password YOUR_INSTANCE_NAME --password YOUR_INSTANCE_ROOT_PASSWORD

3. Install and run the [CloudSQL Proxy](https://cloud.google.com/sql/docs/mysql-connect-proxy)
1. Update the connection string in `app.yaml` with your configuration values. These values are used when the application is deployed.

4. Create a database for this example
## Run locally

$ mysql -h 127.0.0.1 -u root -p -e "CREATE DATABASE <YOUR_DATABASE_NAME>;"
To run locally, you can either run your own MySQL server locally and set the connection string in `app.yaml`, or you can [connect to your CloudSQL instance externally](https://cloud.google.com/sql/docs/external#appaccess).

```sh
cd php-docs-samples/appengine/standard/cloudsql

## Deploy to App Engine
# set local mysql connection parameters
export MYSQL_DSN="mysql:host=127.0.0.1;port=3306;dbname=guestbook"
export MYSQL_USERNAME=root
export MYSQL_PASSWORD=

**Prerequisites**
php -S localhost:8080
```

- Install the [Google Cloud SDK](https://developers.google.com/cloud/sdk/).
> be sure the `MYSQL_` environment variables are appropriate for your mysql instance

**Deploy with gcloud**
Now you can view the app running at [http://localhost:8080](http://localhost:8080)
in your browser.

1. Update `app.yaml` with the configuration values for `USER`, `PASSWORD`, and
`DATABASE` with the values you used during setup.
## Deploy to App Engine

1. Get the CloudSQL connection name
**Prerequisites**

$ gcloud beta sql instances describe YOUR_INSTANCE_NAME | grep connectionName
- Install the [Google Cloud SDK](https://developers.google.com/cloud/sdk/).

1. Update `app.yaml` with the configuration value for `CONNECTION_NAME` you retrieved
at the end up setup.
**Deploy with gcloud**

```
gcloud config set project YOUR_PROJECT_ID
Expand All @@ -63,28 +65,3 @@ gcloud app browse

The last command will open `https://{YOUR_PROJECT_ID}.appspot.com/`
in your browser.

## Run locally

1. Ensure the [CloudSQL Proxy](https://cloud.google.com/sql/docs/external#proxy) is
installed and running.

1. Set the following environment variables with the configuration values for
`USER`, `PASSWORD`, and `DATABASE` you used during setup:

```sh
# set local mysql connection parameters
export MYSQL_DSN="mysql:host=127.0.0.1;port=3306;dbname=DATABASE"
export MYSQL_USERNAME=USER
export MYSQL_PASSWORD=PASSWORD
```

1. Run the application

```sh
cd php-docs-samples/appengine/standard/cloudsql
php -S localhost:8080
```

Now you can view the app running at [http://localhost:8080](http://localhost:8080)
in your browser.
18 changes: 3 additions & 15 deletions appengine/flexible/cloudsql/app.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
runtime: php
env: flex
vm: true

#[START env]
env_variables:
# Replace USER, PASSWORD, DATABASE, and CONNECTION_NAME with the
# values obtained when configuring your Cloud SQL instance.
MYSQL_DSN: mysql:dbname=DATABASE;unix_socket=/cloudsql/CONNECTION_NAME
MYSQL_USER: USER
MYSQL_PASSWORD: PASSWORD
#[END env]

#[START cloudsql_settings]
# Use the connection name obtained when configuring your Cloud SQL instance.
beta_settings:
cloud_sql_instances: "CONNECTION_NAME"
#[END cloudsql_settings]
runtime_config:
document_root: web
1 change: 0 additions & 1 deletion appengine/flexible/cloudsql/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
},
"require-dev": {
"google/cloud-tools": "<=1.0",
"paragonie/random_compat": "^2.0",
"phpunit/phpunit": "~4"
}
}
Loading