mirror of
https://github.com/aljazceru/payments-rest-api.git
synced 2026-01-14 19:14:25 +01:00
fly poc
This commit is contained in:
6
lambda/dev/DEV.md
Normal file
6
lambda/dev/DEV.md
Normal file
@@ -0,0 +1,6 @@
|
||||
## Deploy lambda function
|
||||
If you want to deploy your own changes directly to lambda you can use [deploy.sh](./deploy.sh) to package and deploy it for you. Tested on linux.
|
||||
|
||||
Requirements:
|
||||
- aws cli installed and configured (instructions in [README.md](./README.md))
|
||||
- python3.12 and pip installed
|
||||
28
lambda/dev/INFRASTRUCTURE.md
Normal file
28
lambda/dev/INFRASTRUCTURE.md
Normal file
@@ -0,0 +1,28 @@
|
||||
### Code deployment
|
||||
New code is automatically packaged and deployed to Breez's S3 bucket for public consumption.
|
||||
|
||||
|
||||
### Create S3 bucket
|
||||
```
|
||||
aws s3api create-bucket --bucket breez-nodeless-payment --acl public-read
|
||||
aws s3api delete-public-access-block --bucket breez-nodeless-payment
|
||||
aws s3api put-bucket-policy --bucket breez-nodeless-payment --policy '{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "PublicReadGetObject",
|
||||
"Effect": "Allow",
|
||||
"Principal": "*",
|
||||
"Action": "s3:GetObject",
|
||||
"Resource": "arn:aws:s3:::breez-nodeless-payment/*"
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
### Create user for github actions upload
|
||||
```
|
||||
aws iam create-user --user-name github-actions-user
|
||||
aws iam put-user-policy --user-name github-actions-user --policy-name S3UploadPolicy --policy-document file://github-actions-policy.json
|
||||
aws iam create-access-key --user-name github-actions-user
|
||||
```
|
||||
30
lambda/dev/deploy.sh
Normal file
30
lambda/dev/deploy.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
FUNCTION_NAME="BreezLambda" # Match the FunctionName in CloudFormation
|
||||
ZIP_FILE="lambda.zip"
|
||||
|
||||
# Install dependencies
|
||||
echo "Installing dependencies..."
|
||||
mkdir -p package
|
||||
pip install -r requirements.txt -t package/
|
||||
|
||||
# Package the function
|
||||
echo "Packaging the function..."
|
||||
cp lambda_function.py package/
|
||||
cd package
|
||||
zip -r ../$ZIP_FILE .
|
||||
cd ..
|
||||
|
||||
# Update Lambda function code directly
|
||||
echo "Updating Lambda function code..."
|
||||
aws lambda update-function-code \
|
||||
--function-name $FUNCTION_NAME \
|
||||
--zip-file fileb://$ZIP_FILE
|
||||
|
||||
# Clean up
|
||||
rm -rf package
|
||||
rm $ZIP_FILE
|
||||
|
||||
echo "Deployment complete!"
|
||||
|
||||
20
lambda/dev/github-actions-policy.json
Normal file
20
lambda/dev/github-actions-policy.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "AllowS3Upload",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:PutObject",
|
||||
"s3:PutObjectAcl"
|
||||
],
|
||||
"Resource": "arn:aws:s3:::breez-nodeless-payment/*"
|
||||
},
|
||||
{
|
||||
"Sid": "AllowListBucket",
|
||||
"Effect": "Allow",
|
||||
"Action": "s3:ListBucket",
|
||||
"Resource": "arn:aws:s3:::breez-nodeless-payment"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user