Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge samples for Flex and Std #590

Merged

Conversation

michaelawyu
Copy link
Contributor

No description provided.

@michaelawyu michaelawyu requested a review from ace-n March 30, 2018 08:41

With `npm`:
gcloud app deploy app.standard.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - these indentations are different.

@@ -10,16 +10,14 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
"node": ">=4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmdobry @lukesneeringer Which versions of Node do we support? AFAIK, this is too restrictive (at least for Flex).

@michaelawyu if you make any changes as a result of this comment, please apply those changes to any other package.json files that have this issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node 4+, until April 30 when Node 4 reaches end of life and we can switch our samples to support Node 6+

"start": "node app.js",
"lint": "repo-tools lint",
"pretest": "npm run lint",
"system-test": "repo-tools test app",
"test": "npm run system-test",
"e2e-test": "repo-tools test deploy"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed? (Perhaps because npm run deploy no longer works?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's removed because npm run deploy no longer works.

"private": true,
"main": "server.js",
"scripts": {
"lint": "samples lint",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In README.md, you specify start and deploy scripts. Make sure to add those (and their respective commands) here, or remove them from your README.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

test.beforeEach(utils.stubConsole);
test.afterEach.always(utils.restoreConsole);

test.cb.serial(`should send greetings`, (t) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmdobry what are your thoughts on using repo-tools instead of this test file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can still do the same tests while deleting code, let's do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests for building-an-app/build/ are now done by repo-tools.

const app = express();
app.enable('trust proxy');

const METADATA_NETWORK_INTERFACE_URL = 'http://metadata/computeMetadata/v1/' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: combine this into one string (and ignore line length limits, or split onto multiple lines using backticks)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

return request(METADATA_NETWORK_INTERFACE_URL, options)
.then((response) => response.body)
.catch((err) => {
if (err || err.statusCode !== 200) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean && instead of ||?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

app.

You can also read the [node_redis documentation][3].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo (missing an i): addit-i-onally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)


# [START env_variables]
env_variables:
SENDGRID_API_KEY: <your-sendgrid-api-key>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto to "do not commit this file" comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

@@ -0,0 +1,40 @@
# Node.js Google Cloud Storage sample for Google App Engine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be split into separate standard and flexible samples?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is split as App Engine Node.js Std does not support the resumable upload feature in Cloud Storage client library. Should we use the sample w/ resumable upload disabled for both std and flex?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frankyn WDYT?

@codecov
Copy link

codecov bot commented Apr 2, 2018

Codecov Report

Merging #590 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #590   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines           3      3           
=====================================
  Hits            3      3

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update daf141d...2fd9d85. Read the comment docs.

@michaelawyu
Copy link
Contributor Author

@lesv

Copy link
Contributor

@ace-n ace-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once you switch the appropriate tests to using @google-cloud/repo-tools. (Ping @jmdobry or myself if you want us to give you an intro on that library.)

@@ -1,15 +1,17 @@
# Cloud SQL for MySQL Node.js sample on App Engine flexible environment
# Cloud SQL for PostgresSQL Node.js sample on App Engine flexible environment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: IIRC, it's PostgreSQL (extra S).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me and my fat fingers :( It's been fixed

@lesv
Copy link
Contributor

lesv commented Apr 9, 2018

@michaelawyu I see places where you use app.flexible.yaml and other places where you use /flexible/app.yaml -- perhaps we should be consistent?

@michaelawyu
Copy link
Contributor Author

Hi @lesv ! It is intended actually: samples that share the same code between Flex and Std are merged together and have two .YAML files; samples that use different code for different environments are kept separate and have one .YAML file in each folder; getting-started samples are always kept separate so that beginners can use gcloud app deploy to deploy the sample without knowing the differences between Flex and Std.

@lesv
Copy link
Contributor

lesv commented Apr 10, 2018

SGTM

@RichieEscarez
Copy link

General comment:

When referring to an "environment" of App Engine, it should be lowercase, either:

  • "App Engine standard environment"
  • "standard environment"
  • "App Engine flexible environment"
  • "flexible environment"

(with the exceptions of either a title or the start of a sentence, in which case you should capitalize the first letter).

@@ -16,7 +18,8 @@ Before you can run or deploy the sample, you will need to do the following:
1. [Create a SendGrid Account](http://sendgrid.com/partner/google). As of
September 2015, Google users start with 25,000 free emails per month.
1. Configure your SendGrid settings in the environment variables section in
`app.yaml`.
`app.standard.yaml` (if you are deploying to App Engine Standard Environment) or

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline code comment in the /sendgrid/app.js file refers to "app.yaml" which could be confusing now that we have these two environment specific files, which are named differently.

To assist with learning this concept of "uniquely-named, service-specific app.yaml files", perhaps add to the "app.js" file:
(for example, app.standard.yaml or app.flexible.yaml)

-> therefore you instead have:

"....variables are set by app.yaml (for example, app.standard.yaml or app.flexible.yaml) when running on ......"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

@ace-n
Copy link
Contributor

ace-n commented Apr 11, 2018

LGTM - @michaelawyu feel free to merge once @RichieEscarez (and maybe @lesv) also approve(s).

@lesv
Copy link
Contributor

lesv commented Apr 11, 2018

I just had a nit.

@lesv
Copy link
Contributor

lesv commented Apr 11, 2018

So LGTM from me.

NimJay pushed a commit that referenced this pull request Nov 19, 2022
* chore(main): release 4.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
NimJay pushed a commit that referenced this pull request Nov 19, 2022
* chore(main): release 4.0.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants