Search code examples
.nettfsaws-code-deploy

How to write codedeploy appspec file?


I'm using windows server instance.. I need to use codedeploy for deployment but I always have a problem with the appspec.yml file

What to write in files source/destination and the hooks sections?

Any Help is really appreciated!


Solution

  • Whatever, here is an example of an AppSpec file for an in-place deployment to an Amazon Linux, Ubuntu Server, or RHEL instance.

    version: 0.0
    os: linux
    files:
      - source: Config/config.txt
        destination: /webapps/Config
      - source: source
        destination: /webapps/myApp
    hooks:
      BeforeInstall:
        - location: Scripts/UnzipResourceBundle.sh
        - location: Scripts/UnzipDataBundle.sh
      AfterInstall:
        - location: Scripts/RunResourceTests.sh
          timeout: 180
      ApplicationStart:
        - location: Scripts/RunFunctionalTests.sh
          timeout: 3600
      ValidateService:
        - location: Scripts/MonitorService.sh
          timeout: 3600
          runas: codedeployuser
    

    For a Windows Server instance, change os: linux to os: windows. Also, you must fully qualify the destination paths (for example, c:\temp\webapps\Config and c:\temp\webapps\myApp). Do not include the runas element.

    More information pleas see AppSpec File Example for details.