Start project: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Start Project For Beginner = | = Start Project For Beginner = | ||
== | == Prepare project to local == | ||
* BitBucket account. | * BitBucket account. | ||
Line 18: | Line 18: | ||
# sudo dnf install openssh-clients | # sudo dnf install openssh-clients | ||
# ssh -V | # ssh -V | ||
# ssh-keygen -t ed25519 -b 4096 -C " | # ssh-keygen -t ed25519 -b 4096 -C "penpitcha4289@gmail.com" -f penpitcha_workspace | ||
# or # ssh-keygen -t ed25519 -b 4096 -C "penpitcha4289@gmail.com" | |||
add SSH key in key.pub that generate above into SSH of repository in BitBucket | add SSH key in key.pub that generate above into SSH of repository in BitBucket | ||
<br>https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-linux/ | <br>https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-linux/ | ||
== | == Prepare resource and app == | ||
Example Data for project: https://izara.io/wiki/index.php/Service_-_Product_Manager | Example Data for project: https://izara.io/wiki/index.php/Service_-_Product_Manager | ||
* install package | * install package | ||
Line 38: | Line 39: | ||
* [[SQS DSQ Hdr]] | * [[SQS DSQ Hdr]] | ||
== | == Set initial setup == | ||
in app/initial_setup | in app/initial_setup | ||
* [[initial_setup]] | * [[initial_setup]] | ||
== | == Start deploy to AWS server == | ||
* in config | * in config | ||
# iz_serviceName for beginner test => Service{YourName} ex: ServicePraew => if your project => ProductManager | # iz_serviceName for beginner test => Service{YourName} ex: ServicePraew => if your project => ProductManager | ||
Line 87: | Line 88: | ||
Example request for test Api|Sqs|Dqs handler | Example request for test Api|Sqs|Dqs handler | ||
* [[Test]] | * [[Test]] | ||
== Task == | |||
* add Get|Delete|Update Product_Main Lambda for Api Handler | |||
* create lambda that send msg to each lambda in same service | |||
# lambda => sns => sqs => lambda => maybe use handler Sqs | |||
# lambda => sqs => lambda => maybe use handler Dsq | |||
* apply for use Inv Handler | |||
# lambda_1 will invoke lambda_2 to get data that return to lambda_1 | |||
## ex: lambda_1 => inv => lambda_2 => lambda_2 will return data => lambda_1 | |||
code example for use inv lambda: | |||
<syntaxhighlight lang="JavaScript"> | |||
let payload = { | |||
param: param | |||
} | |||
let lambda_2Record = await lambda.invokeSync( | |||
_izContext, | |||
lambdaSharedLib.lambdaFunctionName("Lambda_2_HdrInv"), //externalServiceName if inv|send msg external service need to put service that get data | |||
payload | |||
); | |||
</syntaxhighlight> |
Latest revision as of 06:03, 26 October 2023
Start Project For Beginner
Prepare project to local
- BitBucket account.
- fork repository to own workspace
- clone repository to local
git clone git@bitbucket.org:your_repository_path.git
- Local Computer add workspace in VS code.
- open VS Code => File/Add Folder to Workspace...
- choose your project
- set SSH of BitBucket
- sudo apt update && sudo apt install openssh-client
- sudo dnf install openssh-clients
- ssh -V
- ssh-keygen -t ed25519 -b 4096 -C "penpitcha4289@gmail.com" -f penpitcha_workspace
- or # ssh-keygen -t ed25519 -b 4096 -C "penpitcha4289@gmail.com"
add SSH key in key.pub that generate above into SSH of repository in BitBucket
https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-linux/
Prepare resource and app
Example Data for project: https://izara.io/wiki/index.php/Service_-_Product_Manager
- install package
example: in app
npm i @izara_project/izara-middleware
npm i @izara_project/izara-shared
//* install more see in package.json
Example:
Set initial setup
in app/initial_setup
Start deploy to AWS server
- in config
- iz_serviceName for beginner test => Service{YourName} ex: ServicePraew => if your project => ProductManager
- iz_region for beginner test will use region => ap-southeast-2 //sydney => if your project will use region => us-east-2
- Config credentials aws, can run on home directory
- check version
sls --version
aws --version
- Install the AWS CLI version 2 (window)
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
ref: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html
- find Access Key and Secret Access Key
create Access key 1 from AWS server => User => your User Name
- configuration
aws configure
show:
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE // ***YOUR ID
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY //***YOUR KEY
Default region name [None]: us-east-2 // Ohio
Default output format [None]: json
- deploy repository
deploy resource before app
sls deploy --verbose
Test
Example request for test Api|Sqs|Dqs handler
Task
- add Get|Delete|Update Product_Main Lambda for Api Handler
- create lambda that send msg to each lambda in same service
- lambda => sns => sqs => lambda => maybe use handler Sqs
- lambda => sqs => lambda => maybe use handler Dsq
- apply for use Inv Handler
- lambda_1 will invoke lambda_2 to get data that return to lambda_1
- ex: lambda_1 => inv => lambda_2 => lambda_2 will return data => lambda_1
code example for use inv lambda:
let payload = {
param: param
}
let lambda_2Record = await lambda.invokeSync(
_izContext,
lambdaSharedLib.lambdaFunctionName("Lambda_2_HdrInv"), //externalServiceName if inv|send msg external service need to put service that get data
payload
);