通过bitbucket管道部署Google App Engine Nest.js

发布于 2025-02-07 04:31:50 字数 3982 浏览 3 评论 0原文

在当前的设置中,我使用Bitbucket Pipelinesnest.js后端部署到 Google App Engine 。不幸的是,我还没有让我的Nestjs后端启动并运行。在我使用简单的express.js后端进行相同的设置之前,它无问题。

问题如下,我现在对还有什么尝试:

https://i.sstatic.net/mrjx8.png“ alt =”在此处输入图像说明“>

这是我的bitbucket-pipelines.yaml

image: node:16.15.0
 
pipelines:
  branches:
    master:
      - step:
          name: Install Dependencies & Build Application
          script:
            - npm install
            - npm run build
      - step:
          name: Deploy to Google App Engine
          deployment: development
          script:
            - pipe: atlassian/google-app-engine-deploy:1.0.0
              variables:
                KEY_FILE: $KEY_FILE
                PROJECT: 'example-project'
                VERSION: 'development'
                DEPLOYABLES: 'default.yaml'
                STOP_PREVIOUS_VERSION: 'true'

这是我的package.json

{
  "name": "example-project",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "NODE_ENV=production node dist/main",
    "start:dev": "NODE_ENV=development nest start --watch",
    "start:stage": "NODE_ENV=stage nest start --watch",
    "start:release": "NODE_ENV=release nest start --watch",
    "start:prod": "NODE_ENV=production node dist/main",
    "start:debug": "nest start --debug --watch",
    "db": "../../cloud_sql_proxy -instances=example-project=tcp:3306",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@hapi/joi": "^17.1.1",
    "@nestjs/cli": "^8.0.0",
    "@nestjs/common": "^8.0.0",
    "@nestjs/config": "^2.0.0",
    "@nestjs/core": "^8.0.0",
    "@nestjs/mapped-types": "^1.0.1",
    "@nestjs/platform-express": "^8.0.0",
    "@nestjs/typeorm": "^8.0.3",
    "buffer-to-stream": "^1.0.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "cloudinary": "^1.30.0",
    "firebase-admin": "^10.2.0",
    "module-alias": "^2.2.2",
    "mysql": "^2.18.1",
    "pg": "^8.7.3",
    "portfinder": "^1.0.28",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0",
    "typeorm": "^0.2.45",
    "typeorm-naming-strategies": "^4.1.0"
  },
  "devDependencies": {
    "@nestjs/schematics": "^8.0.0",
    "@nestjs/testing": "^8.0.0",
    "@types/express": "^4.17.13",
    "@types/hapi__joi": "^17.1.8",
    "@types/jest": "27.4.1",
    "@types/multer": "^1.4.7",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "^27.2.5",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "^27.0.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "^3.10.1",
    "typescript": "^4.3.5"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

也许有人已经对此堆栈进行了体验,可以帮助我。

In my current setup, I use Bitbucket Pipelines to deploy a Nest.js backend to Google App Engine. Unfortunately, I haven't gotten my NestJS backend up and running yet. Before I had the same setup with a simple Express.js backend which worked without problems.

The problem is as follows and I am now at a loss as to what else to try:

enter image description here

Here's my bitbucket-pipelines.yaml:

image: node:16.15.0
 
pipelines:
  branches:
    master:
      - step:
          name: Install Dependencies & Build Application
          script:
            - npm install
            - npm run build
      - step:
          name: Deploy to Google App Engine
          deployment: development
          script:
            - pipe: atlassian/google-app-engine-deploy:1.0.0
              variables:
                KEY_FILE: $KEY_FILE
                PROJECT: 'example-project'
                VERSION: 'development'
                DEPLOYABLES: 'default.yaml'
                STOP_PREVIOUS_VERSION: 'true'

Here's my package.json:

{
  "name": "example-project",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "NODE_ENV=production node dist/main",
    "start:dev": "NODE_ENV=development nest start --watch",
    "start:stage": "NODE_ENV=stage nest start --watch",
    "start:release": "NODE_ENV=release nest start --watch",
    "start:prod": "NODE_ENV=production node dist/main",
    "start:debug": "nest start --debug --watch",
    "db": "../../cloud_sql_proxy -instances=example-project=tcp:3306",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@hapi/joi": "^17.1.1",
    "@nestjs/cli": "^8.0.0",
    "@nestjs/common": "^8.0.0",
    "@nestjs/config": "^2.0.0",
    "@nestjs/core": "^8.0.0",
    "@nestjs/mapped-types": "^1.0.1",
    "@nestjs/platform-express": "^8.0.0",
    "@nestjs/typeorm": "^8.0.3",
    "buffer-to-stream": "^1.0.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "cloudinary": "^1.30.0",
    "firebase-admin": "^10.2.0",
    "module-alias": "^2.2.2",
    "mysql": "^2.18.1",
    "pg": "^8.7.3",
    "portfinder": "^1.0.28",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0",
    "typeorm": "^0.2.45",
    "typeorm-naming-strategies": "^4.1.0"
  },
  "devDependencies": {
    "@nestjs/schematics": "^8.0.0",
    "@nestjs/testing": "^8.0.0",
    "@types/express": "^4.17.13",
    "@types/hapi__joi": "^17.1.8",
    "@types/jest": "27.4.1",
    "@types/multer": "^1.4.7",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "^27.2.5",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "^27.0.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "^3.10.1",
    "typescript": "^4.3.5"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts
quot;,
    "transform": {
      "^.+\\.(t|j)s
quot;: "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

Maybe someone has already made experiences with this stack and can help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情未る 2025-02-14 04:31:50

我对此为时已晚,但是问题是Nest中的构建文件夹具有以下路径/app/dist/src/main,因此在您的软件包中。JSON使用此路径,然后您可以执行代码。

I am too late at this but the issue is that the build folder in nest has the following path /app/dist/src/main so in your package.json use this path and then you will be able to execute the code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文