8000 Copy Endpoints Python Echo sample to a new location. by kdeus · Pull Request #631 · GoogleCloudPlatform/python-docs-samples · GitHub
[go: up one dir, main page]

Skip to content
Dismiss alert

Copy Endpoints Python Echo sample to a new location. #631

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

Merged
merged 10 commits into from
Nov 3, 2016

Conversation

kdeus
Copy link
Contributor
@kdeus kdeus commented Nov 2, 2016

This will be its new home, once we clean up the docs.

This sample is used for multiple platforms, and hiding it under appengine/flex is confusing.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 2, 2016
@@ -0,0 +1,12 @@
FROM debian:jessie
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use gcr.io/google_appengine/python - it's designed to work on GKE as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out we don't actually need this Dockerfile. Removed, in a following commit.

@theacodes
Copy link
Contributor

Why remove the dockerfile? Isn't that needed?

@kdeus
Copy link
Contributor Author
kdeus commented Nov 2, 2016

Turns out this isn't needed by any of our current samples. It'd only be
needed if we were showing users how to build this example code into a new
docker container. Currently, all our samples use pre-built docker
containers.

I'm double checking that with our team, to make sure no upcoming changes
require it. As is, though, it's unused.

On Wed, Nov 2, 2016 at 3:26 PM, Jon Wayne Parrott notifications@github.com
wrote:

Why remove the dockerfile? Isn't that needed?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#631 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEDUYzamtappprGNDmFB3_AND5o4XbVDks5q6Q4mgaJpZM4KnmUp
.

@theacodes
Copy link
Contributor

@kdeus would you not want to tell users how to create their own docker image?

@kdeus
Copy link
Contributor Author
kdeus commented Nov 2, 2016

Yes, we'll want to do that. But it sounds like we're going to use a
different set of sample code to do that, not this one.

On Wed, Nov 2, 2016 at 3:40 PM, Jon Wayne Parrott notifications@github.com
wrote:

@kdeus https://github.com/kdeus would you not want to tell users how to
create their own docker image?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#631 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEDUYw5hMvJj3Itqf9IcKWuVC5CDlmQ2ks5q6RFAgaJpZM4KnmUp
.

@theacodes
Copy link
Contributor

It seems weird to have that separate from the source code that'll live in the container, no?

@kdeus
Copy link
Contributor Author
kdeus commented Nov 2, 2016

We won't be using this source code to build a docker image. We'll use a
completely different example.

On Wed, Nov 2, 2016 at 3:42 PM, Jon Wayne Parrott notifications@github.com
wrote:

It seems weird to have that separate from the source code that'll live in
the container, no?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#631 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEDUY2eHEBKNe-WM0qR-MFZn7SwYeLw2ks5q6RHcgaJpZM4KnmUp
.

@theacodes
Copy link
Contributor

Then what's the point of having any GKE stuff here?

On Wed, Nov 2, 2016, 3:45 PM kdeus notifications@github.com wrote:

We won't be using this source code to build a docker image. We'll use a
completely different example.

On Wed, Nov 2, 2016 at 3:42 PM, Jon Wayne Parrott <
notifications@github.com>
wrote:

It seems weird to have that separate from the source code that'll live in
the container, no?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
#631 (comment)
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/AEDUY2eHEBKNe-WM0qR-MFZn7SwYeLw2ks5q6RHcgaJpZM4KnmUp

.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#631 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUc7_BQnHONZ5XWgYXZbBYJDxgh9o3ks5q6RKQgaJpZM4KnmUp
.

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
Copy link

Choose a reason for hiding this comment

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

Dunno what happened here but this URL is borked.

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

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
Copy link

Choose a reason for hiding this comment

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

Here too.

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

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
Copy link

Choose a reason for hiding this comment

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

And here.

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

Copy link
Contributor Author
@kdeus kdeus left a comment

Choose a reason for hiding this comment

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

The GKE stuff is used by examples showing how Google Cloud Endpoints works for different environments (GKE, GCE + Docker). It's similar to why app.yaml is there: to show how this works for GAE.

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
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

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
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

< 6D40 svg aria-label="Loading..." style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" role="img" data-view-component="true" class="anim-rotate">

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
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

@theacodes
Copy link
Contributor

My point is that why have that stuff here if it does not pertain to this
specific sample? What's the relevance to this sample if the GKE config
doesn't use this sample code and there's no obvious way to build the GKE
sample's image using this code?

On Wed, Nov 2, 2016, 4:59 PM kdeus notifications@github.com wrote:

@kdeus commented on this pull request.

The GKE stuff is used by examples showing how Google Cloud Endpoints works
for different environments (GKE, GCE + Docker). It's similar to why

app.yaml is there: to show how this works for GAE.

In endpoints/echo/clients/service_to_service_gae_default/main.py
#631 (review)
:

