Giter Club home page Giter Club logo

newrelic-service-broker-tile's Introduction

New Relic Service Broker

This project is a self-hostable application that provides a service broker which proxies New Relic credentials to applications. This is typically useful for OSS Cloud Foundry or on-premise deployments of Cloud Foundry that you wish to easily bind to an off-premise New Relic deployment. In order to facilitate self-hosting, the application is designed to work in Cloud Foundry.


Prerequisites

  • One or more New Relic accounts/sub-accounts

  • A New Relic valid license key for each account.
    Note: You can obtain the license key for each account from your New Relic account under "Account Settings".

  • A running Cloud Foundry environment

  • Java Development Kit 1.8 or higher

  • Building the application (required for deployment) requires Maven

  • Proxy host and port details if your PCF environment requires proxy setting


Installation, Deployment, and Usage Procedures

The following instructions assume that you have created an account and installed the cf command line tool.

In order to automate the deployment process as much as possible, the project contains a Cloud Foundry manifest. To build and deploy the service broker follow the steps below:



Download New Relic Service Broker

git clone https://github.com/newrelic/newrelic-service-broker-tile.git
cd newrelic-service-broker

Build self-executable JAR

$ mvn package -Dmaven.test.skip=true
$ cf push

Edit manifest.yml file

  • if necessary, specify the correct "domain" for your PCF environment
  • If you PCF environment is disconnected, change the buildpack to java offline buildpack
  • Modify the "env:" section at the end of the file with correct values for the following 3 environment variables:
  env:
    SECURITY_USER_NAME: "<DIRECTOR_USER_NAME>"
    SECURITY_USER_PASSWORD: "<DIRECTOR_PASSWORD>"
    NRPLANS: '<A JSON ARRAY CONTAINING ONE OR MORE PLANS/LICENSE KEYS>'
  • Update "NRPLANS" with correct fields for each plan (required fields: planName, licenseKey).
  • Optionally you can provide "planDescription", but it's not required
  • The "guid" field is not required for OSS Cloud Foundry
  • "oldPlan" and "planOldGuid" are required only if you are upgrading from service broker 1.12.17 or older versions

The “planName” is how your developers will know which New Relic account to use for their applications.
Name it such that users will know which New Relic account to use.
Note: "planName" cannot contain any spaces (you can use dashes or camelCase to separate words).

The "licenseKey" value can be found in the "Account Administration" menu option from the top right corner of New Relic. Plan names are free form text with no spaces, you can use dashes between words.
Note: NRPLANS json array must be defined all in one line.

Environment Variables

Following is list of the required environmenet variables with sample values, which you can define in the manifest file.

Name Description
NRPLANS JSON object array with service broker plan names and New Relic account license keys associated with them. e.x. NRPLANS: '[{"planName": "hybris", "licenseKey" : "0123456789abcdef0123456789abcdef01234567", "planOldGuid": ""}, { "planName": "cloundfoundry" , "licenseKey": "1234567890abcdef", "planOldGuid": ""}, { "planName": "ecs", "licenseKey" : "0123456789abcdef0123456789abcdef89abcdef", "planOldGuid": ""}]'
SECURITY_USER_NAME The username that Cloud Controller should use to authenticate the service. This can be any value.
SECURITY_USER_PASSWORD The password that Cloud Controller should use to authenticate the service. This can be any value.

Push Service Broker Application to Cloud Foundry

cf push

This command will push the service broker application into Cloud Foundry and start running it. In the last section of the cf push output make note of the value for routes which is the url that will be used in the next step.


Create Service Broker

cf create-service-broker SERVICE_BROKER_NAME SECURITY_USER_NAME SECURITY_USER_PASSWORD URL
Where:

