テスト環境デプロイ

This commit is contained in:
kosukesuenaga 2025-12-09 14:57:17 +09:00
parent bb072cc91c
commit 1259ba76c9
6 changed files with 267 additions and 30 deletions

View file

@ -7,7 +7,7 @@ PROJECT_ID="datacom-poc"
API_NAME="sales-tool-api"
# プロジェクトを設定
gcloud auth application-default set-quota-project dmiru-dev
gcloud auth application-default set-quota-project $PROJECT_ID
gcloud config set project $PROJECT_ID
# API Gatewayを作成

View file

@ -2,11 +2,11 @@
# 環境変数
API_NAME="sales-tool-api"
API_CONFIG_NAME="sales-tool-gw-dev-conf-20250619"
GATEWAY_NAME="sales-tool-gw-dev"
API_CONFIG_NAME="sales-tool-gw-dev-conf-20251209"
GATEWAY_NAME="sales-tool-gw-dev-20251209"
OPENAPI_SPEC="openapi_dev.yaml"
PROJECT_ID="datacom-poc"
SERVICE_ACCOUNT="api-gateway-mpos@datacom-poc.iam.gserviceaccount.com"
SERVICE_ACCOUNT="mrt-apigateway-sa-devtest@datacom-poc.iam.gserviceaccount.com"
LOCATION="asia-northeast1"
gcloud auth application-default set-quota-project $PROJECT_ID

View file

@ -6,13 +6,191 @@ info:
schemes:
- 'https'
paths:
/trigger-minutes-workflow-from-miitel:
/miitel:
post:
description: 'ワークフロー呼び出し処理'
operationId: 'trigger-minutes-workflow-from-miitel'
description: 'Miitel Webhook Processer'
operationId: 'miitel'
x-google-backend:
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/mrt-trigger-minutes-workflow-from-miitel
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes/api/miitel
path_translation: CONSTANT_ADDRESS
jwt_audience: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes
deadline: 600
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: JSON payload
required: false
schema:
type: object
additionalProperties: true
responses:
200:
description: 'OK'
schema:
type: object
additionalProperties: true
401:
description: 'Auth Error'
schema:
type: object
properties:
error:
type: string
500:
description: 'Error'
schema:
type: object
properties:
error:
type: string
security:
- APIKeyHeader: []
/dailyBatch:
post:
description: 'get companies and owners'
operationId: 'dailyBatch'
x-google-backend:
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes/api/dailyBatch
path_translation: CONSTANT_ADDRESS
jwt_audience: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes
deadline: 600
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: JSON payload
required: false
schema:
type: object
additionalProperties: true
responses:
200:
description: 'OK'
schema:
type: object
additionalProperties: true
401:
description: 'Auth Error'
schema:
type: object
properties:
error:
type: string
500:
description: 'Error'
schema:
type: object
properties:
error:
type: string
security:
- APIKeyHeader: []
/getLog:
post:
description: 'get log'
operationId: 'getLog'
x-google-backend:
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes/api/getLog
path_translation: CONSTANT_ADDRESS
jwt_audience: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes
deadline: 600
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: JSON payload
required: false
schema:
type: object
additionalProperties: true
responses:
200:
description: 'OK'
schema:
type: object
additionalProperties: true
401:
description: 'Auth Error'
schema:
type: object
properties:
error:
type: string
500:
description: 'Error'
schema:
type: object
properties:
error:
type: string
security:
- APIKeyHeader: []
/reExecute:
post:
description: ''
operationId: 'reExecute'
x-google-backend:
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes/api/reExecute
path_translation: CONSTANT_ADDRESS
jwt_audience: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes
deadline: 600
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: JSON payload
required: false
schema:
type: object
additionalProperties: true
responses:
200:
description: 'OK'
schema:
type: object
additionalProperties: true
401:
description: 'Auth Error'
schema:
type: object
properties:
error:
type: string
500:
description: 'Error'
schema:
type: object
properties:
error:
type: string
security:
- APIKeyHeader: []
/test:
post:
description: 'test'
operationId: 'test'
x-google-backend:
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes/api/test
path_translation: CONSTANT_ADDRESS
jwt_audience: https://asia-northeast1-datacom-poc.cloudfunctions.net/generate_minutes
deadline: 600
consumes:
- application/json
produces:
@ -49,10 +227,7 @@ paths:
- APIKeyHeader: []
options:
summary: 'CORS support'
operationId: 'trigger-minutes-workflow-from-miitel-options'
x-google-backend:
address: https://asia-northeast1-datacom-poc.cloudfunctions.net/mrttrigger-minutes-workflow-from-miitel
path_translation: CONSTANT_ADDRESS
operationId: 'test-options'
responses:
204:
description: 'CORS preflight'

