【问题标题】:CodeBuild and CodeDeploy Success But Not Running Server for maven javaweb applicationCodeBuild 和 CodeDeploy 成功但没有为 maven javaweb 应用程序运行服务器
【发布时间】:2017-05-23 13:00:50
【问题描述】:

我在 aws 服务器上使用 codestart,我的 codecommit 和 codebuild 成功,但未部署在 tomcat 服务器上。这些是 buildspec.yml 和 appspec.yml

buildspec.yml

    version: 0.1

    phases:
      install:
        commands:
          - echo Entering install phase...
          - wget http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
          - tar xzvf apache-maven-3.3.9-bin.tar.gz -C /opt/
          - export PATH=/opt/apache-maven-3.3.9/bin:$PATH
      pre_build:
        commands:
          - echo Entering pre_build phase...
          - echo Nothing to do in the pre_build phase...
      build:
        commands:
          - echo Entering build phase...
          - echo Build started on `date`
          - mvn -f pom.xml compile war:exploded
      post_build:
        commands:
          - echo Entering post_build phase...
          - echo Build completed on `date`
          - mv target/ROOT .
    artifacts:
      type: zip
      files:
        - target/ROOT.war
        - appspec.yml
      discard-paths: yes

appspec.yml

    version: 0.0
    os: linux
    files:
      - source: ./ROOT.jar
        destination: /

【问题讨论】:

  • 随便看看,你的appspec.yml 中的./ROOT.jar 应该是./target/ROOT.war 吗?

标签: spring amazon-web-services tomcat8 aws-code-deploy aws-codebuild


【解决方案1】:

除非您提供有关错误的任何其他信息,否则我不知道如何为您提供帮助。

几个指针:

  1. 您可以转到代码部署 > 部署 > 部署修订 > 事件和日志,以准确找出问题所在。
  2. 如果您可以通过 ssh 访问您的实例,您可以转到 /opt/code-deploy/deployment-root/deployment-logs 找出什么是 出错了。

【讨论】:

    【解决方案2】:
    • buildspec.yml(需要修改)
    • appspec.yml(删除)

    buildspec.yml

        version: 0.1
    
        phases:
          install:
            commands:
              - echo Entering install phase...
              - wget http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
              - tar xzvf apache-maven-3.3.9-bin.tar.gz -C /opt/
              - export PATH=/opt/apache-maven-3.3.9/bin:$PATH
          pre_build:
            commands:
              - echo Entering pre_build phase...
              - echo Nothing to do in the pre_build phase...
          build:
            commands:
              - echo Entering build phase...
              - echo Build started on `date`
              - mvn -f pom.xml compile war:exploded
          post_build:
            commands:
              - echo Entering post_build phase...
              - echo Build completed on `date`
              - mv target/ROOT .
        artifacts:
          type: zip
          files:
            - 'ROOT/WEB-INF/**/*'
            - 'ROOT/WEB-INF/classes/*'
            - 'ROOT/WEB-INF/classes/**/*'
            - 'ROOT/WEB-INF/lib/*'
            - 'ROOT/WEB-INF/lib-provided/*'
            - 'ROOT/WEB-INF/js/*'
            - 'ROOT/org/springframework/boot/loader/*' //if you are using spring boot application
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-04
      • 2020-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-05
      相关资源
      最近更新 更多