Up 0.4.0 — Alerting, Encrypted Environment Variables, and 30% Quicker

TJ Holowaychuk
6 min readDec 19, 2017

--

This is the first official release of Up Pro, which includes a number of improvements over the open-source version for production applications.

If you’re unfamiliar with Up, it’s a tool which helps you manage and deploy serverless apis, apps and websites in seconds to your own AWS infrastructure. In short: it’s the easiest way to deploy Node.js, Golang, Python among others to AWS, and can cost as little as $1/mo to run or in some cases free.

Onboarding Improvements

Deploying with Up was easy from day one, but with this release I focused a bit more on onboarding to make the process even smoother.

Up now requires up.json for a project, however, Up will help you create it for you. Once you have an AWS account and credentials set up, Up will help guide you through creating your first app:

It will then prompt for the AWS credentials profile, or provide instructions if you have none.

Then select a region.

After that, your app and its resources are deployed and ready to go. More user experience improvements will be coming soon. Now onto the new production features!

Email, Slack, and SMS Alerting

Up Pro’s alerting feature lets you easily define how and when notifications should be triggered for application errors, performance problems and so on.

Alerting start with defining the alerts for your project, the following is an example an alert for 5xx server errors, notifying the backend team via email.

{
"alerts": [
{
"metric": "http.5xx",
"statistic": "sum",
"threshold": 15,
"action": "email backend team"
}
]
}

Once you have your alert(s) defined, you’ll need at least one actions — in this case just an email to the backend team.

{
"actions": [
{
"name": "email backend team",
"type": "email",
"emails": ["tj@apex.sh"]
}
],
"alerts": [
{
"metric": "http.5xx",
"statistic": "sum",
"threshold": 15,
"action": "email backend team"
}
]
}

Emails are concise and to the point, and display the alert description so you can describe actions which should be taken to resolve the problem.

Up also has Slack alert support, optionally specifying a channel as it will otherwise use the Slack Webhook’s default.

{
"name": "slack.backend",
"type": "slack",
"url": "https://hooks.slack.com/services/T0YS6H6S5/...",
"channel": "alerts"
}

It also has optional Giphy support, because why not, just add "gifs": true

SMS alerts are also supported out of the box— this is a great way to demand more attention to a failure — and you may provide more than one number per action.

{
"name": "text.backend",
"type": "sms",
"numbers": ["+12508005312"]
}

A complete configuration example might look something like the following; note that the name is an arbitrary string, you may create your own naming conventions.

{
"name": "myapp",
"actions": [
{
"name": "email.backend",
"type": "email",
"emails": ["tobi@apex.sh", "loki@apex.sh"]
},
{
"name": "text.backend",
"type": "sms",
"numbers": ["+12508005312"]
},
{
"name": "slack.backend",
"type": "slack",
"url": "https://hooks.slack.com/services/...",
"channel": "alerts-backend",
"gifs": true
}
],
"alerts": [
{
"metric": "http.count",
"statistic": "sum",
"threshold": 100,
"action": "email.backend"
},
{
"metric": "http.5xx",
"statistic": "sum",
"threshold": 5,
"action": "slack.backend",
"description": "Server errors"
},
{
"metric": "http.5xx",
"statistic": "sum",
"threshold": 25,
"action": "text.backend",
"description": "Server errors"
},
{
"metric": "http.latency",
"statistic": "avg",
"threshold": 1500,
"period": "10m",
"action": "slack.backend",
"description": "Large traffic spike"
}
]
}

To create all of these alerts simply run up stack plan and up stack apply after reviewing the changes.

Check out the docs to read more.

Encrypted Environment Variables

Up Pro features encrypted environment variables, a critical feature for any production application.

By default environment variables are encrypted, but you may choose to store them as plain text via -c in scenarios where the value is not sensitive.

Variables are scoped to all environments by default, you may override those values with the stage flag -s or if you prefer to be explicit, specify the stage for every definition.

Currently variables do not take change until the next deploy — this is important as it gives you a chance to modify several variables without conflicts, and gives you time to prepare for any code changes required if necessary.

Check out the docs to read more.

Configuration Autocomplete with JSON-Schema

Up now has an official JSON-schema definition, used to power great editing experiences. Schema Store project is supported by many editors to help aid in writing configuration, I didn’t realize this project existed until recently, but it’s great for fewer trips to the documentation.

Logging Improvements

A few small logging improvements help make it a little natural to work with, while still keeping the logs themselves structured as JSON. You may now query using unquoted strings for simple cases, here are a few examples:

$ up logs 'method=GET path=/foo/bar'
$ up logs 'method in (GET, HEAD, OPTIONS)'
$ up logs 'cart.products[0].name = ps4'

The other small change is that the message field is now implied. When you work with structured logs the message should never contain dynamic content, for example user signed in is a good message, while user Tobi signed in is not. Previously to query against messages you needed to do:

(message="user login" or message="user logout") name=tj

This may now be simplified to:

("user login" or "user logout") name=tj

Logs now also have the purple goodness:

I’ll continue to make logs feel more natural, but it’s getting there!

Small Changes

  • 4 additional hooks have been added
  • CI output is plain text for CI=true or --format=plain
  • S3 multi-part uploads make Up roughly 30% faster (by franciscocpg on GH)
  • S3 uploads remove the 50mb upload limit (by franciscocpg on GH)
  • environment variables are exposed to up start and hooks
  • NODE_ENV is populated automatically

IAM Policy Changes

Existing users may need to update their IAM policy, as S3 is now used for Lambda function uploads, unless you’re using a root AWS account.

If you’re interested – take a look at Subscribing to Up Pro and help support the project! Early adopters can use the coupon up-early-adopter-57AAA8693354 for 50% off (forever) as I continue to work toward v1.0, plenty of new stuff coming soon!

--

--