View file

@ -0,0 +1,24 @@
# This file specifies files that are *not* uploaded to Google Cloud
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore
node_modules
.env_dev
.env_prod
deploy_function_dev.sh
package-lock.json

View file

@ -0,0 +1,32 @@
#!/bin/bash
# プロジェクトIDを設定
PROJECT_ID="datacom-poc"
# デプロイする関数名
FUNCTION_NAME="generate_minutes"
# 関数のエントリポイント
ENTRY_POINT="helloHttp"
# ランタイム
RUNTIME="nodejs22"
# リージョン
REGION="asia-northeast1"
# 環境変数ファイル
ENV_VARS_FILE=".env_dev"
gcloud auth application-default set-quota-project $PROJECT_ID
gcloud config set project $PROJECT_ID
gcloud functions deploy $FUNCTION_NAME \
--gen2 \
--region $REGION \
--runtime $RUNTIME \
--source=. \
--entry-point $ENTRY_POINT \
--env-vars-file $ENV_VARS_FILE \
--trigger-http \
--timeout 600s \

View file

@ -6,6 +6,7 @@ import { hubspotController } from "./logics/hubspot";
import { createCustomError, responseError } from "./logics/error";
import { CLOUD_STORAGE_LOG_FOLDER_NAME, CLOUD_STORAGE_MASTER_FOLDER_NAME, COMPANIES_FILE_NAME, OWNERS_FILE_NAME } from "../serverConfig";
import { Delay } from "cerceis-lib";
import { googleDriveController } from "./logics/googleDrive";
const router = express.Router();
@ -13,6 +14,10 @@ const router = express.Router();
router.post("/miitel", async (req, res) => {
try {
const body = req.body;
if('challenge' in body) return res.status(200).contentType('text/plain').send(body.challenge);
const parsedBody = MiiTelWebhookSchema.safeParse(body);
if (!parsedBody.success) throw createCustomError("ZOD_FAILED");
@ -23,9 +28,10 @@ router.post("/miitel", async (req, res) => {
await processRequest(videoInfo);
// if(!result) throw
res.status(200).send("ok");
return res.status(200).send("ok");
} catch(err) {
responseError(err, res)
responseError(err, res);
return;
}
});
@ -118,22 +124,22 @@ router.post("/logUpload", async (req, res) => {
// res.send('ok');
// });
// router.post("/test", async (req, res) => {
// try {
router.post("/test", async (req, res) => {
try {
// const googleAuth = await googleDriveController.getAuth();
// const driveClilent = googleDriveController.getDriveClient(googleAuth);
// const sheetsClient = googleDriveController.getSheetsClient(googleAuth);
// const folderId = await googleDriveController.searchFileIdByFileName(driveClilent, MINUTES_CREATION_HISTORY_FOLDER_ID, '2025');
// if(!folderId) throw new Error()
// // console.log(fileId);
// // const sheetId = await googleDriveController.getLogSheetId(driveClilent, sheetsClient, folderId, 'test1');
// // console.log('sheet id : ', sheetId);
// res.send("ok");
// } catch (error) {
// console.error("Error in /test endpoint:", error);
// res.status(500).send("Error in /test endpoint");
// }
// });
// console.log(fileId);
// const sheetId = await googleDriveController.getLogSheetId(driveClilent, sheetsClient, folderId, 'test1');
// console.log('sheet id : ', sheetId);
res.send("ok");
} catch (error) {
console.error("Error in /test endpoint:", error);
res.status(500).send("Error in /test endpoint");
}
});
export default router;