本文介绍了如何使用gcloud命令行部署多个功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署多个云功能.这是我的index.js:

I want to deploy multiple cloud functions. Here is my index.js:

const { batchMultipleMessage } = require('./gcf-1');
const { batchMultipleMessage2 } = require('./gcf-2');

module.exports = {
  batchMultipleMessage,
  batchMultipleMessage2
};

如何使用gcloud beta functions deploy xxx一次部署这两个功能.

How can I use gcloud beta functions deploy xxx to deploy these two functions at one time.

推荐答案

选项1:

现在,我写一个deploy.sh一次部署这两个云功能.

For now, I write a deploy.sh to deploy these two cloud functions at one time.

TOPIC=batch-multiple-messages
FUNCTION_NAME_1=batchMultipleMessage
FUNCTION_NAME_2=batchMultipleMessage2

echo "start to deploy cloud functions\n"
gcloud beta functions deploy ${FUNCTION_NAME_1} --trigger-resource ${TOPIC} --trigger-event google.pubsub.topic.publish
gcloud beta functions deploy ${FUNCTION_NAME_2} --trigger-resource ${TOPIC} --trigger-event google.pubsub.topic.publish

它可以工作,但是如果gcloud命令行支持部署了多个云功能,那将是最好的方法.

It works, but if gcloud command line support deploy multiple cloud functions, that will be best way.

选项2:

https://serverless.com/

这篇关于如何使用gcloud命令行部署多个功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 18:00