Angular 5 - GAE flex环境部署

时间:2018-05-10 07:01:55

标签: angular5 gcloud bitbucket-pipelines

我们使用bitbucket管道作为angular 5来将代码部署到GAE。我们最终会遇到以下异常。我们使用CI / CD的bitbucket管道

这是管道代码

    image: node:9.11.1
     pipelines:

      custom:

       default:

         - step:

           script: 

             -  npm install -g @angular/cli@latest

             - ng build --prod
             - cp app.yaml dist
             - ls dist
             - cd dist

             - curl -o /tmp/google-cloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-190.0.0-linux-x86_64.tar.gz

             - tar -xvf /tmp/google-cloud-sdk.tar.gz -C /tmp/

             - /tmp/google-cloud-sdk/install.sh -q

             - source /tmp/google-cloud-sdk/path.bash.inc
             - echo $GCLOUD_API_KEYFILE | base64 --decode --ignore-garbage > ./gcloud-api-key.json
             - gcloud config set project $GCLOUD_PROJECT

             - gcloud components install app-engine-java

             - gcloud auth activate-service-account --key-file gcloud-api-key.json

             - echo $GCLOUD_API_KEYFILE > /tmp/client-secret.json  

             - gcloud config set project $GCLOUD_PROJECT
             - gcloud app update --split-health-checks --project adtecy-ui 

             - gcloud app deploy app.yaml

我希望使用节点泊坞窗映像将角度5(版本5.2.11)应用程序部署到GAE flex环境但是它需要非常长的时间并且状态仍然是"进行中" (不确定通常的部署时间)

这是我的app.yaml文件

    env: flex
    runtime: python


    threadsafe: true

    readiness_check:

       timeout_sec: 4
       check_interval_sec: 5
       failure_threshold: 2
       success_threshold: 2
       app_start_timeout_sec: 3600

我已经给出了一个非常高的超时时间,因为之前的推送失败并且超时

我认为GAE默认使用python,因此我们没有安装python 现在部署运行大约20分钟左右,但没有告诉我们任何结果。你能帮我们用最少的时间将我的应用程序部署到GAE吗?

编辑: 现在我们在跑了33分钟后得到了结果         `21df82f90a72:图层已存在

    aeb4b6656589: Pushed

    latest: digest: 

sha256:c57d3178321c5f2721fc70cd00cb7862d469c74a6bf616ecfda760342c13af7e size: 3255

    DONE
    --------------------------------------------------------------------------------
    Updating service [default] (this may take several minutes)...
    .failed.
     ERROR: (gcloud.app.deploy) Operation [apps/adtecy- 
     ui/operations/9c273f87-91a3-495a-b75d-0d6c767dce97] timed out. 
     This operation may still be underway.`

2 个答案:

答案 0 :(得分:0)

您可以通过运行

来检查部署操作的状态

gcloud app operations" apps / adtecy-ui / operations / 9c273f87-91a3-495a-b75d-0d6c767dce97"

答案 1 :(得分:0)

运行应用程序似乎是nodejs环境的问题。所以我切换到python27,我能够成功部署它。但是,当我尝试使用GAE中提供的应用程序加载时,它会抛出错误。

https://adtecy-ui.appspot.com

这是我的app.yaml(我也做了一些修改)

    runtime: python27
    api_version: 1
    threadsafe: true



    handlers:
    # Routing for bundles to serve directly
    - url: /((?:inline|main|polyfills|styles|vendor)\.[a-z0-9]+\.bundle\.js)
      secure: always
      redirect_http_response_code: 301
      static_files: dist/\1
      upload: dist/.*

      # Routing for a prod styles.bundle.css to serve directly
      - url: /(styles\.[a-z0-9]+\.bundle\.css)
        secure: always
        redirect_http_response_code: 301
        static_files: dist/\1
        upload: dist/.*

        # Routing for typedoc, assets and favicon.ico to serve directly
        - url: /((?:assets|docs)/.*|favicon\.ico)
         secure: always
         redirect_http_response_code: 301
         static_files: dist/\1
         upload: dist/.*


         # Any other requests are routed to index.html for angular to 
         handle so we don't need hash URLs
         - url: /.*
           secure: always
           redirect_http_response_code: 301
           static_files: dist/index.html
           upload: dist/index\.html