This project has been made open source after discontinuing support. This was my first larger go project and my first project that leaned heavily into AWS Lambda. My goal was to get more familiar with MongoDB, Go, Auth0, and Lambda. If I had to redo this, I'd probably use Laravel + Sanctum rather than Go+Auth0 and host it on an ec2 instance with a MySQL database.
buttons get:
rounded-3xl bg-redbg drop-shadow-lg
npm run buildinside root will automatically run make andnpm buildinside frontendnpm run deployinside root will automatically run the 2 sls scripts to deploy to lambda and s3
- If lambda randomly starts sending 502, check to make sure that mongo db is open to access
- Make sure to run
npm installto install all of the packages. When you encounter an error first tryrm -rf node_modles && npm installto refresh all packages - To build tailwinds css
npm run build:css - To start web app
npm run start
- Make sure .env is populated in the root directory with the proper mongodb connection string
- Run
go run localdev.goto start local web server
- local dev go reads
ALLOWED_ORIGINprod does as well but that's managed in aws (aws ssm put-parameter --name "/ATFGUNDBMiddleware/config/allowed_origin" --type "String" --value "https://dashboard.atfgundb.com" --overwrite) --- NO TRAILING SLASH!!!! - local dev go reads
MONGO_URLprod does same as #1
- Need to have aws cli
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"sudo installer -pkg AWSCLIV2.pkg -target / - Need to have serverless
npm install -g serverless - Need serverless finch
npm install --save serverless-finch
- Run
maketo build the aws go file sls deployuploads go file to lambda- Run
npm run buildinside of frontend sls client deployto push to bucket
- May need to run
aws configureand add the keys - Initially had to set the proper parameter name with
aws ssm put-parameter --name "/ATFGUNDBMiddleware/config/allowed_origin" --type "String" --value "X.X.X.X" - Serverless was being finicky so had to add aws creds this way
serverless config credentials --provider aws --key XXXXXXXX --secret "YYYYYYYYYY"
Guide followed from: https://www.kantega.no/blogg/running-go-and-react-on-aws-using-lambda