Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into lambda-provisioned-concurrency
- Loading branch information
Showing
42 changed files
with
473 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- | ||
title: Serverless Dashboard - CI/CD Best Practices | ||
menuText: Best Practices | ||
layout: Doc | ||
--> | ||
|
||
<!-- DOCS-SITE-LINK:START automatically generated --> | ||
|
||
### [Read this on the main serverless docs site](https://www.serverless.com/framework/docs/dashboard/cicd/best-practices/) | ||
|
||
<!-- DOCS-SITE-LINK:END --> | ||
|
||
# Serverless CI/CD Best Practices | ||
|
||
Serverless Framework Pro provides a lot of capabilities out of the box to help you manage and deploy | ||
your services. As your teams grow and the number of services grow, it can be difficult to know | ||
the best way to organize your services for scale. | ||
|
||
To help you manage and deploy your services at scale, check out the | ||
[Serverless CI/CD Workflow Guide](https://serverless.com/learn/guides/cicd/) for our recommendations | ||
on organizing your apps, servies, repos and automating your release process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
const os = require('os'); | ||
const path = require('path'); | ||
const { memoize } = require('lodash'); | ||
const BbPromise = require('bluebird'); | ||
const childProcess = BbPromise.promisifyAll(require('child_process')); | ||
const fse = BbPromise.promisifyAll(require('fs-extra')); | ||
const { version } = require('../../../../package'); | ||
const getTmpDirPath = require('../../../utils/fs/getTmpDirPath'); | ||
const createZipFile = require('../../../utils/fs/createZipFile'); | ||
|
||
const srcDirPath = path.join(__dirname, 'resources'); | ||
const cachedZipFilePath = path.join( | ||
os.homedir(), | ||
'.serverless/cache/custom-resources', | ||
version, | ||
'custom-resources.zip' | ||
); | ||
|
||
module.exports = memoize(() => | ||
fse | ||
.lstatAsync(cachedZipFilePath) | ||
.then( | ||
stats => { | ||
if (stats.isFile()) return true; | ||
return false; | ||
}, | ||
error => { | ||
if (error.code === 'ENOENT') return false; | ||
throw error; | ||
} | ||
) | ||
.then(isCached => { | ||
if (isCached) return cachedZipFilePath; | ||
const ensureCachedDirDeferred = fse.ensureDirAsync(path.dirname(cachedZipFilePath)); | ||
const tmpDirPath = getTmpDirPath(); | ||
return fse | ||
.copyAsync(srcDirPath, tmpDirPath) | ||
.then(() => childProcess.execAsync('npm install', { cwd: tmpDirPath })) | ||
.then(() => ensureCachedDirDeferred) | ||
.then(() => createZipFile(tmpDirPath, cachedZipFilePath)) | ||
.then(() => cachedZipFilePath); | ||
}) | ||
); | ||
|
||
module.exports.cachedZipFilePath = cachedZipFilePath; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.