Fly is no stranger to delivering serverless backends and applications. Within our articles, we've gone over AWS Lambda and Google Cloud Functions. Both services allow you to write compartmentalized functions that invoke to address specific contexts. Woven into your application, you might have a serverless function that compresses images, for example. Today, we're happy to announce another serverless-type offering: Now by Zeit.
This article is going to introduce Now, compare it to other 'serverless' backend offerings, then roll through setup within Fly. No servers required, but you should bring a smile. :)
1: Install now via the command line.
2: Run 'now' in any project directory with a
3: Set-up an alias.
4: Receive a URL for your deployment.
5: Put your URL in-front of your visitors.
For each deployment, if you want to deploy somewhere specific or as a specific function type, you can use the Now Universal API to deploy wherever you wish. Want to deploy your function using AWS Lambda and API Gateway? Or, perhaps using Google Cloud Functions on GCP? Specify your preferences in a
now.json file within your project.
Not only streamlining the deployment process, they promise that each deployment will travel over only secure connections and utilize HTTP/2. Mysteriously neat!
Baked into the above example is one key benefit: you can avoid vendor lock-in. You're free to move your code wherever you please - you didn't have to modify your code or use a proprietary API to account for using the service.
With options like AWS Lambda and Google Cloud Functions, what makes Now standout?
We'll look at two reasons:
2: Metadata: Your Now requests are clean HTTP requests that respond as you'd expect them to. The metadata that wraps each request is available to your application. Within Fly, this is of particular importance. If you're using Geo-IP Middleware, for example, that header information can make its way directly to your Now backend in-tact. More typically, you can act upon values from
Fly is an Application Delivery Network. You can add a hostname then attach any number of backends to that hostname. For example, you can host a static marketing site on your root domain, a Heroku application on
/app/, a Ghost Blog on
/blog and a Now-hosted API on
/api/. Want Google Cloud Functions, AWS Lambda, and Now applications as disparate microservices, threaded together as a monolith on your hostname along with things like Heroku, GitHub Pages, and Ghost Blogs? That's a good case for Fly.
If you're on a plan greater than Now's "free" plan, you can attach our open-source utility Wormhole to your deployments. Using Wormhole, you can achieve full end-to-end encryption - from client, to edge, to app, and back again. As your deployments grow in end-points, we load balance using the power of 2 random choices between those endpoints, ensuring sane and even traffic distribution across all available nodes.
To connect a Now backend with Fly, here's what you'd do. We'll assume you have Now up and running. First, you'd configure an
alias for your Now application. You'd want a relatively static URL when connecting to Fly.
now alias https://fly-prod-etjnigdrkz.now.sh fly-prod
We've now aliased our dynamic
fly-prod-etjnigdrkz.now.sh hostnames to
fly-prod.now.sh. As you add more backends, simply diversify the
fly-staging, name them whatever you'd like.
Head to Fly. If you don't have an account, you can sign up here. Create your first site, or choose to Add a backend to your existing site. Select now, then place in your now
Add backend. That's it! If you're using Now's free plan, you can use Fly to stay on that plan while using a custom hostname. If you're on a paid plan and want to attach Wormhole for added performance and security, check out our documentation.
You can now setup rules to route to your Now backend however you'd like. Thread as many backends together into one secure, SEO-plump hostname. Add custom Middleware. Ride a jalopy or eat a fish-stick. The world is in your hands. Fly is free to sign up, as are your first 2,000,000 requests and 100GB of transfer every month.
Make Your Applications Fly
Faster apps, simpler tools, happier visitors.Free Signup