Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
feat(CORE): initial commit

Initial Commit

Initial Commit

Initial Commit

Initial Commit

Initial Commit

Initial Commit

update readme.md

update readme.md

update readme.md

update readme.md

update readme.md

update readme.md

update readme.md

fix lamnda index

fix(CORE): initial commit, first commit

fix(PROJECT): update .gitignore file

fix(PROJECT): update .gitignore file

fix(PROJECT): add tsconfig.json

fix(PROJECT): add .env.local file

fix(PROJECT): add .env.local file

fix(PROJECT): add .env.local file

fix(PROJECT): add .env.local file

fix(PROJECT): add .env.local file

fix(PROJECT): add .env.local file

fix(PROJECT): add .env.local file
  • Loading branch information
Eliezer Rangel committed Jun 30, 2024
1 parent 807c73e commit c34032f
Show file tree
Hide file tree
Showing 112 changed files with 37,601 additions and 104 deletions.
12 changes: 12 additions & 0 deletions .cfnlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
templates:
- "cdk.out/*.template.json"
include_checks:
- I
ignore_checks:
- W3005
- I1022
- I6010
- W2001
- E3002
- I1002
- I3010
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true


[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
11 changes: 11 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ENV_REGION_ID=us-east-1
# this will be the aws account number where the project is going to be deployed
ENV_ACCOUNT_ID=000000000000


# this will be the folder where the report tempates will be stored
FS_STORE_AWS_S3_PERSISTENCE_PREFIX=testReports


FS_AUTHENCATION_ADMIN_USERNAME=admin
FS_AUTHENCATION_ADMIN_PASSWORD=password
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
*.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out

.env
5 changes: 5 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[settings]
line_length = 88
multi_line_output = 3
include_trailing_comma = True
known_third_party =
6 changes: 0 additions & 6 deletions .npmignore

This file was deleted.

90 changes: 90 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_install_hook_types: [pre-commit, post-commit, commit-msg]
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
stages: [commit]
- id: end-of-file-fixer
stages: [commit]
- id: check-symlinks
stages: [commit]
- id: check-yaml
stages: [commit]
exclude: (template|ci).*\.(json|yml|yaml)$
- id: check-added-large-files
stages: [commit]
args: [--maxkb=10000]
- id: mixed-line-ending
args: [--fix=lf]
stages: [commit]
- id: detect-aws-credentials
args: [--allow-missing-credentials]
stages: [commit]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v9.0.0' # Use the sha / tag you want to point at
hooks:
- id: eslint
exclude: .*\.(postcssrc|eslintrc).(js)
args: ['--fix']
stages: [commit]
verbose: true

- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: 'v9.16.0'
hooks:
- id: commitlint
stages: [commit-msg]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v4.0.0-alpha.8' # Use the sha or tag you want to point at
hooks:
- id: prettier
stages: [commit]
always_run: true
exclude: >
(?x)^(
(.*)/static/vendors|
(.*)/static/ico|
^.+\.html$|
^.+\.d.ts$|
cdk.out\**$|
package-lock.json|
yarn.lock|
CHANGELOG.md|
(.*)\.vtl$|
^\*\\__test__\\\*\*\.test\.\*$|
^.+\.min\.(js|css)$
)$
additional_dependencies:
- [email protected]

- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
args: [--exclude=templates/]
stages: [commit]

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1 # Use the revision sha / tag you want to point at
hooks:
- id: isort
files: ^source/
types: [file, python]
stages: [commit]

- repo: https://github.com/1davidmichael/pre-commit-cdk-synth
rev: v0.0.2
hooks:
- id: cdk-synth
stages: [commit]

- repo: https://github.com/aws-cloudformation/cfn-lint
rev: v0.86.2 # The version of cfn-lint to use
hooks:
- id: cfn-lint-rc
stages: [commit]
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
39 changes: 39 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"header": "Changelog",
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"hidden": true
},
{
"type": "docs",
"hidden": true
},
{
"type": "style",
"hidden": true
},
{
"type": "refactor",
"hidden": true
},
{
"type": "perf",
"hidden": true
},
{
"type": "test",
"hidden": true
}
],
"commitUrlFormat": "https://github.com/eliecer2000/jsreport-aws-app/commits/{{hash}}",
"compareUrlFormat": "https://github.com/eliecer2000/jsreport-aws-app/branches/compare/{{previousTag}}%0D{{currentTag}}"
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cSpell.words": ["apprunner", "jsreport", "sparticuz"]
}
147 changes: 137 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,141 @@
# Welcome to your CDK TypeScript project
# JSReport on AWS (WIP)