`SERVICE_BROKER_NAME` = the service broker name determined by you
`SECURITY_USER_NAME` = the security user name defined from the manifest.yml file when you pushed the app
`SECURITY_USER_PASSWORD` = the security password defined from the manifest.yml file when you pushed the app
`URL` = the url from previous step prepended with protocol (http:// or https://)

sample output:

broker: newrelic-broker
service    plan                    access orgs   
newrelic   New-Relic-Test          none        
newrelic   New-Relic-Production    none        

Enable Access to the Service Broker

cf enable-service-access newrelic [-p PLAN] [-o ORG]

You can enable access to specific "plan" and/or for specific "org"


Create Service Instance for each Plan

Each service plan is associated with a New Relic Account. Create a service instance for each of the plans

cf create-service newrelic PLAN SERVICE_INSTANCE
Where:

`PLAN` = servive plan name that you want to use
`SERVICE_INSTANCE` = name of the newly created service instance

Bind the Service to your application

cf bind-service MY_APP MY_SERVICE_INSTANCE
Where:

`MY_APP` = application name to bind to service instance
`MY_SERVICE_INSTANCE` = the service instance created in previous step

(Optional) Add Proxy configuration

If your environment is behind a proxy, add the proxy settings to your application by setting "JAVA_OPTS" environment variable

cf set-env <MY_APP> JAVA_OPTS "-Dnewrelic.config.proxy_host=proxy.yourCompany.com -Dnewrelic.config.proxy_port=nnn"

Note: If you're using a proxy across all of your applications, you may want to implement a PCF 'Environment Variable Group' for the staging process.

$ cf ssevg '{"JAVA_OPTS":"-Dnewrelic.config.proxy_host=proxy.yourCompany.com -Dnewrelic.config.proxy_port=nnn"}'
Setting the contents of the running environment variable group as admin...
OK
$ cf sevg
Retrieving the contents of the running environment variable group as admin...
OK
Variable Name   Assigned Value
JAVA_OPTS           -Dnewrelic.config.proxy_host=proxy.yourCompany.com -Dnewrelic.config.proxy_port=nnn

This will enable you to set the JAVA_OPTS parameters on a more global basis such that all applications would inherit the settings without the need to add application level settings to each application. You can find more details on Environment Variable Groups


Re-stage or re-push your application

cf push
or
cf restage MY_APP



License

The project is released under version 2.0 of the Apache License.

newrelic-service-broker-tile's People

Contributors

cliftondobrich avatar miransar avatar shahramk avatar tmartin14 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

newrelic-service-broker-tile's Issues

instructions need updating

Need instructions to be updated to have proper URL for "clone" command:

git clone https://github.com/newrelic/newrelic-service-broker-tile/

Upgrade from 1.11.4 to 1.12.3 fails when removing broker

We're attempting to upgrade from 1.11.4 of the New Relic Service Broker to 1.12.3. On apply changes we're getting an error running the deploy-all errand: Can not remove brokers that have associated service instances (see below).

Running errand deploy-all for New Relic Service Broker

===== 2017-11-14 18:06:40 UTC Running "bosh2 --no-color --non-interactive --tty --environment=10.10.10.21 --deployment=newrelic-broker-4fb108067859ffc72059 run-errand deploy-all"
Using environment '10.10.10.21' as client 'ops_manager'

Using deployment 'newrelic-broker-4fb108067859ffc72059'

Task 727002

Task 727002 | 18:06:41 | Preparing deployment: Preparing deployment
Task 727002 | 18:06:41 | Warning: Ambiguous request: the requested errand name 'deploy-all' matches both a job name and an errand instance group name. Executing errand on all relevant instances with job 'deploy-all'.
Task 727002 | 18:06:41 | Preparing package compilation: Finding packages to compile (00:00:00)
Task 727002 | 18:06:41 | Preparing deployment: Preparing deployment (00:00:00)
Task 727002 | 18:06:41 | Creating missing vms: deploy-all/d7a4d98d-8eff-4bcf-8f09-74a78b943a74 (0) (00:00:47)
Task 727002 | 18:07:28 | Updating instance deploy-all: deploy-all/d7a4d98d-8eff-4bcf-8f09-74a78b943a74 (0) (canary) (00:00:52)
Task 727002 | 18:08:20 | Running errand: deploy-all/d7a4d98d-8eff-4bcf-8f09-74a78b943a74 (0) (00:00:03)
Task 727002 | 18:08:23 | Fetching logs for deploy-all/d7a4d98d-8eff-4bcf-8f09-74a78b943a74 (0): Finding and packing log files (00:00:01)

Task 727002 Started  Tue Nov 14 18:06:41 UTC 2017
Task 727002 Finished Tue Nov 14 18:08:24 UTC 2017
Task 727002 Duration 00:01:43
Task 727002 done

Instance   deploy-all/d7a4d98d-8eff-4bcf-8f09-74a78b943a74  
Exit Code  1  
Stdout     cf version 6.32.0+0191c33d9.2017-09-26  
           cf api https://api.sys.pcfdev.one.example.com --skip-ssl-validation  
           cf auth system_services D0******  
           cf target -o NewRelicServiceBroker-service-org  
           cf target -s NewRelicServiceBroker-service-space  
           cf delete-service-broker NewRelicServiceBroker-v1-service-broker -f  
           Deleting service broker NewRelicServiceBroker-v1-service-broker as system_services...  
           FAILED  
           Server error, status code: 400, error code: 270010, message: Can not remove brokers that have associated service instances: NewRelicServiceBroker-v1-service-broker  
             
Stderr     -  

1 errand(s)


Errand 'deploy-all' completed with error (exit code 1)
Exit code 1
===== 2017-11-14 18:08:33 UTC Finished "bosh2 --no-color --non-interactive --tty --environment=10.10.10.21 --deployment=newrelic-broker-4fb108067859ffc72059 run-errand deploy-all"; Duration: 112s; Exit Status: 1
Exited with 1.

We ended up running this script to delete and recreate all the service instances.

Configure newrelic service instances w/ license at creation-time instead of using Opsman

I'm a PCF platform operator. I want to empower my teams to use their new relic service accounts at their own discretion. At the moment, if a team wants to use the new relic service broker, they have to ask us (platform ops) to load their license key into the opsman tile & perform a apply-changes

Is there a way teams can load their license key in to a new relic service instance? E.g., when they go to create a new service, one of the key: value params they pass in is license: abc123xyz?

I just need a better way to let my teams self-service their new relic access. I don't want the operations team to be the bottleneck.

Thank you!

newrelic service plans limitation

Hi,

There are about 300+ service plans in the NR service broker in our PCF foundation, totaling 45910 bytes in variable size on NRPLANS. The NRPLANS variable is expected to be encrypted and pushed into the Tanzu CCDB. After encryption, the size would be greater than 65KB. By then, we would have exceeded the CCDB data type and application environment variable size limits.

Getting the following error message, after the addition of a New Relic service plan:
"Failed Server error, status code: 500, error code: 10011, message: Database error"

It was suggested that the variable size be decreased. Even if we shorten the plan description, the problem will continue to be reported. I would like to understand why the variable size increased after it was encrypted and what options there are to reduce the variable size.

Thanks,
Kanna

Support for JBP 4.0

The New Relic service broker tile fails to install with Java Buildpack 4.0+ because of the -m 512M flag:

+ cf push NewRelicServiceBroker-v1 -p /var/vcap/packages/newrelic_service_broker/new-relic-service-broker.jar -n newrelic-broker -d apps.pcfdev-us-west-2.aws-nonprod.fmrcloud.com -t 180 -m 512m --no-start

++++++++++++
2017-11-08T07:04:29.82-0500 [APP/PROC/WEB/0] ERR Cannot calculate JVM memory configuration: There is insufficient memory remaining for heap. Memory limit 512M is less than allocated memory 669939K (-XX:ReservedCodeCacheSize=240M, -XX:MaxDirectMemorySize=10M, -XX:MaxMetaspaceSize=89745K, -XX:CompressedClassSpaceSize=16993K, -Xss1M * 300 threads)
++++++++++++

More information on this error is available at: https://discuss.pivotal.io/hc/en-us/articles/115011717548-Insufficient-memory-when-using-Java-Buildpack-4-0-

The recommended solution is just to scale memory up to 1G or more.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.