- Django Project uploaded on Git
- AWS EC2 Account
This is a summary of how to start your own NextJS app, create the repo on Github, upload later in an AWS EC2 Instance and automate the process with AWS Codebuild, CodeDeploy, & CodePipeline.
After following these instructions you should be able to:
- Create a NextJS App
- Create an AWS EC2 instance
- Be able to SSH to an EC2 instance
- Prepare the instance as a Node environment
- Configure Nginx service for proper routing
- Configure domain and add SSL
Problem: tracked files not being ignored by an updated .gitignore
Solution: untrack the files first then .gitignore will ignore them after
git rm -r --cached . # untrack files, replace "." for any other directory
git add . # re-adding the files
git commit -m "issue fixed" # commiting changes
git push # pushing changes
This file contains hidden or 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
// taken from https://dev.to/austinshelby/you-are-reading-environment-variables-the-wrong-way-in-nextjs-45da | |
// helper function | |
const getEnvironmentVariable = (environmentVariable: string): string => { | |
const unvalidatedEnvironmentVariable = process.env[environmentVariable]; | |
if (!unvalidatedEnvironmentVariable) { | |
throw new Error( | |
`Couldn't find environment variable: ${environmentVariable}` | |
); | |
} else { |