Create and monitor WayScript self-service dev environments in minutes
Tags: devops, tutorial, monitoring, python
Published: 2024-02-29 23:20:45

Software development demand—and complexity— is increasing every day, creating a growing challenge for SRE and DevOps teams to keep up and simultaneously support ad hoc internal development needs. Interrupting the SRE workflow to provision and manage environments is costly. Self-service infrastructure for developers can solve this problem, but can be a massive headache to implement and manage.

To tackle this developer self-serve challenge, New Relic and WayScript built an integration that lets you quickly create a developer environment and automatically monitor it with a suite of observability tools. With WayScript and New Relic, you can:

- 
Instantly spin up containerized developer environments in a single click.

- 
Host full-fledged apps, set up internal microservices, and more, with built-in tools like a terminal and IDE.

- 
Monitor and troubleshoot everything you build with an easy connection to the New Relic observability platform.

<iframe width="744" height="420" src="https://www.youtube.com/embed/EjX0nZ0w6Mo" title="Monitor self serve developer environments with WayScript" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

All developers can [get started for free with New Relic](https://newrelic.com/signup?utm_source=devto&utm_medium=community&utm_campaign=global-fy24-q4-WayScript) and connect with WayScript as part of the more than 480 integrations included with New Relic’s observability platform. Free accounts with New Relic receive 100 GB per month of free data ingest, one full platform user, and unlimited basic users, queries, dashboards, and alerts. With preconfigured cloud-native environments from WayScript and rich observability capabilities from New Relic, you can focus on writing code instead of managing infrastructure. 

##Automate development environment monitoring with New Relic and WayScript

WayScript is an internal developer platform (IDP) that makes it easy for software developers, SREs, and engineering leaders to take control of their team’s tools and developer environments. You can create self-service, cloud-based developer environments that scale, so SREs don't need to disrupt their workflows to provision one-off environments. WayScript is SOC-2 Type II certified. You can use it on the browser, the desktop app, or self-host WayScript on your own EC2 instance.

Developers can quickly build cron tasks, services, APIs, servers, data pipelines, and any other internal tool, without needing to learn new platforms and technologies. The cloud-based Docker environments come with built-in SSO, Kubernetes, internal data access, and now New Relic monitoring.

<p><a href="https://newrelic.com/blog/nerdlog/wayscript-integration?wvideo=53mdh8hbwz"><img src="https://embed-ssl.wistia.com/deliveries/a34b3c7c8cf155b3ae85e1179cd2b08e5a11cbaa.jpg?image_play_button_size=2x&amp;image_crop_resized=960x540&amp;image_play_button=1&amp;image_play_button_color=2be68be0" width="400" height="225" style="width: 400px; height: 225px;"></a></p><p><a href="https://newrelic.com/blog/nerdlog/wayscript-integration?wvideo=53mdh8hbwz">Monitor Self-Serve Developer Environments with WayScript | New Relic</a></p>

With this new integration, you can automatically initialize New Relic to configure application performance monitoring (APM) agents, log forwarding, and more during the initial workspace setup in WayScript. You’ll get automatic visibility into the health of all pre-production, staging, and production environments.

##How to create and monitor your environment in minutes

Now let’s try it out. There are just four main steps for connecting WayScript and New Relic:

1. Open a WayScript workspace for your team.
2. Create your first Lair for a containerized development environment.
3. Enable the New Relic integration in WayScript.
4. Set up a New Relic APM agent in your Lair.

##1. Open a WayScript workspace for your team

In WayScript, each team gets access to a WayScript workspace. SRE and DevOps teams preconfigure integrations and set organizational standards for the workspace. Developers in turn rapidly create Lairs in the workspace, the basic building blocks of WayScript.

1. Sign up for a free WayScript account or sign in to an existing account. 

Access WayScript at app.wayscript.com or download the WayScript desktop app available for MacOS and Windows at wayscript.com/downloads. 
Create your account by following the sign up instructions.

2. Create a workspace. Your WayScript workspace is where you and your team will collaborate on managing and shipping software. Note that you can invite others on your team to the workspace by selecting + Invite Team Member at the bottom left of the screen.

##2. Create your first Lair in WayScript: a containerized dev environment

A Lair is a preconfigured, containerized, and flexible development environment for your code. They come stocked with handy tools like a cron scheduler, terminal, IDE and endpoint configuration.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/klja9d0z96t7yj4zbydc.png)

To create a Lair in your workspace:

1. Select the Lair tab in the left panel to navigate back to the Lair view.
2. In the Lair view, select + New Lair in the top right of the screen. 
3. To get started coding from scratch, select a pre-built template to customize or create a blank Lair. Follow this WayScript guide for inspiration and simple examples. For now, you can select the Flask template under Frameworks.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5gddmtxmmphjkx5rmbuf.png)