This is a blank project for CDK development with TypeScript.
This repository provides the necessary resources and deployment scripts to set up JSReport Studio and report generation capabilities using AWS Lambda. The project aims to simplify the deployment process, ensuring that you can quickly get up and running with JSReport on AWS.

The `cdk.json` file tells the CDK Toolkit how to execute your app.
This project is inspired by the jsreport documentation, where it is specified how to work with lambdas functions and/or EC2 instances.

## Useful commands
After some searching I could not find a project that combined the functionality that exists for AWS, persistence of the template in S3, persistence of the output report in S3, and of course a lambda for the requesting of reports, in this project apart from this also integrated the possibility of having a container is JSReport Studio already configured to create or modify new templates.

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `npx cdk deploy` deploy this stack to your default AWS account/region
* `npx cdk diff` compare deployed stack with current state
* `npx cdk synth` emits the synthesized CloudFormation template
**Referencias**

- [JSReport documentation](https://jsreport.net/learn)

- [Template stores](https://jsreport.net/learn/template-stores)

- [Blob storage](https://jsreport.net/learn/blob-storages)

- [Reports extension](https://jsreport.net/learn/reports)

## Features

- Automated deployment of JSReport Studio on AWS
- Serverless report generation using AWS Lambda
- Integration with AWS services such as S3, Lambda, App Rummer, and CloudFormation
- Scalable and cost-efficient architecture

## Requirements

- AWS account with necessary permissions
- AWS CLI configured
- Node.js and npm installed locally

## Getting Started

1. **Clone the repository**:

```sh

git clone https://github.com/eliecer2000/jsreport-aws-app.git
```

2. **Navigate to the project directory**:

```sh

cd jsreport-aws-app
npm install

```

3. **Configure your AWS credentials**:

Make sure your AWS CLI is configured with the necessary permissions to deploy resources.

```sh
aws configure
# or in case of using SSO
aws configure sso
```

4. **Environmental Variables**:

You must create from the sample .env.local file a file containing your project data.

```sh
ENV_REGION_ID=us-east-1
# this will be the aws account number where the project is going to be deployed
ENV_ACCOUNT_ID=000000000000


# this will be the folder where the report tempates will be stored
FS_STORE_AWS_S3_PERSISTENCE_PREFIX=testReports


FS_AUTHENTICATION_ADMIN_USERNAME=admin
FS_AUTHENTICATION_ADMIN_PASSWORD=password

```

5. **Deploy the infrastructure**:

Use the provided CloudFormation template or deployment scripts to set up the infrastructure on AWS.

```sh
# recommend using the flag --require-approval=never
cdk deploy --all --require-approval=never

```

6. **Access JSReport Studio**:

Once the deployment is complete, you can access JSReport Studio through the provided endpoint.

```sh

...
...


✅ DockerJsReportServerStack-xxx

✨ Deployment time: 1.13s

Outputs:
DockerJsReportServerStack-xxx.app-runner-url = https://XXXXXXXXXXX.us-east-1.awsapprunner.com # this is the endpoint
Stack ARN:
arn:aws:cloudformation:us-xxxx-x:XXXXXXXXXXXX:stack/DockerJsReportServerStack-xxx

...
...


```

## Usage

JSReport Studio

Access the JSReport Studio through the deployed endpoint to create and manage your reports.

## Report Generation

Invoke the AWS Lambda function with the required parameters to generate reports dynamically.

To invoke the lambda function you can use the contents of the `event.json` file

## Future Features

- User Management: Integration with AWS Cognito for user authentication and management.
- Template permanence: Integrate DynamoDB for template data persistence.
- AutoScaling Configuration: Change App Runner AutoScaling configuration to optimize service costs.
- App Runner Timeout: Implement auto pause of App Runner service to optimize costs while the infrastructure is not in use.
- Report download: provide as optional the download link to the file saved in the s3 bucket.
- Enhanced Security: Implementation of advanced security features and best practices (cfn_nag).

## Contributions are welcome!

Please fork this repository and submit pull requests with your improvements.

## License

This project is licensed under the MIT License - see the LICENSE file for details.
Loading

0 comments on commit c34032f

Please sign in to comment.