@@ -0,0 +1,83 @@
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0(the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http: // www.apache.org/licenses/LICENSE-2.0

Fixed

In endpoints/echo/clients/service_to_service_google_id_token/main.py
#631 (review)
:

@@ -0,0 +1,98 @@
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0(the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http: // www.apache.org/licenses/LICENSE-2.0

Done

In endpoints/echo/clients/service_to_service_non_default/main.py
#631 (review)
:

@@ -0,0 +1,94 @@
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0(the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http: // www.apache.org/licenses/LICENSE-2.0

Done


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#631 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUczvPFu7Lgx1T8HScNc69otZ2gRrYks5q6SPLgaJpZM4KnmUp
.

@kdeus
Copy link
Contributor Author
kdeus commented Nov 3, 2016

We've been debating that. :)

The intent here is that if someone comes in wanting to know how to use
Google Cloud Endpoints for a specific language, they can look at a
language-specific example and see the various pieces of how it works. The
Quickstarts will reference different pieces of this example to get the user
up and running quickly, so they can see what happens when you send traffic
to an Endpoints backend, but they aren't intended to be in-depth tutorials
showing how this would work in your own APIs. In some environments, the
server runs this sample code (GCE, GAE); in others, it uses the pre-built
Docker images (GKE, GCE + Docker).

There will be more in-depth tutorials that include steps such as building a
docker image, but those are still being written. It's possible the
Dockerfile will come back, if we choose to base one of those tutorials on
this Echo example. But for the moment, this is only referenced by the
Quickstarts, and none of the Quickstarts show how to go from source code to
a deployed Docker image.

This PR isn't really changing anything about the content of the sample.
It's just copying files from /appengine/flex/endpoints to
/endpoints/getting-started. And removing the unused Dockerfile, copying
gke.yaml from the endpoints-sample repository, and doing a little clean-up.

On Wed, Nov 2, 2016 at 5:03 PM, Jon Wayne Parrott notifications@github.com
wrote:

My point is that why have that stuff here if it does not pertain to this
specific sample? What's the relevance to this sample if the GKE config
doesn't use this sample code and there's no obvious way to build the GKE
sample's image using this code?

On Wed, Nov 2, 2016, 4:59 PM kdeus notifications@github.com wrote:

@kdeus commented on this pull request.

The GKE stuff is used by examples showing how Google Cloud Endpoints works
for different environments (GKE, GCE + Docker). It's similar to why

app.yaml is there: to show how this works for GAE.

In endpoints/echo/clients/service_to_service_gae_default/main.py
<#631
pullrequestreview-6933885>
:

@@ -0,0 +1,83 @@
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0(the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http: // www.apache.org/licenses/LICENSE-2.0

Fixed

In endpoints/echo/clients/service_to_service_google_id_token/main.py
<#631
pullrequestreview-6933885>
:

@@ -0,0 +1,98 @@
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0(the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http: // www.apache.org/licenses/LICENSE-2.0

Done

In endpoints/echo/clients/service_to_service_non_default/main.py
<#631
pullrequestreview-6933885>
:

@@ -0,0 +1,94 @@
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0(the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http: // www.apache.org/licenses/LICENSE-2.0

Done


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
<#631
pullrequestreview-6933885>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AAPUczvPFu7Lgx1T8HScNc69otZ2gRrYks5q6SPLgaJpZM4KnmUp>

.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#631 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEDUY-12QAd8irseDPGbTmldoJ5uH2jiks5q6STCgaJpZM4KnmUp
.

@theacodes
Copy link
Contributor

So my question is this: What's the point of duplicating the gke.yaml config from the endpoints-samples repository here if this source code is not used for that sample? In fact, no source code is used for that sample.

In my opinion adding the gke.yaml here made this previously standalone, app engine-specific sample confusing. The readme is very focused on deploying this to app engine.

Why can't we just leave the gke.yaml where it is in endpoint-samples? Why can't we augment the readme here and say "If you want to use GKE, check out the example config [here] and [here's] instructions on building a docker container.".

/cc @jeffmendoza

@jeffmendoza
Copy link
Contributor

Agree with Jon here.

We need the Dockerfile, even if the quickstart does not document how to build the code into a docker container.

Also, the gke and gce+docker quickstarts should use the docker image built from the code in this repo. Same for all the languages.

Copy link
Contributor
@jeffmendoza jeffmendoza left a comment

Choose a reason for hiding this comment

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

Needs Dockerfile

name: nginx-ssl
readOnly: true
- name: echo
image: b.gcr.io/endpoints/echo:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to point to an image of this code.

Copy link
Contributor

Choose a reason for hiding this comment

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

built and pushed gcr.io/google-samples/echo-python:1.0

@kdeus
Copy link
Contributor Author
kdeus commented Nov 3, 2016

The Dockerfile is back (as Dockerfile.custom).
Jeff will build a new language-specific image based on this code. Jeff, let me know what gke.yaml should point to, for the language-specific image.

Also, I've partially stripped the Readme, removing references to GAE and anything that's duplicated in our Quickstarts. We don't yet have a tutorial describing how to use the client libraries in this sample, so I'm leaving that information in until we create those tutorials.

@kdeus
Copy link
Contributor Author
kdeus commented Nov 3, 2016

Updated gke.yaml to point to the new image.

On Thu, Nov 3, 2016 at 10:43 AM, Jeff Mendoza notifications@github.com
wrote:

@jeffmendoza commented on this pull request.

In endpoints/getting-started/gke.yaml
#631:

  •    args: [
    
  •      "-p", "8080",
    
  •      "-S", "443",
    
  •      "-a", "127.0.0.1:8081",
    
  •      "-s", "SERVICE_NAME",
    
  •      "-v", "SERVICE_VERSION",
    
  •    ]
    
  •    ports:
    
  •      - containerPort: 8080
    
  •      - containerPort: 443
    
  •    volumeMounts:
    
  •    - mountPath: /etc/nginx/ssl
    
  •      name: nginx-ssl
    
  •      readOnly: true
    
  •  - name: echo
    
  •    image: b.gcr.io/endpoints/echo:latest
    

built and pushed gcr.io/google-samples/echo-python:1.0


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#631, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AEDUY96K7yJ3SLhzbymKr95pMC-aPw5hks5q6h1XgaJpZM4KnmUp
.

@theacodes
Copy link
Contributor

Please use container-engine.yaml, abbreviations aren't as fun to
newcomers. :)

On Thu, Nov 3, 2016 at 10:47 AM kdeus notifications@github.com wrote:

Updated gke.yaml to point to the new image.

On Thu, Nov 3, 2016 at 10:43 AM, Jeff Mendoza notifications@github.com
wrote:

@jeffmendoza commented on this pull request.

In endpoints/getting-started/gke.yaml
#631:

  • args: [
  • "-p", "8080",
  • "-S", "443",
  • "-a", "127.0.0.1:8081",
  • "-s", "SERVICE_NAME",
  • "-v", "SERVICE_VERSION",
  • ]
  • ports:
  • - containerPort: 8080
  • - containerPort: 443
  • volumeMounts:
  • - mountPath: /etc/nginx/ssl
  • name: nginx-ssl
  • readOnly: true
  • - name: echo
  • image: b.gcr.io/endpoints/echo:latest

built and pushed gcr.io/google-samples/echo-python:1.0


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#631,
or mute
the thread
<
https://github.com/notifications/unsubscribe-auth/AEDUY96K7yJ3SLhzbymKr95pMC-aPw5hks5q6h1XgaJpZM4KnmUp

.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#631 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUcw__3SNq1LZojb_53HXVU7BEFrFLks5q6h40gaJpZM4KnmUp
.

@kdeus
Copy link
Contributor Author
kdeus commented Nov 3, 2016

Renamed to container-engine.yaml.

On Thu, Nov 3, 2016 at 10:48 AM, Jon Wayne Parrott <notifications@github.com

wrote:

Please use container-engine.yaml, abbreviations aren't as fun to
newcomers. :)

On Thu, Nov 3, 2016 at 10:47 AM kdeus notifications@github.com wrote:

Updated gke.yaml to point to the new image.

On Thu, Nov 3, 2016 at 10:43 AM, Jeff Mendoza notifications@github.com
wrote:

@jeffmendoza commented on this pull request.

In endpoints/getting-started/gke.yaml
#631:

  • args: [
  • "-p", "8080",
  • "-S", "443",
  • "-a", "127.0.0.1:8081",
  • "-s", "SERVICE_NAME",
  • "-v", "SERVICE_VERSION",
  • ]
  • ports:
  • - containerPort: 8080
  • - containerPort: 443
  • volumeMounts:
  • - mountPath: /etc/nginx/ssl
  • name: nginx-ssl
  • readOnly: true
  • - name: echo
  • image: b.gcr.io/endpoints/echo:latest

built and pushed gcr.io/google-samples/echo-python:1.0


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#631,
or mute
the thread
<
https://github.com/notifications/unsubscribe-auth/
AEDUY96K7yJ3SLhzbymKr95pMC-aPw5hks5q6h1XgaJpZM4KnmUp

.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
<#631
issuecomment-258220310>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAPUcw__3SNq1LZojb_
53HXVU7BEFrFLks5q6h40gaJpZM4KnmUp>
.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#631 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEDUYzoQmUsheVYxDQuZ49NKedG-gMxYks5q6h5wgaJpZM4KnmUp
.

@theacodes theacodes merged commit 920eb69 into GoogleCloudPlatform:master Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0