##3. Enable the New Relic integration in WayScript

Note: To ensure your data moves seamlessly from WayScript to New Relic, make sure to complete the integration by following these steps before you deploy a Lair, which is covered in the next section.

1. Log in to New Relic or [sign up](https://newrelic.com/signup/?utm_source=devto&utm_medium=community&utm_campaign=global-fy24-q4-WayScript) for a free account.

2. Create a New Relic integration in WayScript. In WayScript, go to integrations by selecting the Workspace dropdown menu in the top left corner. Select Settings, and then Integrations. On the integrations page, select +New Integration, and then New Relic.

<p><a href="https://newrelic.com/blog/nerdlog/wayscript-integration?wvideo=w4uwlga1ho"><img src="https://embed-ssl.wistia.com/deliveries/27b253ec529116d9e861a538cb7f658ea4617374.jpg?image_play_button_size=2x&amp;image_crop_resized=960x540&amp;image_play_button=1&amp;image_play_button_color=2be68be0" width="400" height="225" style="width: 400px; height: 225px;"></a></p><p><a href="https://newrelic.com/blog/nerdlog/wayscript-integration?wvideo=w4uwlga1ho">Monitor Self-Serve Developer Environments with WayScript | New Relic</a></p>

3. Enter your New Relic account_id and license_key. 

You can find these values on the [WayScript data source page](https://onenr.io/0dQeVpxaDwe) in New Relic.
Optionally, you can choose to use a new license key. If so, read the [New Relic API key documentation](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys?utm_source=devto&utm_medium=community&utm_campaign=global-fy24-q4-WayScript) for instructions.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e1yiki2f38huqrmevjdq.png)

4. In WayScript, complete the integration by selecting **Create integration**.

##4. Set up APM for your Lairs (Python example)

Next, install a New Relic APM agent to monitor your Lair and anything you build inside it. WayScript supports development in any language, but this example uses the [Python agent](https://docs.newrelic.com/install/python/?utm_source=devto&utm_medium=community&utm_campaign=global-fy24-q4-WayScript). To see all the APM agents available in New Relic, go to Add data, and filter for Application monitoring.

1. Configure the APM agent in the WayScript terminal. Select the Lair you want to monitor and select the Develop tab in the left panel. In the terminal that opens in the right panel, run these commands to generate the newrelic.ini config file for the Lair:

```
pip install newrelic 
newrelic-admin generate-config YOUR_LICENSE_KEY newrelic.ini
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3q6i9ocrgn50rj36qa8z.png)

2. Add New Relic to your requirements.txt file. Open the code editor by selecting the Show Code icon in the bottom left pane. Select the requirements.txt file and add newrelic at the bottom of the file:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u2bx13ekl26e8chuv3mg.png)


If your Lair does not have a requirements.txt file, you can create one directly in the code editor.

3. Add a deploy trigger. Open the Triggers panel by clicking the last icon, Show Triggers, in the bottom left pane. Click the + icon at the top of the Triggers panel and select deploy. Paste the following command in Command to Run:

```
NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program $YOUR_COMMAND_OPTIONS
```

Be sure to replace $YOUR_COMMAND_OPTIONS with your app’s command line, for example, python app.py.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bsuijzrso61xejlbms5p.png)

4. Test the connection. Invoke a process in your Lair. (Select the play icon under Run on the deploy trigger or navigate to the Lair endpoint.)

5. Deploy your Lair to productions. Select Deploy from the left panel to open the deploy view and click Deploy. This promotes your changes from your development environment to an identical production environment with unique endpoints and will automatically run your deploy trigger.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6asjureur2f7hxl25ojv.png)

6. Wait a few minutes for New Relic to start receiving your data. It should take only 5-10 minutes.

<p><a href="https://newrelic.com/blog/nerdlog/wayscript-integration?wvideo=pot2unjxy4"><img src="https://embed-ssl.wistia.com/deliveries/890d44760118409c8d743db2402aae4b6de14c0d.jpg?image_play_button_size=2x&amp;image_crop_resized=960x540&amp;image_play_button=1&amp;image_play_button_color=2be68be0" width="400" height="225" style="width: 400px; height: 225px;"></a></p><p><a href="https://newrelic.com/blog/nerdlog/wayscript-integration?wvideo=pot2unjxy4">Monitor Self-Serve Developer Environments with WayScript | New Relic</a></p>

That’s it! Now you should be able to see your Lair and applications in [New Relic](http://one.newrelic.com/?utm_source=devto&utm_medium=community&utm_campaign=global-fy24-q4-WayScript).

---

To read this full New Relic blog, [click here](https://newrelic.com/blog/nerdlog/wayscript-integration?utm_source=devto&utm_medium=community&utm_campaign=global-fy24-q4-WayScript).