- Public endpoint for ad-hoc request
- AWS CloudWatch to make a scheduler
- Postgres as data storage
- Build
make build
docker build . -t api-rest
- Run
make run
- Test
make rest
- Scan
make scan
- To deploy (1)
1. GOOS=linux GOARCH=amd64 go build -o main main.go
2. zip -r ./main.zip *
3. Upload to labmda function
- To deploy (2) via aws-cli
1. Build Image: docker build -t twitter-[version] .
2. Create RCR Repo: aws ecr create-repository --repository-name twitter-[version] --image-scanning-configuration scanOnPush=true
3. Tag image to repo: docker tag twitter-[version]:latest [ecr_repo_id].dkr.ecr.ap-southeast-1.amazonaws.com/twitter-twitter-[version]:latest
4. Login to ECR: aws ecr get-login-password | docker login --username AWS --password-stdin [ecr_repo_id].dkr.ecr.ap-southeast-1.amazonaws.com
5. Push Image to ECR: docker push [ecr_repo_id].dkr.ecr.ap-southeast-1.amazonaws.com/twitter-[version]:latest
6. To invoke: aws lambda invoke --function-name twitter output.txt
- Add env variables
export MONGO_URI=
export TWITTER_TOKEN=
export TWITTER_URL=https://api.twitter.com/
export SEARCH_PATH=2/tweets/search/recent
export COINS=btc,eth,sol,xtz
- Create postgres database and user in your local env.
- Make sure you setup file watchers in your idea.
- Before make a git push , please make sure you run
make scan
andmake test