bp-web project
Dev Setup
Software needed to be installed
- Install Open JDK 11
- Install MySQL.
https://dev.mysql.com/doc/refman/5.7/en/macos-installation-pkg.html
- Install Git and configure SSH to clone the project
Setup Project
- Clone project from https://github.com/byte-pushers/bp-web
git clone git@github.com:byte-pushers/bp-web.git
- Open project in IntelliJ Idea as Maven project
- Build Maven project
mvn clean install
- Verify database details in
application-local.properties
file
- Create new run configuration in IntelliJ Idea for Application
VM option: -Dspring.profiles.active=local
Main Class: software.bytepushers.bpweb.BpWebWsApplication
Class Path: -cp bp-web-ws
Refer screenshot:
- Run the above configuration
- To check local server status call following URL.
curl --location --request GET 'http://localhost:8080/api/v1/health'
- Use following postman collection and environment variable to validate local server.
Postman Collection: Bp-Web.postman_collection.json
Postman Environment: Bp-Web-local.postman_environment.json
Deploy to AWS Lambda
- AWS CLI should be configured for development environment.
- Following properties should be added in environment variable
- **DATASOURCE_URL
- JWT_TOKEN_SECRET
- DATASOURCE_USERNAME
- DATASOURCE_PASSWORD**
- HUBSPOT_BASE_URL
- HUBSPOT_DEVELOPERKEY
- Run following command and build the project
mvn clean install -P aws
- Run following command to copy jar file
cp ./bp-web-ws/target/bp-web-ws.jar ./bp-web-ws/target/bytepushers-bpweb-lambda.jar
- Copy jar file to AWS S3 bucket
aws s3 cp ./bp-web-ws/target/bytepushers-bpweb-lambda.jar s3://com.bytepushers.bpweb.ws/bytepushers-bpweb-lambda.jar
- Run this command to update AWS lambda code with the jar file from the S3 bucket
aws lambda update-function-code --publish --function-name bytepushers-bpweb-ws --s3-bucket com.bytepushers.bpweb.ws --s3-key bytepushers-bpweb-lambda.jar --region us-east-2
- To check AWS lambda status call following URL.
curl --location --request GET 'https://api-dev.bytepushers.io/api/v1/health'
- Use following postman collection and environment variable to validate AWS Lambda on development environment.
Postman Collection: Bp-Web.postman_collection.json
Postman Environment: Bp-Web-dev.postman_environment.json