Course
This lesson is part of a course that teaches you how to build a New Relic application from the ground up. If you haven't already, check out the course introduction.
Each lesson in the course builds upon the last, so make sure you've completed the last lesson, Describe your app for the catalog, before starting this one.
In the last lesson, you created catalog information for the A/B test app you've been building throughout this course. Now, it's time to publish your app to the Instant Observability catalog and submit those catalog details.
Versions and tags
Publishing an application requires two key pieces of information:
- version
- tag
An application's version identifies the code it contains and is stored in the Nerdpack's root-level package.json file. Every time you modify code in your Nerdpack and are ready to release it, you'll update the version in package.json. For example, if you fix some bugs in the first major version your application code, you might publish the changes under version 1.0.1
.
An app version's tags describe its state. For example, version 0.0.1
of a work-in-progress application might be published with a DEV
tag to indicate that it's in development.
Tip
There are some rules governing how you can use tags and you can read about those in our tags documentation.
Publish your first application
Change to the publish/ab-test directory of the coursework repository:
$cd nru-programmability-course/publish/ab-test
This directory contains the code that we expect your application to have at this point in the course. By navigating to the correct directory at the start of each lesson, you leave your custom code behind, thereby protecting yourself from carrying incorrect code from one lesson to the next.
Navigate to the root of your Nerdpack at nru-programmability-course/publish/ab-test
.
Generate your own app UUID:
$nr1 nerdpack:uuid -gf
The UUID is used to identify your app in the New Relic app registry. Because you're using code that we developed for this course, an application with the existing UUID already exists in the registry. By generating your own, you're now able to publish this application.
Technical detail
The UUID also ties your app to your account and, therefore, allows the application to make Nerdgraph requests on behalf of the account that installed it.
In package.json, set version
to 1.0.0
:
{ "private": true, "name": "ab-test", "version": "1.0.0", "scripts": { "start": "nr1 nerdpack:serve", "test": "exit 0" }, "nr1": { "uuid": "2d923ba6-d231-4dd3-830f-b1923577a422" }, "dependencies": { "prop-types": "^15.6.2", "react": "^16.6.3", "react-dom": "^16.6.3" }, "browserslist": ["last 2 versions", "not ie < 11", "not dead"]}
New Relic uses semantic versioning and, under this convention, 1.0.0
signals the first major release. Now, you're ready to publish!
Replace all instances of <YOUR NEW RELIC ACCOUNT ID>
and <YOUR NEW RELIC ENTITY GUID>
in your project with your actual New Relic account ID and entity GUID, respectively.
Publish your New Relic application:
$nr1 nerdpack:publish -t DEV
That's it! You published your application to New Relic's registry. The -t
parameter specifies a tag for your published version. Among other logs, you should see the following confirmation in your console:
Publishing Nerdpack AbTest (9da77738-9cf6-43c7-9ba0-e3a8c6ac7380) ✔ Nerdpack published successfully! ✔ Tagged 9da77738-9cf6-43c7-9ba0-e3a8c6ac7380 version 1.0.0 as DEV.
For now, you've tagged the 1.0.0 release as DEV
because it's still a work in progress.
View your app's registry information:
$nr1 nerdpack:infoId: 9da77738-9cf6-43c7-9ba0-e3a8c6ac7380Region: usAccount ID: 123456Local version: 1.0.0Subscription Model: OWNER_AND_ALLOWEDVersion Count: 4Version Date Tags------- ------------- ------1.0.0 5 minutes ago DEV
The results of this command detail the information stored in New Relic's registry for your application, including its UUID, version, and account ID.
View your application in Instant Observability
Now that your application is published and tagged, you can view it in the Instant Observability catalog.
Go to New Relic. Notice that you're not using the ?nerdpacks=local
querystring parameter. You don't need it anymore because you're not serving your app locally.
From the homepage, navigate to Add data in the top navigation bar:
Select Apps & Visualizations:
From here, you can see your application among the resources:
Notice that this is different than when you locally served your app. Local apps and published apps you're subscribed to show under Your apps in the Apps overlay instead.
Click on your app to see more details:
Notice the release date and app version. This page should show the information you created in the last lesson. It doesn't yet, because you haven't submitted that information to the catalog, and publishing your app doesn't do that for you.
Submit catalog information
Even though you've published your application, there are some things that the catalog doesn't know about. These are the descriptions, screenshots, and metadata you created in the last lesson. nr1 catalog
is used to submit and view this information.
Submit your catalog information:
$nr1 catalog:submitUploading screenshots from nru-programmability-course/publish/ab-test... ✔ Screenshots uploaded from: nru-programmability-course/publish/ab-test ✔ Updated metadata for AbTest 1.0.0
If everything goes right, you should see a success message notifying you that the screenshots and metadata were updated.
You may, however, get an error when submitting this information to the catalog:
Uploading screenshots... › Error: 1 error while updating AbTest 1.0.0 › › Invalid Version: Nerdpack version 1.0.0 not found. Have you run `nr1 nerdpack:publish` yet? › Code: UNKNOWN
If you do, try again in a minute or two. It can take a few seconds for the catalog to update with the new version of your application.
If that doesn't work, make sure you published your app with nr1 nerdpack:publish
.
View your catalog information:
$nr1 catalog:infoAbTest (Nerdpack): categoryTerms.0: browser agent description: Nerdpack ab-test details: Display test data for our newsletter subscription A/B test displayName: AbTest keywords.0: a/b test icon.url: https://nr3.nr-ext.net/artifact-index-production/a685fec2-29fb-40b0-9f65-4178... previews.0.url: https://application-catalog-production.s3.us-east-2.amazonaws.com/nerdpacks/a... releaseDate: 2021-03-12T15:46:09.600138Z repository: https://github.com/newrelic-experimental/nru-programmability-course tagline: Win @ newsletter subscriptions version: 1.0.0 whatsNew.changes: Initial release! Includes: - A variety of charts for understanding the test r... whatsNew.version: 1.0.0AbTestLauncher (Launcher): description: Describe me displayName: AbTestLauncher icon.url: https://nr3.nr-ext.net/artifact-index-production/a685fec2-29fb-40b0-9f65-4178...AbTestNerdlet (Nerdlet): displayName: AbTestNerdlet supportedEntityTypes.mode: NONE
All the information from catalog shows here.
View your app:
Click on the app to see more:
You see the screenshots added to your launcher or Nerdlet under What's inside:
Here, you see app details, a documentation tab, release notes, and screenshots.
Update your version tag
Your app looks great in the Instant Observability catalog, complete with metadata, images, and documentation. Before, you tagged the app as DEV
because all of the information wasn't ready for public consumption. Now, it is. It's time to update your version tag.
Update your 1.0.0
app version from DEV
to STABLE
:
$nr1 nerdpack:tag -t STABLE ✔ Tagged 9da77738-9cf6-43c7-9ba0-e3a8c6ac7380 version 1.0.0 as STABLE.
Without specifying a version, nr1
uses the version specified in package.json. You can specify a version with the -V
command. Learn more about nerdpack:tag
with the nr1 nerdpack:tag --help
command.
View your app information:
$nr1 nerdpack:infoId: 9da77738-9cf6-43c7-9ba0-e3a8c6ac7380Region: usAccount ID: 123456Local version: 1.0.0Subscription Model: OWNER_AND_ALLOWEDVersion Count: 1Version Date Tags------- ------------- ------1.0.0 30 minutes ago STABLE
The app is now tagged with STABLE
, indicating it's ready for public use.
Technical detail
Even though the app is ready for public use, it's still only visible to users of your account. Other accounts can't see apps created by other private accounts unless those apps are added to the public Instant Observability catalog.
Now that your app is published and its metadata is submitted, you can subscribe your account to the app from Instant Observability. In the next lesson, you'll learn the ways to subscribe and unsubscribe to your new application.
Course
This lesson is part of a course that teaches you how to build a New Relic application from the ground up. Continue on to the next lesson: Subscribe to your New Relic application.