Intro. Quick recommendations and tips for various processes.
- Write your functions
- Use
serverless deploywhen you've made changes toserverless.ymland in CI/CD systems - Use
serverless invoke --function myFunctionto test your Google Cloud Functions - Open up a separate tab in your console and see logs in there via
serverless logs --function myFunction - Write tests to run locally
- Break your application / project into multiple Serverless Services
- Model your Serverless Services around Data Models or Workflows
- Keep the Functions and Resources in your Serverless Services to a minimum
A handy list of commands to use when developing with the Serverless Framework.
- Create a new service with the
google-nodejstemplate
serverless create --template google-nodejs --path my-service- Install the dependencies
cd my-service
npm install- Update
serverless.yml
Update the project and credentials in your projects serverless.yml
This is a convenience method to install a pre-made Serverless Service locally by downloading the Github repo and unzipping it.
serverless install -u [GITHUB URL OF SERVICE]
Use this when you have made changes to your Functions, Events or Resources in serverless.yml or you simply want to deploy all changes within your Service at the same time.
serverless deploy
Invokes an Google Cloud Function
serverless invoke function --function [FUNCTION NAME]
Open up a separate tab in your console and see logs for a specific function using the following command.
serverless logs --function [FUNCTION NAME]
See information about your deployed service by running the info command in your service directory.
serverless info