Bringing Brazil to the Cloud, Now

ZEIT is the company behind the Now platform

And many popular OSS projects: Hyper, Next.js, Micro

Our mission is to make the cloud accessible to everyone in the world

A brief history of the Now universe

It all started with Node.js

Idea: make deploying a Node.js server 1-command

Now was born

Simple:

$ npm i -g now
$ cd my-node-project
# look, no git!
$ now

Every deployment gets its own URL

Let's make a change

Give it a memorable name

now alias braziljs-18-jfzbivxisc.zeit.sh braziljs.now.sh

Each change is available

  • Simple rollbacks. Use now alias and change the pointer
  • Simple collaboration. Share a link on Slack!
  • Git and GitHub-friendly. Each push gets its own deployment

Infinite deployment

At what cost?

How can we afford to deploy infinitely, and run them forever?

With a trick called Serverless

There's no servers!

It all runs on water droplets suspended in the atmosphere

The truth is…

We don't run them forever. We run them on-demand

"You said Node.js only!"

But that is no longer the case

Static Deployments

Before: Deploy a Static File Server in Node.js

// package.json
{
  "dependencies": {
    "serve": "10.0.0",
  },
  "scripts": {
    "start": "serve"
  }
}

Now: First-class support

It even works for file sharing!

You can go to it!

It's a beautiful logo:
https://braziljs-logo.now.sh

Bonus: Static Deployments can still be Built in The Cloud

Let's look at the build logs from our example

Node.js is a vast universe on its own

  • Versions change frequently

    • Lots of runtime updates
    • Lots of V8 updates
    • Lots of security updates
    • Your apps are insecure until the cloud provider (us) upgrades
  • Alternative Node.js runtimes. e.g.: NodeSource
  • Lots of ways of installing and building

    • npm i
    • yarn
    • npm ci
    • pnpm
    • git

Plus, why support only Node.js?

Lots of other great languages!

  • Rust
  • Lua 🇧🇷
  • Go
  • Clojure
  • Reason / OCaml
  • Crystal
  • Kotlin
  • Scala
  • Erlang
  • Elixir
  • C++ (OK, C++11)
  • Java (OK, Java 9)

The solution: Bring Your Own Runtime

How? Adding a Dockerfile to your project

Node.js Hello World

Look, no files needed!

FROM mhart/alpine-node:base-10
CMD ["node", "-e", "require('http').Server((_,r)=>r.end('Hi BR')).listen()"]

Or Use any image from the Docker Registry

Run a terminal

https://terminal.now.sh

FROM dit4c/gotty

These deployments require no supervision or manual scaling

They scale automatically based on traffic

From zero to infinity

Let's take a look at how that works

Let's access a deployment for the first time

Now let's access it again

What happened first is that the deployment was cold

Upon more responses, the deployment stays hot

After one minute without requests (configurable), it goes cold

How do you configure it?

{
  "limits": {
    "maxConcurrentReqs": 1, // scale when max 1 request
    "timeout": 120000,      // 2 minutes
    "duration": 240000      // 4 minutes
  }
}

Note: this is only for Dynamic Docker deployments

i.e.: if they execute code for each request (not static)

So, latency looks great…

But that was from San Francisco 🌁

Now is about democratizing the cloud world-wide

Our datacenters are named after airports

Starting with sfo1 in California, West USA

We later introduced bru1 in Belgium, West Europe

And today we are introducing gru1 in São Paulo, East SA 🎊

Before we go on, let's discuss the Now Network

We have 3 fundamental types of nodes

  • DNS (Anycast)
  • Origins
  • CDN

Let's start with DNS

My website matheus.sh points to a deployment

now alias matheustop-xejwbqcgxh.now.sh matheus.sh

For this to work, matheus.sh points to ZEIT DNS

Let's ping a.zeit.world (96.45.80.1) from California

Let's ping it from Brussels

How come this IP is fast from everywhere?

It's due to the magic of Anycast

These IPs don't exist in a specific place

They exist in many places at once

We route your visitors to the nearest datacenter…

But we also use it for api.zeit.co to route to…

  • api-sfo1.zeit.co
  • api-bru1.zeit.co
  • api-gru1.zeit.co

Why is this important?

All future deployments in South America will automatically go to gru1

If you remember our first slide...

$ npm i -g now
$ cd my-node-project
# look, no git!
$ now

We still live up to our original promise:

$ npm i -g now
$ cd my-node-project
# look, no regions!
$ now

However, just because your deployment is created in a specific region...

Doesn't mean it can't execute it everywhere in the world

Static deployments are automatically global

This corresponds to the third node type in the Now Network: CDN

Remember https://braziljs-logo.now.sh from earlier?

Let's fetch it from Porto Alegre

The full content was cached at the edge

We intelligently cache your static deployments in our CDN

But most importantly:

We intelligently invalidate them when you make changes

For dynamic deployments, you can use Cache-Control to influence caching

This means that effectively today, all deployments in South America will enjoy the lowest latency

The best part?

Now is 100% free to get started!

Unlimited deployments, aliases and domains

Sign up today: https://zeit.co

The end