Skip to content

Files

Latest commit

9a502f5 · May 14, 2025

History

History

gcp-cloud-run

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 14, 2025
May 14, 2025

README.md

GCP Cloud Run example app

Running the Example App

  1. Download the Google Cloud CLI.

  2. Create or select a Google Cloud Project. Make sure that project has billing enabled (for New Relic employees, reach out to ask-it on Slack). Continue setting up your project by following the Before you begin section of this setup guide.

    1. The app is already created in the helloworld directory, so you can skip the "Write the sample service" section.
  3. Set up your environment and YAML files.

    cd helloworld
    cp env.sample .env
    # Fill out New Relic license key
    # from ./helloworld
    cp skaffold_example.yaml skaffold.yaml
    # replace GCP_REGION with your region e.g. 'us-east1'
    # replace GCP_PROJECT_ID with your project id
    
    cd resources
    cp service_example.yaml service.yaml
    # replace GCP_REGION with your region
    # replace GCP_PROJECT_ID with your project id
  4. Deploy to Cloud Run from source.

    # from ./helloworld
    gcloud run deploy --source .
  5. Once you have deployed the app succesfully to GCR, you should be given a service URL.

    Service URL: https://helloworld-{project-id}.{region}.run.app
  6. Generate traffic on the app and then view the results in NR One.

    for run in {1..10}; do curl https://helloworld-{project-id}.{region}.run.app; done

Debugging the Example App

  1. Install skaffold. It should come with the Google Cloud CLI, but double check with:

    gcloud components update
    gcloud components install skaffold
  2. Fill out environment and YAML variables if you haven't already (see step #3 above).

  3. Deploy the app to Google Cloud with skaffold.

    # from ./helloworld
    skaffold dev --port-forward
  4. Generate traffic.

    for run in {1..10}; do curl http://localhost:8080; done