For this exercise, we will be deploying a semi-static web-app directly from our source-control in GitHub to various providers. The application we will be deploying is an alternative UI for Hacker News.
In this demo, we will be deploying to the following providers. Based on how fast you are, you can pick as many as you want:
-
Fork the
nextjs-hackernews
repo -
Setup deployment from GitHub
-
Vercel
- Login or register at https://vercel.com
- “Add new …” > “Project” > “Import from Git” > Select forked repo from GitHub
-
Netlify
- Login or register at https://app.netlify.com/
- “Add new site” > “Import an existing project” > “GitHub” > Select forked repo
-
AWS Amplify
- Login to AWS Console
- Navigate to AWS Amplify page (easiest to use the search bar at the top)
- “Get Started” > “Host a web-app” > “GitHub” > Select forked repo > Click “Next” on all defaults > “Safe and deploy”
- (After you’re done) Delete the Amplify App
-
-
(Optional) Configure a custom domain
-
Vercel
- Open the settings of your site, it will be under
https://vercel.com/{USERNAME}/nextjs-hackernews/settings
. - In the left-hand panel select "Domains", then add a domain through the form. You can pick either one you control yourself, or pick a
somethingyouwant.vercel.app
. For your own domains, you will have to follow the instructions to configure correct DNS entries.
- Open the settings of your site, it will be under
-
Netlify
- Go to "Site settings" > "Domain management" > "Domains"
- Either change the
somethingyouwant.netlify.app
domain which is already configured, or add a new custom domain you manage yourself.
-
AWS Amplify
- Go to "App settings" > "Domain management" and click "Add domain"
- Select a domain or subdomain you want
- Follow the instructions on setting up the DNS configuration, if you're using a domain which is already in Route53 then AWS will be able to do this for you.
-
Let's see what we now have:
-
User experience and features
- Start by clicking around the website a bit.
- Open up the network console to see what's happening under the hood.
- Go to
/api/hello
as an example of how besides just a static-site deployment we also have deployed server-side logic.
-
Developer experience. What would the development flow look like?
The default behaviour will differ a bit between vendors:
- Vercel will deploy every branch and commit
- Netlify every PR
- AWS Amplify only your default branch, so in most cases either
master
ormain
. (With additional configuration Amplify can also deploy on every branch.)
Let's see what we got out of the box and make some change to the application:
- Let's make some small change - e.g. change the title in
./components/SiteHeader.js:14
and commit that in a new branch. - Create a pull-request against the
main
-branch of your own fork. - Observe the GitHub integration doing it's work in the comments of your PR.
- Merge in your PR and see how long it takes for your changes to propegate.
-
Performance comparison
- Let's look into some global latency characteristics of our website, the following tool will measure the request duration from various points across the globe: https://tools.bunny.net/http-test. Try to see if you can pick up on:
- Cache misses / Cold starts
- Deployment region: Can you see from the request duration one location all requests go to?
- For reference, compare your deployments to:
- Let's look into some global latency characteristics of our website, the following tool will measure the request duration from various points across the globe: https://tools.bunny.net/http-test. Try to see if you can pick up on:
Ready for another challenge? Next up, there's instructions on how to deploy a Redwood app as a container to Fly.io.