---
title: Install the Ruby agent in GAE flexible environment
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/installation/install-new-relic-ruby-agent-gae-flexible-environment
---

Install the New Relic Ruby agent in a [Google App Engine (GAE) flexible environment](https://cloud.google.com/appengine/docs/flexible/ruby/) using either GAE's native mode or a custom Docker runtime.

## Prerequisites [#prerequisites]

| Requirement              | Details                                                                                                                                                                                                           |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **New Relic account**    | You need a [New Relic account](https://newrelic.com/signup) and your license key.                                                                                                                                 |
| **Google Cloud project** | A Google Cloud Platform project with an App Engine application created. See [Google App Engine procedures for Ruby](https://cloud.google.com/appengine/docs/flexible/ruby/managing-projects-apps-billing#create). |
| **Google Cloud SDK**     | The `gcloud` CLI installed and initialized. See [Google Cloud SDK docs](https://cloud.google.com/sdk/docs/).                                                                                                      |
| **Ruby version**         | See [Ruby agent requirements and supported frameworks](https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks) for supported versions.                 |

## Install the gem and configure your app [#install]

Add the `newrelic_rpm` gem to your `Gemfile`:

````ruby
gem 'newrelic_rpm'
```

Then run:

```sh
bundle install
```

<Tabs>
  <TabsBar>
    <TabsBarItem id="native-mode">Native mode (Rails or Sinatra)</TabsBarItem>
    <TabsBarItem id="docker-runtime">Custom Docker runtime</TabsBarItem>
  </TabsBar>
  <TabsPages>
    <TabsPageItem id="native-mode">
      When using GAE native mode, you provide your app code and an `app.yaml`. GAE deploys to a standard prebuilt Docker image automatically. No additional Dockerfile is needed.
    </TabsPageItem>
    <TabsPageItem id="docker-runtime">
      If your app needs specific libraries or headers, use a custom runtime. Create a `Dockerfile` and set `app.yaml` to:

      ```yaml
      runtime: custom
      env: flex
      ```

      New Relic recommends the custom runtime method. It also recommends that you allow Google App Engine to handle health checks.
    </TabsPageItem>
  </TabsPages>
</Tabs>

````

## Configure the agent [#configure]

Download [`newrelic.yml`](https://github.com/newrelic/newrelic-ruby-agent/blob/dev/newrelic.yml) from the New Relic GitHub repository and copy it into the `config` directory of your application.

Set the two required values:

1.  Set `license_key` to your license key.
2.  Set `app_name` to a meaningful name for your application.

    For all other configuration options, see [Ruby agent configuration](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration).

## Deploy and verify [#verify]

Deploy your app using the `gcloud` CLI:

````bash
gcloud app deploy
```

Wait until the deployment completes. Send at least two requests, then wait 2–3 minutes and open [one.newrelic.com > APM](https://one.newrelic.com/apm) to look for your app by name.

<Callout variant="tip">
  App not appearing? See [No data appears (Ruby)](/docs/apm/agents/ruby-agent/troubleshooting/no-data-appears-ruby).
</Callout>

````

## Related articles [#related-docs]

-   [Ruby agent requirements and supported frameworks](https://docs.newrelic.com/docs/apm/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks) — Supported Ruby versions.
-   [Ruby agent configuration](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration) — All available configuration settings.
-   [Google App Engine documentation for Ruby](https://cloud.google.com/appengine/docs/flexible/ruby/) — GAE flex reference.
