adding a new AWS example
This commit is contained in:
parent
673bc23fe4
commit
6a04af0950
5 changed files with 63 additions and 27 deletions
11
README.md
11
README.md
|
|
@ -20,6 +20,7 @@ Effortless deployment to AWS and GitHub Pages for Next.js apps 🚀
|
||||||
- [Redirecting Domains](#Redirecting-Domains)
|
- [Redirecting Domains](#Redirecting-Domains)
|
||||||
- [Deployment State](#Deployment-State)
|
- [Deployment State](#Deployment-State)
|
||||||
- [CI/CD](#CICD)
|
- [CI/CD](#CICD)
|
||||||
|
- [Examples](#Examples)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
|
@ -150,7 +151,7 @@ You will need the following permissions:
|
||||||
|
|
||||||
### GitHub
|
### GitHub
|
||||||
|
|
||||||
No specific environment configuration is necessary. By default, your app will be built and [exported](#https://nextjs.org/docs/advanced-features/static-html-export) to the `gh-pages` branch.
|
No specific environment configuration is necessary. By default, your app will be built and [exported](https://nextjs.org/docs/advanced-features/static-html-export) to the `gh-pages` branch.
|
||||||
|
|
||||||
## Configuration Options
|
## Configuration Options
|
||||||
|
|
||||||
|
|
@ -268,7 +269,7 @@ When working on a team or trying to implement [CI/CD](#CICD) it is advisable to
|
||||||
|
|
||||||
### CI/CD
|
### CI/CD
|
||||||
|
|
||||||
Implement [CI/CD](#https://en.wikipedia.org/wiki/CI/CD) in your workflow with Next Deploy by substituting environment variables into your `next-deploy.config.js`.
|
Implement [CI/CD](https://en.wikipedia.org/wiki/CI/CD) in your workflow with Next Deploy by substituting environment variables into your `next-deploy.config.js`.
|
||||||
|
|
||||||
Consider an advanced configuration example:
|
Consider an advanced configuration example:
|
||||||
|
|
||||||
|
|
@ -298,4 +299,8 @@ module.exports = {
|
||||||
|
|
||||||
The most important configuration option in the example above is `stage`. It will allow for the deployment state to be persisted in S3 and it will be synced with the locale state at the start of every build.
|
The most important configuration option in the example above is `stage`. It will allow for the deployment state to be persisted in S3 and it will be synced with the locale state at the start of every build.
|
||||||
|
|
||||||
While implementing CI/CD in your project, consider following the [latest Next.js guidelines for storing](#https://nextjs.org/docs/basic-features/environment-variables#loading-environment-variables) and loading the environment variables in `.env*` files.
|
While implementing CI/CD in your project, consider following the [latest Next.js guidelines for storing](https://nextjs.org/docs/basic-features/environment-variables#loading-environment-variables) and loading the environment variables in `.env*` files.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Check out the two examples for AWS and GitHub in the [examples folder](/examples) to get a sense of what the implementation will entail and how it will run when deployed.
|
||||||
|
|
|
||||||
24
examples/aws/README.md
Normal file
24
examples/aws/README.md
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
An example of a fully functional Next.js deployment to AWS can be found [here](https://github.com/nidratech/next-deploy-aws-demo).
|
||||||
|
|
||||||
|
You can see it in action on AWS [here](https://d1glu8cqlkaas6.cloudfront.net).
|
||||||
|
|
||||||
|
The key part is its `next.config.js` configuration:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
module.exports = {
|
||||||
|
engine: 'aws',
|
||||||
|
debug: true,
|
||||||
|
bucketName: 'next-deploy-demo-bucket',
|
||||||
|
description: {
|
||||||
|
requestLambda: 'Next deploy demo request lambda.',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
requestLambda: 'request-handler-demo',
|
||||||
|
},
|
||||||
|
stage: {
|
||||||
|
name: 'demo',
|
||||||
|
versioned: true,
|
||||||
|
bucketName: 'next-deploy-demo-environments',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
@ -2,7 +2,7 @@ Deployments to [GitHub Pages](#https://pages.github.com/) work strictly for stat
|
||||||
|
|
||||||
An up-to-date Static-Site Generation implementation of https://www.nidratech.com and its deployment using Next Deploy can be found at: https://github.com/nidratech/nidratech.com
|
An up-to-date Static-Site Generation implementation of https://www.nidratech.com and its deployment using Next Deploy can be found at: https://github.com/nidratech/nidratech.com
|
||||||
|
|
||||||
The key part is the next.config.js configuration:
|
The key part is its `next.config.js` configuration:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
"@serverless/core": "^1.1.2",
|
"@serverless/core": "^1.1.2",
|
||||||
"@zeit/node-file-trace": "^0.8.0",
|
"@zeit/node-file-trace": "^0.8.0",
|
||||||
"ansi-escapes": "^4.3.1",
|
"ansi-escapes": "^4.3.1",
|
||||||
"archiver": "^4.0.2",
|
"archiver": "^5.0.0",
|
||||||
"aws-sdk": "^2.718.0",
|
"aws-sdk": "^2.718.0",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"execa": "^4.0.3",
|
"execa": "^4.0.3",
|
||||||
|
|
|
||||||
51
yarn.lock
51
yarn.lock
|
|
@ -2729,18 +2729,18 @@ archiver-utils@^2.1.0:
|
||||||
normalize-path "^3.0.0"
|
normalize-path "^3.0.0"
|
||||||
readable-stream "^2.0.0"
|
readable-stream "^2.0.0"
|
||||||
|
|
||||||
archiver@^4.0.2:
|
archiver@^5.0.0:
|
||||||
version "4.0.2"
|
version "5.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/archiver/-/archiver-4.0.2.tgz#43c72865eadb4ddaaa2fb74852527b6a450d927c"
|
resolved "https://registry.yarnpkg.com/archiver/-/archiver-5.0.0.tgz#b1e7dc075a4e18e0aa59afdd7c3e5f3d3321cbeb"
|
||||||
integrity sha512-B9IZjlGwaxF33UN4oPbfBkyA4V1SxNLeIhR1qY8sRXSsbdUkEHrrOvwlYFPx+8uQeCe9M+FG6KgO+imDmQ79CQ==
|
integrity sha512-AEWhJz6Yi6hWtN1Sqy/H4sZo/lLMJ/NftXxGaDy/TnOMmmjsRaZc/Ts+U4BsPoBQkuunTN6t8hk7iU9A+HBxLw==
|
||||||
dependencies:
|
dependencies:
|
||||||
archiver-utils "^2.1.0"
|
archiver-utils "^2.1.0"
|
||||||
async "^3.2.0"
|
async "^3.2.0"
|
||||||
buffer-crc32 "^0.2.1"
|
buffer-crc32 "^0.2.1"
|
||||||
glob "^7.1.6"
|
|
||||||
readable-stream "^3.6.0"
|
readable-stream "^3.6.0"
|
||||||
|
readdir-glob "^1.0.0"
|
||||||
tar-stream "^2.1.2"
|
tar-stream "^2.1.2"
|
||||||
zip-stream "^3.0.1"
|
zip-stream "^4.0.0"
|
||||||
|
|
||||||
are-we-there-yet@~1.1.2:
|
are-we-there-yet@~1.1.2:
|
||||||
version "1.1.5"
|
version "1.1.5"
|
||||||
|
|
@ -3718,15 +3718,15 @@ compose-function@3.0.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
arity-n "^1.0.4"
|
arity-n "^1.0.4"
|
||||||
|
|
||||||
compress-commons@^3.0.0:
|
compress-commons@^4.0.0:
|
||||||
version "3.0.0"
|
version "4.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/compress-commons/-/compress-commons-3.0.0.tgz#833944d84596e537224dd91cf92f5246823d4f1d"
|
resolved "https://registry.yarnpkg.com/compress-commons/-/compress-commons-4.0.1.tgz#c5fa908a791a0c71329fba211d73cd2a32005ea8"
|
||||||
integrity sha512-FyDqr8TKX5/X0qo+aVfaZ+PVmNJHJeckFBlq8jZGSJOgnynhfifoyl24qaqdUdDIBe0EVTHByN6NAkqYvE/2Xg==
|
integrity sha512-xZm9o6iikekkI0GnXCmAl3LQGZj5TBDj0zLowsqi7tJtEa3FMGSEcHcqrSJIrOAk1UG/NBbDn/F1q+MG/p/EsA==
|
||||||
dependencies:
|
dependencies:
|
||||||
buffer-crc32 "^0.2.13"
|
buffer-crc32 "^0.2.13"
|
||||||
crc32-stream "^3.0.1"
|
crc32-stream "^4.0.0"
|
||||||
normalize-path "^3.0.0"
|
normalize-path "^3.0.0"
|
||||||
readable-stream "^2.3.7"
|
readable-stream "^3.6.0"
|
||||||
|
|
||||||
concat-map@0.0.1:
|
concat-map@0.0.1:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
|
|
@ -3922,10 +3922,10 @@ cosmiconfig@^6.0.0:
|
||||||
path-type "^4.0.0"
|
path-type "^4.0.0"
|
||||||
yaml "^1.7.2"
|
yaml "^1.7.2"
|
||||||
|
|
||||||
crc32-stream@^3.0.1:
|
crc32-stream@^4.0.0:
|
||||||
version "3.0.1"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/crc32-stream/-/crc32-stream-3.0.1.tgz#cae6eeed003b0e44d739d279de5ae63b171b4e85"
|
resolved "https://registry.yarnpkg.com/crc32-stream/-/crc32-stream-4.0.0.tgz#05b7ca047d831e98c215538666f372b756d91893"
|
||||||
integrity sha512-mctvpXlbzsvK+6z8kJwSJ5crm7yBwrQMTybJzMw1O4lLGJqjlDCXY2Zw7KheiA6XBEcBmfLx1D88mjRGVJtY9w==
|
integrity sha512-tyMw2IeUX6t9jhgXI6um0eKfWq4EIDpfv5m7GX4Jzp7eVelQ360xd8EPXJhp2mHwLQIkqlnMLjzqSZI3a+0wRw==
|
||||||
dependencies:
|
dependencies:
|
||||||
crc "^3.4.4"
|
crc "^3.4.4"
|
||||||
readable-stream "^3.4.0"
|
readable-stream "^3.4.0"
|
||||||
|
|
@ -8725,7 +8725,7 @@ read@1, read@~1.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
mute-stream "~0.0.4"
|
mute-stream "~0.0.4"
|
||||||
|
|
||||||
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@^2.3.7, readable-stream@~2.3.6:
|
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6:
|
||||||
version "2.3.7"
|
version "2.3.7"
|
||||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
|
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
|
||||||
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
|
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
|
||||||
|
|
@ -8747,6 +8747,13 @@ read@1, read@~1.0.1:
|
||||||
string_decoder "^1.1.1"
|
string_decoder "^1.1.1"
|
||||||
util-deprecate "^1.0.1"
|
util-deprecate "^1.0.1"
|
||||||
|
|
||||||
|
readdir-glob@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/readdir-glob/-/readdir-glob-1.0.0.tgz#a495436934bbe57be6a68039d16e8946621eb8c5"
|
||||||
|
integrity sha512-km0DIcwQVZ1ZUhXhMWpF74/Wm5aFEd5/jDiVWF1Hkw2myPQovG8vCQ8+FQO2KXE9npQQvCnAMZhhWuUee4WcCQ==
|
||||||
|
dependencies:
|
||||||
|
minimatch "^3.0.4"
|
||||||
|
|
||||||
readdir-scoped-modules@^1.0.0:
|
readdir-scoped-modules@^1.0.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309"
|
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309"
|
||||||
|
|
@ -10749,11 +10756,11 @@ yargs@^14.2.2:
|
||||||
y18n "^4.0.0"
|
y18n "^4.0.0"
|
||||||
yargs-parser "^15.0.1"
|
yargs-parser "^15.0.1"
|
||||||
|
|
||||||
zip-stream@^3.0.1:
|
zip-stream@^4.0.0:
|
||||||
version "3.0.1"
|
version "4.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-3.0.1.tgz#cb8db9d324a76c09f9b76b31a12a48638b0b9708"
|
resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-4.0.2.tgz#3a20f1bd7729c2b59fd4efa04df5eb7a5a217d2e"
|
||||||
integrity sha512-r+JdDipt93ttDjsOVPU5zaq5bAyY+3H19bDrThkvuVxC0xMQzU1PJcS6D+KrP3u96gH9XLomcHPb+2skoDjulQ==
|
integrity sha512-TGxB2g+1ur6MHkvM644DuZr8Uzyz0k0OYWtS3YlpfWBEmK4woaC2t3+pozEL3dBfIPmpgmClR5B2QRcMgGt22g==
|
||||||
dependencies:
|
dependencies:
|
||||||
archiver-utils "^2.1.0"
|
archiver-utils "^2.1.0"
|
||||||
compress-commons "^3.0.0"
|
compress-commons "^4.0.0"
|
||||||
readable-stream "^3.6.0"
|
readable-stream "^3.6.0"
|
||||||
|
|
|
||||||
Reference in a new issue