Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ernitingarg/googlecloud-go-functions
https://github.com/ernitingarg/googlecloud-go-functions
Last synced: about 5 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/ernitingarg/googlecloud-go-functions
- Owner: ernitingarg
- Created: 2022-05-22T13:27:33.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-05-22T16:07:59.000Z (over 2 years ago)
- Last Synced: 2023-10-21T13:23:10.193Z (about 1 year ago)
- Language: Go
- Size: 49.8 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Usage
#### select target project for deployment
```sh
$ make set-project GCP_PROJECT= # default is black-stream-292507# dev
$ make set-project GCP_PROJECT=black-stream-292507
$ make set-project GCP_PROJECT=soteria-production
```#### local deploy
実質UpdatePriceHistoryのみデプロイすれば問題ない
```sh
# 先にupdate-btc-price-history-topicのtopicをpubsubで作成する
# CF deploy
$ CF_NAME="UpdatePriceHistory" CF_OPTIONS="--trigger-resource update-btc-price-history-topic" make deploy-fn-pubsub
```#### local run
- 事前準備
- 環境変数`GCP_PROJECT`を定義(GCPのプロジェクトID)
- localからfirestoreへ接続できるサービスアカウントの秘密鍵のファイルパス`KEY_FILE_PATH`
- cmd/main.goを事前に修正すれば、localから起動することが可能```go
// main.go// 新しいCFを追加時は↓のように追加すれば、ローカル起動が可能(http triggerのみ)
http.HandleFunc("/new-cloud-function", functions.NewCloudFunction)
``````sh
# 事前準備
$ export KEY_FILE_PATH=./.key/service_account.json# 実行
$ go run cmd/main.go
```