@algea_care/pdf-service
v1.0.0
Published
The PDF service project, this project just serves PDF's does nothing else with em
Maintainers
Keywords
Readme
PDF Service
This is the PDF service, it is an ec2 container that just serves PDF's with an express server. You can pass a callback to call when then pdf is done. This is because PDF's can take a while to generate.
To use the service you need to pass a token that we check to make sure you have access to 'create' PDF's
System requirements
- Node
- AWS CLI
- Terraform CLI
Getting started 🏁
Before starting the project, check that an NPM token is set in the machine. Please make sure you are part of the company npm team, this way you will have access to the private packages.
To get started run these commands:
npm iinstall lerna and root depsnpm install --global cdktf-cli@latestmake sure you have cdktf (for infra as code) installednpm run bootstrapto install all the packages in all the folders.- ONCE per Stack
npm run deploy:backendto setup the bucket and table that holds the terraform state BEFOREdeploy npm run deploybuild and package the backend, then deploy the infra (auto confirm) with the new backend source code
for the first deploy of your stack you also need to be signed into NPM with access, check out the packages section of the readme for the why.
for an example of what sort of env vars you need, have a look at the git actions for staging and prod. and check the env.example files to see where to put them
Other commands you can do from root
npm run lintlint all the packages in packages folder
Structure
This repo is structured using lerna which is a package for managing packages. each folder in the packages folder can be thought of as a single npm package.
As such, each package is like a separate app that needs it's own env file and so on. There is an env.example file in each package with details on each config setting inside each package.
Backend
@TODO Murat: you can read more about it here
Infrastructure 🏘
The infra package is all about the aws infra that is deployed using cdktf
You can read about it here
Configuration 🔧
Each package contains a .env.example file giving instruction to set up the packages as they are needed. it is not ideal but we will do proper secret management and config generation soon. we just want to test the MVP right now. and when I say we will, I really mean it!
One important thing to remember that catches people out a fair bit is that the config vars in the backend folder are only used when running the test scripts that run on lambda local calls. The real env vars you will use for your stack that get set on the backend lambdas are the ones in the INFRA package, as this is the one that actually makes the lambdas, so it is the one that will set up the env config for the lambdas.
Deployments 🚀
For Staging deployments merge dev to main.
Deployments are done automatically via git actions, there is a workflow that will run tests first that run on all branches
for staging deployments simply merge the branch to main, terraform will deploy the rest! for production deployments, make a new tag for the repo, terraform will deploy it.
there are two git actions for these deploy_prod & deploy_staging both should have the env vars they need in git action secrets on the repo.
