Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions for deploying for staging #118

Open
2 of 4 tasks
MehulKChaudhari opened this issue Aug 14, 2024 · 2 comments
Open
2 of 4 tasks

Instructions for deploying for staging #118

MehulKChaudhari opened this issue Aug 14, 2024 · 2 comments
Assignees

Comments

@MehulKChaudhari
Copy link
Member

MehulKChaudhari commented Aug 14, 2024

Steps to deploy for staging

Note: Please use a different region than production so it interacts with the correct DB.

  1. Create a DB for staging.

    Tables in DynamoDB

    featureFlag

    Partition Key - id (string)

    featureFlagUserMapping

    Partition Key - userId (string)
    Sort Key - flagId (string)

    requestLimit

    Partition Key - limitType (String)

    no sort key here

Note
Indexes are not required

  1. log in with the administrator AWS account in AWS CLI. Then clone the feature flag backend project (https://github.com/Real-Dev-Squad/feature-flag-backend) and run sam pipeline init --bootstrap.
    https://www.youtube.com/watch?v=jBCf8g7VXhw This video will guide you with the command specifics (Just for reference).

Steps after running sam pipeline init --bootstrap

  • image
image
image

After completing the command setup, you already created a user in your AWS whose AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are displayed on your screen.

  • It asks if we want to modify the pipeline as it already exists select: No

After completion of this, it displays the stack name, pipeline Execution Role, Cloud Formation Execution Role, artifact Bucket. Use all in actions env's.

Update the keys you got in the Github secrets.

Permission to add:

  1. Create a policy Named: feature-flag-lambda-db-role and Add this policy to all the Lambda's as it update values in DB and invokes rate limiter lamda.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "dynamodb:BatchGetItem",
                "dynamodb:GetItem",
                "dynamodb:Query",
                "dynamodb:Scan",
                "dynamodb:BatchWriteItem",
                "dynamodb:PutItem",
                "dynamodb:UpdateItem"
            ],
            "Resource": "arn:aws:dynamodb:us-east-1:181388287005:table/*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": "arn:aws:logs:us-east-1:181388287005:*"
        },
        {
            "Effect": "Allow",
            "Action": "logs:CreateLogGroup",
            "Resource": "arn:aws:logs:us-east-1:181388287005:*"
        },
        {
            "Sid": "InvokePermission",
            "Effect": "Allow",
            "Action": [
                "lambda:InvokeFunction"
            ],
            "Resource": "arn:aws:lambda:us-east-1:181388287005:function:feature-flag-staging*"
        }
    ]
}
  1. Add this policy to Rate Limiter and Reset Limit Lambda roles:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "lambda:PutFunctionConcurrency",
                "lambda:DeleteFunctionConcurrency"
            ],
            "Resource": "arn:aws:lambda:us-east-1:181388287005:function:feature-flag-staging*"
        }
    ]
}

As we change the concurrency of the other Lamda's when limit is reached to close the lambda's and reset the limit and start all the lambda's again.

Things to do:

  • Create a pipeline using sam pipeline --bootstrap.
  • Add Secret keys in Github Secrets.
  • Add Permissions Below manually.
  • Change the Physical ID of lambda's in template.yaml.
@prakashchoudhary07
Copy link
Contributor

@MehulKChaudhari

In between setup, you are asking to watch a YouTube video of 25 minutes to do the setup.
Can you please mention all the steps required in the issue itself? I don't want to watch the YouTube video here that is 25 minutes long

@MehulKChaudhari
Copy link
Member Author

MehulKChaudhari commented Aug 28, 2024

@MehulKChaudhari

In between setup, you are asking to watch a YouTube video of 25 minutes to do the setup. Can you please mention all the steps required in the issue itself? I don't want to watch the YouTube video here that is 25 minutes long

@prakashchoudhary07 Sir, That video is for reference. I will make it better till tomorrow and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants