Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Memorystore: Add Dockerfile for Cloud Run deployment #4191

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 9 commits into from Aug 5, 2020
Merged

Memorystore: Add Dockerfile for Cloud Run deployment #4191

merged 9 commits into from Aug 5, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jun 26, 2020

I'm working on a tutorial for connecting to Memorystore from Cloud Run via Serverless VPC Access. The existing sample app still works, we just need a Dockerfile to deploy it. Also adding a .gcloudignore.

@ghost ghost self-requested a review as a code owner June 26, 2020 23:44
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 26, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Jun 29, 2020

FYI, you can write an end 2 end test with Cloud Run (example).

@ghost
Copy link
Author

ghost commented Jul 14, 2020

Added an e2e test for Cloud Run, let me know what you think

@tmatsuo
Copy link
Contributor

tmatsuo commented Jul 16, 2020

@ericschmidtatwork FYI I think if you join the googlecloudplatform org, the test will automatically run.

@tmatsuo tmatsuo added the kokoro:run Add this label to force Kokoro to re-run the tests. label Jul 16, 2020
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Jul 16, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Jul 16, 2020

The test failed locally with the following:

ERROR: (gcloud.redis.instances.create) INVALID_ARGUMENT: Invalid authorized network 'default'. Legacy networks are not supported.
com.google.apps.framework.request.StatusException: <eye3 title='INVALID_ARGUMENT'/> generic::INVALID_ARGUMENT: Invalid authorized network 'default'. Legacy networks are not supported.
- '@type': type.googleapis.com/google.rpc.BadRequest
  fieldViolations:
  - description: 'Invalid value: projects/python-docs-samples-tests/global/networks/default'
    field: instance.authorized_network

@ghost
Copy link
Author

ghost commented Jul 16, 2020

It looks like the default network in python-docs-samples-tests is a legacy network. I'll have the test create a separate VPC network for the resources.

@tmatsuo tmatsuo added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 3, 2020
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 3, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 3, 2020

The test failed with:

ERROR: (gcloud.compute.networks.vpc-access.connectors.create) PERMISSION_DENIED: Serverless VPC Access API has not been used in project 1012616486416 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/vpcaccess.googleapis.com/overview?project=1012616486416 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

I enabled the API.

@tmatsuo tmatsuo added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. and removed kokoro:run Add this label to force Kokoro to re-run the tests. labels Aug 3, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 3, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 3, 2020

It failed with:

ERROR: (gcloud.run.deploy) unrecognized arguments:
  --vpc-connector (did you mean '--connectivity'?)
  test-connector-4bdcd03ccf
  To search the help text of gcloud commands, run:
  gcloud help -- SEARCH_TERMS
------- generated xml file: /workspace/memorystore/redis/sponge_log.xml --------

@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 4, 2020

Do you need a specific version of gcloud sdk? If so you may need to update the version number here.

@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 4, 2020

@ericschmidtatwork

If you edit the Dockerfile, the presubmit will run full builds (not this sample, it will run all the tests).
So maybe you should test it locally before adding commits to this PR.

To run the test locally, you can:

$ cd python-docs-samples
$ cp testing/test-env.tmpl.sh testing/test-env.sh  # and edit `GCLOUD_PROJECT`
$ cp /some/where/your-service-account-json.key testing/service-account.json
$ scripts/run_tests_local.sh memorystore/redis py-3.8

This will run the test from building the Docker image, so you can test the changes in Dockerfile too.

@ghost
Copy link
Author

ghost commented Aug 4, 2020

@tmatsuo Thanks for the guidance. Is there any reason I shouldn't just update gcloud to the latest version? This test needs at least 299.0.0

@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 4, 2020

@ericschmidtatwork Yeah, updating gcloud SDK to the latest sounds fine.

@ghost
Copy link
Author

ghost commented Aug 5, 2020

Updated gcloud SDK in the Dockerfile to 304.0.0, and the test is passing locally.

@tmatsuo tmatsuo added the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 5, 2020
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Aug 5, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 5, 2020

Python 3.8 build passed and the log contains:

cloud_run_deployment/e2e_test.py::test_end_to_end PASSED

The failures in py-3.6 and py-3.7 builds are flakes and I don't think it's relevant to the Dockerfile change. Merging this now.

@tmatsuo tmatsuo merged commit 8415454 into GoogleCloudPlatform:master Aug 5, 2020
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.

4 participants