Loading...
Loading...
Compare original and translation side by side
undefinedundefined
```yaml
```yamlundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedsteps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push Docker image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Update ECS service
run: |
aws ecs update-service \
--cluster $ECS_CLUSTER \
--service $ECS_SERVICE \
--force-new-deployment
- name: Wait for deployment
run: |
aws ecs wait services-stable \
--cluster $ECS_CLUSTER \
--services $ECS_SERVICE
- name: Notify deployment
if: always()
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Evernote Integration deployed: ${{ job.status }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}undefinedsteps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push Docker image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Update ECS service
run: |
aws ecs update-service \
--cluster $ECS_CLUSTER \
--service $ECS_SERVICE \
--force-new-deployment
- name: Wait for deployment
run: |
aws ecs wait services-stable \
--cluster $ECS_CLUSTER \
--services $ECS_SERVICE
- name: Notify deployment
if: always()
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Evernote Integration deployed: ${{ job.status }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}undefinedundefinedundefinedundefinedundefined// serverless.yml
service: evernote-integration
provider:
name: aws
runtime: nodejs20.x
stage: ${opt:stage, 'dev'}
region: us-east-1
environment:
NODE_ENV: production
EVERNOTE_SANDBOX: false
iam:
role:
statements:
- Effect: Allow
Action:
- secretsmanager:GetSecretValue
Resource:
- !Sub arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:evernote/*
functions:
oauth:
handler: src/handlers/oauth.handler
events:
- http:
path: /auth/evernote
method: get
- http:
path: /auth/evernote/callback
method: get
createNote:
handler: src/handlers/notes.create
events:
- http:
path: /notes
method: post
authorizer:
type: COGNITO_USER_POOLS
authorizerId: !Ref ApiGatewayAuthorizer
searchNotes:
handler: src/handlers/notes.search
events:
- http:
path: /notes/search
method: get
authorizer:
type: COGNITO_USER_POOLS
authorizerId: !Ref ApiGatewayAuthorizer
plugins:
- serverless-offline
- serverless-prune-plugin
custom:
prune:
automatic: true
number: 3// serverless.yml
service: evernote-integration
provider:
name: aws
runtime: nodejs20.x
stage: ${opt:stage, 'dev'}
region: us-east-1
environment:
NODE_ENV: production
EVERNOTE_SANDBOX: false
iam:
role:
statements:
- Effect: Allow
Action:
- secretsmanager:GetSecretValue
Resource:
- !Sub arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:evernote/*
functions:
oauth:
handler: src/handlers/oauth.handler
events:
- http:
path: /auth/evernote
method: get
- http:
path: /auth/evernote/callback
method: get
createNote:
handler: src/handlers/notes.create
events:
- http:
path: /notes
method: post
authorizer:
type: COGNITO_USER_POOLS
authorizerId: !Ref ApiGatewayAuthorizer
searchNotes:
handler: src/handlers/notes.search
events:
- http:
path: /notes/search
method: get
authorizer:
type: COGNITO_USER_POOLS
authorizerId: !Ref ApiGatewayAuthorizer
plugins:
- serverless-offline
- serverless-prune-plugin
custom:
prune:
automatic: true
number: 3undefinedundefinedundefinedundefined// scripts/verify-deployment.js
const https = require('https');
const checks = [
{
name: 'Health Check',
url: `${process.env.APP_URL}/health`,
expectedStatus: 200
},
{
name: 'OAuth Endpoint',
url: `${process.env.APP_URL}/auth/evernote`,
expectedStatus: 302 // Redirect
}
];
async function verifyDeployment() {
console.log('Verifying deployment...\n');
for (const check of checks) {
try {
const response = await fetch(check.url, { redirect: 'manual' });
if (response.status === check.expectedStatus) {
console.log(`[PASS] ${check.name}`);
} else {
console.log(`[FAIL] ${check.name} - Expected ${check.expectedStatus}, got ${response.status}`);
process.exit(1);
}
} catch (error) {
console.log(`[FAIL] ${check.name} - ${error.message}`);
process.exit(1);
}
}
console.log('\nDeployment verification passed!');
}
verifyDeployment();// scripts/verify-deployment.js
const https = require('https');
const checks = [
{
name: 'Health Check',
url: `${process.env.APP_URL}/health`,
expectedStatus: 200
},
{
name: 'OAuth Endpoint',
url: `${process.env.APP_URL}/auth/evernote`,
expectedStatus: 302 // Redirect
}
];
async function verifyDeployment() {
console.log('Verifying deployment...\n');
for (const check of checks) {
try {
const response = await fetch(check.url, { redirect: 'manual' });
if (response.status === check.expectedStatus) {
console.log(`[PASS] ${check.name}`);
} else {
console.log(`[FAIL] ${check.name} - Expected ${check.expectedStatus}, got ${response.status}`);
process.exit(1);
}
} catch (error) {
console.log(`[FAIL] ${check.name} - ${error.message}`);
process.exit(1);
}
}
console.log('\nDeployment verification passed!');
}
verifyDeployment();undefinedundefinedundefinedundefinedevernote-webhooks-eventsevernote-webhooks-events