Search code examples
amazon-web-servicesubuntuamazon-ec2rsyncbitbucket-pipelines

rsync command not found while rsync already installed


I'm new to AWS and pipelines in general. I was trying to deploy a Next.js app to EC2 AWS (ubuntu) using bitbucket pipeline. However, the pipeline failed due to bash: rsync: command not found.

pipeline failed due to rsync command not found

I've googled for a few days and tried some solutions, yet none of them helped me to fix my pipeline issue. I've checked the rsync on my remote machine and it's already installed. I've also tried to re-install it a few times.

rsync is already installed on the remote machine

I've also re-checked my repository SSH keys both private (the one from .pem file) and public key (the one from my remote machine .ssh / authorized_key) so i am 100% sure there is no mistake in this part.

As for the host address, I'm using Public IPv4 address from my AWS Instance.

For the repository variables, I've checked and am sure there is nothing wrong with it as well after I compared it with the one on the pipeline file.

my bitbucket repository variables

here is my pipeline file

As for your note, I've tried using the --rsync-path=/usr/bin/rsync, but nothing changed.

I would really appreciate it if there is someone who could help me understand why this is happening and fix this issue.


Solution

  • I've found out that my pipeline is the one that caused the issue, i've separated apt-get updates and apt-get install -y rsync (get updates step) with deploy newest version step.

    So the solution is just to merge get update step to deploy step.

    - apt-get update -y # update apt
    - apt-get install -y rsync # install rsync
    - apt-cache search rsync # check if apt can find rsync
    - rsync -avzrut --delete-delay --exclude='.git' . $SSH_USER@$SSH_HOST_DEV:$SSH_PATH