Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS CodeDeploy Github File Already Exist

I am trying to use AWS CodeDeploy to pull my latest changes from Github down to a server. The problem I am running into is on the install step I am getting this error:

Error CodeUnknownError
Script Name
MessageFile already exists at location /data/sites/wordpress/api_now_playing_staging.php
Log Tail

And my appspec.yml looks like this:

version: 0.0
os: "linux"
files: 
  - source: "/"
    destination: "/data/sites/wordpress"
permissions:
  - object: /data/sites/wordpress
    pattern: "**"
    owner: wp
    group: nginx
    mode: 755
    type:
      - file

My question is if it git is suppose to be pulling using CodeDeploy, why am I getting file already exist error? Am I doing something wrong?

like image 774
Devin Dixon Avatar asked Jan 22 '16 16:01

Devin Dixon


People also ask

How do I link AWS CodeDeploy to GitHub?

To create a connection for AWS CodeDeploy applications to a GitHub account, sign out of GitHub in a separate web browser tab. In GitHub token name, type a name to identify this connection, and then choose Connect to GitHub. The web page prompts you to authorize CodeDeploy to interact with GitHub for your application.

What should be checked first when an AWS CodeDeploy deployment fails?

Here's the steps I would take: Confirm that you installed the CodeDeploy agent. Confirm that you've created the IAM service role. Confirm that you have the IAM Instance Profile and that it's associated with the instance.

Where should the AppSpec Yml file be stored for CodeDeploy?

If your application uses the EC2/On-Premises compute platform, the AppSpec file must be a YAML-formatted file named appspec. yml and it must be placed in the root of the directory structure of an application's source code.


1 Answers

Did you deploy the same git repo with a different deployment group or did it manually before? If the same resource is already existed in the destination folder, CodeDeploy will check whether the resource in destination folder is created by the same deployment group. If you you are using the same deployment group, re-deploy shouldn't cause this problem.

The current way CodeDeploy host agent works is to pull down the deployment artifacts and move them to the right repository according to AppSpec file. Even you deploy from a Github repo, it's not just running git pull in the destination folder.

like image 96
Bangxi Yu Avatar answered Oct 16 '22 19:10

Bangxi Yu