diff --git a/.eslintignore b/.eslintignore index 4e30d14..dc71946 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ dist/* env/* +serverless.yml \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 5de02b1..0b26498 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ coverage dist -node_modules \ No newline at end of file +node_modules +serverless.yml \ No newline at end of file diff --git a/env/config.yml b/env/config.yml new file mode 100644 index 0000000..2224874 --- /dev/null +++ b/env/config.yml @@ -0,0 +1,20 @@ +--- +#----------------------------------- +# Lemon Basic Environment Variables. +#----------------------------------- +lemon: + name: lemon-app + runtime: nodejs16.x + region: ap-northeast-2 + env: lemon.yml # environment file + bucketName: 'lemon-lemonade' # WARN! main bucket used (create before deploy). + identityPool: 'ap-northeast-2:71aca5df-260e-4c65-ab21-48bf1877ea13' # ade-user-pool-identity-pool + securityGroupIds: + subnetIds: +none: + name: none-app + runtime: nodejs16.x + region: ap-northeast-2 + env: none.yml # environment file + securityGroupIds: + subnetIds: diff --git a/package-lock.json b/package-lock.json index 0b98a44..32989fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "2.4.3a", "license": "MIT", "dependencies": { - "lemon-core": "^3.2.5" + "lemon-core": "^3.2.7" }, "devDependencies": { "@cruglobal/serverless-merge-config": "^1.1.0", @@ -38,10 +38,7 @@ "supertest": "^4.0.2", "ts-jest": "^27.1.4", "ts-node": "8.1.0", - "tsconfig-paths": "^4.1.2", - "ttypescript": "^1.5.15", - "typedoc": "^0.22.15", - "typescript": "^4.6.4" + "typedoc": "^0.22.15" }, "engines": { "node": ">=16.17.0" @@ -16358,29 +16355,6 @@ "typescript": ">=2.4.1" } }, - "node_modules/tsconfig-paths": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.1.2.tgz", - "integrity": "sha512-uhxiMgnXQp1IR622dUXI+9Ehnws7i/y6xvpZB9IbUVOPy0muvdvgXeZOn88UcGPiT98Vp3rJPTa8bFoalZ3Qhw==", - "dev": true, - "dependencies": { - "json5": "^2.2.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tsconfig-paths/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -16402,23 +16376,6 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/ttypescript": { - "version": "1.5.15", - "resolved": "https://registry.npmjs.org/ttypescript/-/ttypescript-1.5.15.tgz", - "integrity": "sha512-48ykDNHzFnPMnv4hYX1P8Q84TvCZyL1QlFxeuxsuZ48X2+ameBgPenvmCkHJtoOSxpoWTWi8NcgNrRnVDOmfSg==", - "dev": true, - "dependencies": { - "resolve": ">=1.9.0" - }, - "bin": { - "ttsc": "bin/tsc", - "ttsserver": "bin/tsserver" - }, - "peerDependencies": { - "ts-node": ">=8.0.2", - "typescript": ">=3.2.2" - } - }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -16577,9 +16534,10 @@ } }, "node_modules/typescript": { - "version": "4.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz", - "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==", + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", + "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -30124,25 +30082,6 @@ "integrity": "sha512-pOTLlet1SnAvhKNr9tMAFwuv5283OkUNiq1fXTEK+vrSv+kxU3e2Ijr/UkqyX2vuMmvcNHdpXC31hob7ljH//g==", "requires": {} }, - "tsconfig-paths": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.1.2.tgz", - "integrity": "sha512-uhxiMgnXQp1IR622dUXI+9Ehnws7i/y6xvpZB9IbUVOPy0muvdvgXeZOn88UcGPiT98Vp3rJPTa8bFoalZ3Qhw==", - "dev": true, - "requires": { - "json5": "^2.2.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - }, - "dependencies": { - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true - } - } - }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -30158,15 +30097,6 @@ "tslib": "^1.8.1" } }, - "ttypescript": { - "version": "1.5.15", - "resolved": "https://registry.npmjs.org/ttypescript/-/ttypescript-1.5.15.tgz", - "integrity": "sha512-48ykDNHzFnPMnv4hYX1P8Q84TvCZyL1QlFxeuxsuZ48X2+ameBgPenvmCkHJtoOSxpoWTWi8NcgNrRnVDOmfSg==", - "dev": true, - "requires": { - "resolve": ">=1.9.0" - } - }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -30288,9 +30218,10 @@ } }, "typescript": { - "version": "4.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz", - "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==" + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", + "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", + "peer": true }, "unbox-primitive": { "version": "1.0.2", diff --git a/package.json b/package.json index 7c9ae94..ec4f59b 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,8 @@ "express.adam": "ENV=adam STAGE=local npm run start", "!deploy": "----- deploy to AWS by serverless -----", "deploy.lemon": "npm run build && sls deploy --param='profile=lemon' --stage dev", + "deploy.devops": "npm run build && sls deploy --param='profile=devops' --stage dev", + "deploy.ian": "npm run build && sls deploy --param='profile=ian' --stage dev", "deploy.lemon.prod": "npm run build && sls deploy --param='profile=lemon' --stage prod", "deploy.jober": "npm run build && sls deploy --param='profile=jober' --stage prod", "deploy.neuro": "npm run build && sls deploy --param='profile=neuro' --stage prod", @@ -66,7 +68,7 @@ "plato": "plato -r -d complexity dist" }, "dependencies": { - "lemon-core": "^3.2.5" + "lemon-core": "^3.2.7" }, "devDependencies": { "@cruglobal/serverless-merge-config": "^1.1.0", @@ -95,10 +97,7 @@ "supertest": "^4.0.2", "ts-jest": "^27.1.4", "ts-node": "8.1.0", - "tsconfig-paths": "^4.1.2", - "ttypescript": "^1.5.15", - "typedoc": "^0.22.15", - "typescript": "^4.6.4" + "typedoc": "^0.22.15" }, "private": false, "author": "Steve Jung (https://lemoncloud.io)", diff --git a/serverless.yml b/serverless.yml index b5066f2..b0f120c 100644 --- a/serverless.yml +++ b/serverless.yml @@ -23,7 +23,7 @@ custom: region: ${opt:region, 'ap-northeast-2'} # run option `--region` `-r` stage: ${opt:stage, 'dev'} # run option `--stage` `-s` env: ${param:env, './env/none.yml'} # run option `--env` - CONF: ${file(./env/config.js):CONF} # merge config from `config.js` by profile. + CONF: ${file(./env/config.yml):${self:custom.CORE.profile}} # merge config from `config.js` by profile. #------------------------------------------------ # serverless-offline #------------------------------------------------ @@ -110,9 +110,9 @@ provider: region: ${self:custom.CONF.${self:custom.CORE.profile}.region, self:custom.CORE.region} # profile의 region를 먼저 사용하고, 없으면 실행 옵션값. # VPC Configuration for Lambda. - vpc: - securityGroupIds: ${self:custom.CONF.${self:custom.CORE.profile}.securityGroupIds} - subnetIds: ${self:custom.CONF.${self:custom.CORE.profile}.subnetIds} +# vpc: +# securityGroupIds: ${self:custom.CONF.${self:custom.CORE.profile}.securityGroupIds} +# subnetIds: ${self:custom.CONF.${self:custom.CORE.profile}.subnetIds} # Lambda function's IAM Role here iamRoleStatements: @@ -189,7 +189,7 @@ provider: MY_S3_BUCKET: '${self:custom.bucketName.${self:custom.CORE.stage}}' MY_SQS_ENDPOINT: 'https://sqs.${self:provider.region}.amazonaws.com/${aws:accountId}/${self:custom.queueName.${self:custom.CORE.stage}}' # see `sqs-service` MY_SNS_ENDPOINT: 'arn:aws:sns:${self:provider.region}:${aws:accountId}:${self:custom.topicName.${self:custom.CORE.stage}}' # see `sns-service` - $<<: ${file(./env/${self:custom.CONF.${self:custom.CORE.profile}.env}):${self:custom.CORE.stage}} + $<<: ${file(./env/${self:custom.CONF.env}):${self:custom.CORE.stage}} #------------------------------------------------ # Functions @@ -391,7 +391,6 @@ resources: MyS3Bucket: Type: AWS::S3::Bucket Properties: - AccessControl: PublicRead BucketName: ${self:custom.bucketName.${self:custom.CORE.stage}} WebsiteConfiguration: IndexDocument: index.html @@ -406,6 +405,11 @@ resources: - GET - HEAD MaxAge: 3000 + PublicAccessBlockConfiguration: + BlockPublicAcls: false + OwnershipControls: + Rules: + - ObjectOwnership: ObjectWriter # ------------------------------- # S3 Bucket @@ -431,4 +435,4 @@ resources: }, "/*" ] - ] + ] \ No newline at end of file