Up 0.3.0 — Custom domains, logging & stability improvements and more.

I’m back from a little vacation with a new release of Apex Up! This release introduces custom domains, domain purchasing from the command-line, improved logging support, and more. As usual, run up upgrade to update!

If you’re new to Up, it provides tooling enabling your team to deploy and manage “infinitely” scalable serverless apps, apis, and websites in seconds to your own infrastructure (currently supporting AWS Lambda).

Up lets you write vanilla applications using the framework(s) you already know and love, pay for only what you use, and never worry about infrastructure again.

Purchasing domains

A lesser-known feature of AWS Route53 is that you can purchase domains! Up exposes this functionality, allowing you to easily check availability and purchase domains from the command-line.

Here’s an example of an unavailable domain, with suggestions:

And when it’s available:

If you decide that supersloths.com is your cool new startup, run up domains buy and fill out the brief interactive form to provide the registrar with your contact information.

Custom domains

You can now map your domain(s) to your Up applications. If you’ve purchased a domain via up all you need to do is add stages and run up stack plan to preview changes, then up stack apply to apply them.

{
"name": "example-site",
"stages": {
"production": {
"domain": "example.com"
},
"staging": {
"domain": "stage.example.com"
}
}
}

A second related project, such an API for your front-end might have the following configuration.

{
"name": "example-api",
"stages": {
"production": {
"domain": "api.example.com"
}
}
}
Note that if it’s a side project and you do not require staging or production environments, you could use “development” to streamline your workflow (requiring only up instead of up deploy production).

AWS ACM will send an email to the owner of the domain to confirm ownership for SSL certificate it generates. Up will wait until this is complete.

Click “I Approve” in the email and the command will resume!

Once complete, CloudFront may take up to 30–40 minutes to apply changes, as it has to distribute your configuration throughout the globe. Subsequent deploys are typically a second or two, depending on your connection speed. CloudFront is unfortunately very slow to initiate, but thankfully this is a one-time cost!

After that, you’re done!

External registrars

If you did not register your domain via Route53 or up domains buy, you’ll need to visit your registrar’s site and assign the AWS nameservers, so your website can be served.

Once deployed, run up stack to view the status of your stack, and any nameservers associated with your mapped domain(s).

Here’s an example of the configuration for iwantmyname.com, however Godaddy and others will be very similar.

DNS propagation can take a moment, but otherwise you should be good to go!

Multi-line log capturing

One benefit of using Up is that it captures all of your logs, and will have the ability to transfer them to services such as Papertrail. Up now parses indented multi-line log lines, commonly used for stack traces, and treats it as a single log message instead of one per line.

ReferenceError: sloths is not defined
at repl:1:1
at ContextifyScript.Script.runInThisContext (vm.js:44:33)
at REPLServer.defaultEval (repl.js:239:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:440:10)
at emitOne (events.js:120:20)
at REPLServer.emit (events.js:210:7)
at REPLServer.Interface._onLine (readline.js:279:10)
at REPLServer.Interface._line (readline.js:626:8)

JSON log capturing

If you’re interested in capturing richer logs, aka “structured logging”, you can output JSON log events to stdout from your application.

All your app needs to do is output a level , message , and optional fields for contextual information:

{
"level": "info",
"message": "User Login",
"fields": {
"user_id": "sloth"
}
}

A minimalistic JavaScript logger for this format could be as simple as:

function log(level, message, fields = {}) {
const entry = { level, message, fields }
console.log(JSON.stringify(entry))
}

With the usage:

log('info', 'User Login', { user_id: "sloth" })

Check out a deployable example.

Log query units

The log query grammar now supports byte-size and duration units, for example:

up logs 'size >= 5kb'
up logs 'size >= 10.5mb'
up logs 'duration >= 500ms'
up logs 'duration >= 1.5s'

Log query stage short-hands

In v0.2.0 to filter logs of a specific stage you needed to run:

up logs 'stage = "production" and status >= 400'

Now you can use the stage shorthands stage , production , or development :

up logs 'production and status >= 400'

Hook arrays

A small but welcome addition is the ability to define multiple hook commands as arrays, instead of a single string with && :

{
"hooks": {
"build": [
"command 1",
"command 2",
"command 3"
]
}
}

Reverse proxy improvements

With big help from Steven Kabbes and several early adopters we’ve improved the robustness of the reverse proxy, and fixed a tricky long-standing bug causing intermittent errors has been resolved.

The reverse proxy now retries 5xx errors returned from your origin server, only when the request is idempotent (GET, HEAD, OPTIONS). You may disable this by setting proxy.retries to false.

Miscellaneous

  • add sub-process cleanup and grace period. Closes #311
  • add UP_STAGE env var. Closes #200
  • add environment variables to up start
  • add stage path support for defining a basepath (ex /v1 ) for a domain
  • add Lambda-specific logs to output (memory usage etc)
  • rename .proxy.timeout to .proxy.listen_timeout (BREAKING)
  • fix gzip handling when already compressed by the origin. Closes #328
  • fix permission issues for static file serving. Closes #385

Status

If you’re like me and you love graphs, here’s a graph of Up’s usage. So far 1,377 people have used Up, performing a total of 14,356 deploys. On the finance side there’s $352 from donations ❤.


The focus for v0.4.0 is on refactoring & UX, such as improving upload performance with multi-part S3, and working on the Pro version.

Up Pro will likely have an early-adopter price of around $25 USD / mo unlimited-use, with no additional cost per “seat” or team member, making it a cost-effective choice for any business. Pro will ship with features such as encrypted environment variables mapped by stage, alerting, uptime monitoring and more.

If you have questions or features you’d like to see, feel free to open an issue!