-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from weaponsforge/wip/weaponsforge-53
Wip/weaponsforge 53
- Loading branch information
Showing
15 changed files
with
169 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
name: Deploy to Production Environment | ||
|
||
# This workflow deploys the backend, a full-server express app to Vercel | ||
# as opposed to their recommended approach of deploying serverless functions | ||
# using NextJS "pages/api". Vercel CLI v28.2.0 is used for deployment | ||
|
||
# This workflow will trigger on any tag/release created on *any* branch | ||
# Make sure to create tags/releases only from the "master" branch for consistency | ||
on: | ||
|
@@ -60,7 +64,7 @@ jobs: | |
npm install | ||
npm run lint | ||
deploy-docs: | ||
deploy-client: | ||
name: Deploy client to Github Pages | ||
needs: lint-client | ||
runs-on: ubuntu-latest | ||
|
@@ -77,3 +81,37 @@ jobs: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./ | ||
publish_branch: gh-pages | ||
|
||
deploy-server: | ||
name: Deploy Server to Vercel | ||
needs: lint-server | ||
runs-on: ubuntu-latest | ||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
- name: Use NodeJS v16.14.2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.14.2 | ||
- name: Install Vercel CLI | ||
run: npm install --global [email protected] | ||
- name: Pull Vercel Environment Information | ||
run: | | ||
cd server | ||
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | ||
- name: Build Project Artifacts | ||
run: | | ||
cd server | ||
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | ||
- name: Deploy Project Artifacts to Vercel | ||
run: | | ||
cd server | ||
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} | ||
- name: Post Deployment Clean-up | ||
run: | | ||
cd server | ||
rm -r -f .vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ node_modules/ | |
.vscode | ||
.env | ||
*.zip | ||
|
||
.vercel | ||
|
||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
ALLOWED_ORIGINS=http://localhost:3000 | ||
ALLOW_CORS=0 | ||
API_RATE_LIMIT=100 | ||
API_WINDOW_MS_MINUTES=15 | ||
MONGO_URI=mongodb://localhost/todo-next | ||
DEPLOYMENT_PLATFORM=regular |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules/ | ||
.env | ||
*.zip | ||
|
||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
node_modules/ | ||
*.env | ||
*.zip | ||
*.md | ||
*.toml | ||
|
||
.vercel | ||
.vscode | ||
.git | ||
.github | ||
.eslintrc.js | ||
.eslintignore | ||
.vercelignore | ||
package.json | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## api | ||
|
||
The `/api` directory is required by vercel when using the @latest `vercel.json` configuration file settings (for Vercel CLI v28.2.0 as of this writing). | ||
|
||
Ideally, this directory should contain **serverless functions** [written per file](https://vercel.com/guides/using-express-with-vercel#next.js) following the NextJS api pages writing guide, but we'd like to deploy a standalone full-server express app on vercel. | ||
|
||
### References | ||
|
||
[[1]](https://vercel.com/guides/using-express-with-vercel) - using express with vercel<br> | ||
[[2]](https://vercel.com/docs/project-configuration#project-configuration/functions) - project config with vercel.json | ||
|
||
@weaponsforge<br> | ||
20220828 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('dotenv').config() | ||
const app = require('../src/index') | ||
|
||
module.exports = app |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>401</title> | ||
</head> | ||
<body> | ||
<p>Unauthorized</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>404</title> | ||
</head> | ||
<body> | ||
<p>404 Not Found</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Todo Notes API</title> | ||
</head> | ||
<body> | ||
<p>Welcome to the Todo Notes API v1</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"rewrites": [ | ||
{ | ||
"source": "/api/(.*)", | ||
"destination": "/api" | ||
} | ||
], | ||
"redirects": [ | ||
{ | ||
"source": "/src(.*)", | ||
"destination": "/public/401.html" | ||
} | ||
] | ||
} |