Skip to content

Commit

Permalink
Merge pull request #88 from TrueSparrowSystems/milestone/v0.2.0
Browse files Browse the repository at this point in the history
New API Endpoints, AWS Secrets and Security Updates
  • Loading branch information
AMAN-BARBARIA authored Aug 31, 2023
2 parents a15a087 + e37954b commit 39190a6
Show file tree
Hide file tree
Showing 303 changed files with 14,120 additions and 5,251 deletions.
42 changes: 39 additions & 3 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,51 @@ on:
pull_request:
branches:
- master
- milestone/*

env:
ENVIRONMENT: test
AWS_ACCESS_KEY_ID: local
AWS_SECRET_ACCESS_KEY: local
AWS_ACCESS_KEY_ID: ${{ secrets.PLG_PROD_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PLG_PROD_SECRET_KEY }}
AWS_REGION: us-east-1

jobs:
test:
runs-on: ubuntu-latest
services:
memcached:
image: memcached:1.6.21
ports:
- 11211:11211

dynamodb:
image: amazon/dynamodb-local:latest
ports:
- 8000:8000

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'

- name: Build Custom docker file for KMS
run: |
echo "Building docker image"
docker build -t local-kms -f Dockerfile.github .
echo "Starting docker container for local-kms"
docker run -d --name localkms -p 4599:8080 -e AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} -e AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} -e AWS_REGION=us-east-1 -e KMS_ACCOUNT_ID=111122223333 -e KMS_REGION=us-east-1 -e KMS_SEED_PATH=seed.yaml local-kms
- name: Log into Docker Container
run: |
echo "Checking seed path"
seed_path=$(docker exec localkms ls /init)
echo "Seed path: $seed_path"
- run: |-
echo "Running test cases"
echo "Start: run test cases"
sh ./mvnw clean test
echo "Done: run test cases"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ build/
### Environment Variables ###
.env
set*_env_vars.sh
secrets.json
test.secrets.json

### Logs files ###
*.log
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile.github
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM nsmithuk/local-kms

EXPOSE 8080

# Add a file to the image
WORKDIR /init
COPY init/seed.yaml /init
21 changes: 13 additions & 8 deletions Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
FROM openjdk:17-jdk-alpine
# Set working directory
# Use the openjdk 17 with alpine as a base image
FROM openjdk:17-jdk-alpine as builder

# Create and set the working directory inside the container
RUN mkdir -p /app
WORKDIR /app

COPY . /app
# Install bash for Alpine and other necessary tools
RUN apk add --no-cache bash maven

# Expose port 8080 for the app to listen on
EXPOSE 8080
# Start the app
RUN apk add --no-cache bash
# Copy the pom.xml and download dependencies
COPY ./pom.xml ./pom.xml
RUN mvn dependency:go-offline

CMD ["sh", "-c", "start_local.sh"]
# Copy the rest of the application
COPY ./ ./

# Expose the port 8080 for the application
EXPOSE 8080
60 changes: 0 additions & 60 deletions LOCAL_SETUP.md

This file was deleted.

17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@
This repository contains salessparrow apis.

## Local Setup
Please follow the steps in [LOCAL_SETUP](LOCAL_SETUP.md) to setup the project locally.
Follow the steps in [LOCAL_SETUP](repo-docs/LOCAL_SETUP.md) to setup the project locally.

## Environment Variables
Refer to [ENVIRONMENT_VARS](repo-docs/ENVIRONMENT_VARS.md) for detailed descriptions for the environment variables.

## Project Structure
Please refer to [PROJECT_STRUCTURE](PROJECT_STRUCTURE.md) for details on the project structure.
Refer to [PROJECT_STRUCTURE](repo-docs/PROJECT_STRUCTURE.md) for details on the project structure.

## Changelog
Stay up-to-date with the latest changes and improvements in our API by referring to our [CHANGELOG](repo-docs/CHANGELOG.md).

## Release Process
Refer to [RELEASE_PROCESS](repo-docs/RELEASE_PROCESS.md) to ensure smooth and consistent software releases. This process outlines the steps to prepare, package, and distribute new versions of our software.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contributing
Contributions to the project are welcome! Please see our guidelines on how to [CONTRIBUTE](CONTRIBUTING.md).
Contributions to the project are welcome! Please see our guidelines on how to [CONTRIBUTE](repo-docs/CONTRIBUTING.md).

## Code of Conduct
This project has a code of conduct that outlines expected behavior for contributors and users. Please read the [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) file before getting involved.
This project has a code of conduct that outlines expected behavior for contributors and users. Please read the [CODE_OF_CONDUCT](repo-docs/CODE_OF_CONDUCT.md) file before getting involved.
71 changes: 58 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,83 @@
version: '3'
version: "3"
services:
# App server provisioning
api:
build:
context: .
dockerfile: Dockerfile.local
ports:
- '8080:8080'
- "8080:8080"
networks:
- localdev
volumes:
- './:/app'
command: bash -c 'sh start_local.sh'
- "./:/app"
- "~/.m2:/root/.m2"
environment:
- ENVIRONMENT=development
- AWS_ACCESS_KEY_ID=local
- AWS_SECRET_ACCESS_KEY=local
- AWS_REGION=us-east-1
command: ["./mvnw", "spring-boot:run"]
depends_on:
- dynamodb
- localkms
- memcached

test:
build:
context: .
dockerfile: Dockerfile.local
ports:
- "8080:8080"
networks:
- localdev
volumes:
- "./:/app"
- "~/.m2:/root/.m2"
environment:
- ENVIRONMENT=local-test
- AWS_ACCESS_KEY_ID=local
- AWS_SECRET_ACCESS_KEY=local
- AWS_REGION=us-east-1
command: ["./mvnw", "clean", "test", "jacoco:report"]
depends_on:
- dynamodb
- localkms
- memcached

# Memcached provisioning
memcached:
image: memcached
ports:
- '11211:11211'
- "11211:11211"
networks:
- localdev

# DynamoDB provisioning

localkms:
image: nsmithuk/local-kms
ports:
- "4599:8080"
volumes:
- ./init:/init
networks:
- localdev
environment:
- AWS_ACCESS_KEY_ID='local'
- AWS_SECRET_ACCESS_KEY='local'
- AWS_REGION='us-east-1'
- KMS_ACCOUNT_ID='111122223333'
- KMS_REGION='us-east-1'
- KMS_SEED_PATH=init/seed.yaml

dynamodb:
image: amazon/dynamodb-local:latest
ports:
- '8000:8000'
- "8000:8000"
networks:
- localdev
volumes:
- "./docker/dynamodb:/home/dynamodblocal/data"
- "./docker/dynamodb:/home/dynamodblocal/data"
working_dir: /home/dynamodblocal
command: '-jar DynamoDBLocal.jar -sharedDb -dbPath ./data'
command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data"

networks:
localdev:
driver: bridge
driver: bridge
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 48 files
+19 −1 README.md
+ architectureDiagram.png
+49 −0 dbSchema.dbml
+60 −0 flowDiagrams/Android/AccountDetailScreen.mermaid
+32 −0 flowDiagrams/Android/AccountSearchScreen.mermaid
+30 −0 flowDiagrams/Android/createNote.mermaid
+66 −0 flowDiagrams/Android/login.mermaid
+23 −0 flowDiagrams/Android/settingScreen.mermaid
+58 −0 flowDiagrams/IOS/AccountDetailScreen.mermaid
+32 −0 flowDiagrams/IOS/AccountSearchScreen.mermaid
+35 −0 flowDiagrams/IOS/CreateNoteScreen.mermaid
+68 −0 flowDiagrams/IOS/login.mermaid
+24 −0 flowDiagrams/IOS/userAccountDetailScreen.mermaid
+197 −0 openApiSpecifications/AccountNotes.yaml
+166 −0 openApiSpecifications/AccountTasks.yaml
+142 −0 openApiSpecifications/Accounts.yaml
+33 −0 openApiSpecifications/Auth/Disconnect.yaml
+38 −0 openApiSpecifications/Auth/Logout.yaml
+115 −0 openApiSpecifications/Auth/Salesforce.yaml
+257 −0 openApiSpecifications/Components.yaml
+64 −0 openApiSpecifications/CrmOrganizationUser.yaml
+58 −0 openApiSpecifications/Suggestions.yaml
+46 −0 openApiSpecifications/Users.yaml
+15 −0 openApiSpecifications/index.md
+30 −0 postman/AI-Sales-Sparrow-local.postman_environment.json
+553 −0 postman/AI-Sales-Sparrow.postman_collection.json
+98 −0 salesforceConfigurationGuide.md
+42 −0 salesforceConnectedAppSetup.md
+72 −0 sequenceDiagrams/AccountNotes/CreateNote.mermaid
+70 −0 sequenceDiagrams/AccountNotes/DeleteNote.mermaid
+104 −0 sequenceDiagrams/AccountNotes/GetNoteById.mermaid
+96 −0 sequenceDiagrams/AccountNotes/GetNotesList.mermaid
+78 −0 sequenceDiagrams/AccountTasks/CreateTask.mermaid
+76 −0 sequenceDiagrams/AccountTasks/DeleteTask.mermaid
+77 −0 sequenceDiagrams/AccountTasks/GetTasksList.mermaid
+69 −0 sequenceDiagrams/Accounts/GetAccounts.mermaid
+93 −0 sequenceDiagrams/Accounts/GetAccountsFeed.mermaid
+90 −0 sequenceDiagrams/Auth/Disconnect.mermaid
+30 −0 sequenceDiagrams/Auth/Logout.mermaid
+37 −0 sequenceDiagrams/Auth/RedirectUrl.mermaid
+154 −0 sequenceDiagrams/Auth/SalesforceConnect.mermaid
+113 −0 sequenceDiagrams/Common/OAuthRequestHelper.mermaid
+45 −0 sequenceDiagrams/Common/SalesforceOAuthApiFlow.mermaid
+60 −0 sequenceDiagrams/Common/UserAuthIntercepter.mermaid
+75 −0 sequenceDiagrams/CrmOrganizationUser/GetCrmOrganizationUsers.mermaid
+75 −0 sequenceDiagrams/Suggestions/GetCrmActionSuggestions.mermaid
+26 −0 sequenceDiagrams/User/GetCurrentUser.mermaid
+33 −0 sequenceDiagrams/index.md
17 changes: 17 additions & 0 deletions init/seed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is used to seed the local KMS instance with keys and aliases.
# The keys and aliases defined here will be created when the KMS instance is
# first started. If the keys or aliases already exist, they will not be
# modified.
# This is for testing purposes only.

Keys:
Symmetric:
Aes:
- Metadata:
KeyId: bc436485-5092-42b8-92a3-0aa8b93536dc
BackingKeys:
- 5cdaead27fe7da2de47945d73cd6d79e36494e73802f3cd3869f1d2cb0b5d7a9

Aliases:
- AliasName: alias/testing
TargetKeyId: bc436485-5092-42b8-92a3-0aa8b93536dc
Loading

0 comments on commit 39190a6

Please sign in to comment.