Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: The process '/usr/bin/rsync' failed with exit code 255 #16

Open
mimoudix opened this issue Nov 9, 2023 · 9 comments
Open

Error: The process '/usr/bin/rsync' failed with exit code 255 #16

mimoudix opened this issue Nov 9, 2023 · 9 comments

Comments

@mimoudix
Copy link

mimoudix commented Nov 9, 2023

Bug Description
A clear and concise description of what the bug is.

My Action Config

on:
  push:
    # !!!!!!! TODO Fill Out !!!!!!!

My Action Log

   # Paste Log here
@michellavezzo
Copy link

Bug Description A clear and concise description of what the bug is.

My Action Config

on:
  push:
    # !!!!!!! TODO Fill Out !!!!!!!

My Action Log

   # Paste Log here

You need to set the folder user ownership at your server.

  • Make sure the destination directory is owned by the user running rsync.
  • Use chown to change ownership if needed. For example:
    sudo chown -R user /path/to/destination

"user" is your server username

@michellavezzo
Copy link

Also if you do not have the rsync installed in your linux server, you need to run

sudo apt update && sudo apt install rsync -y

@mimoudix
Copy link
Author

Hey @michellavezzo I managed to get it working after installing Rsync—thank you so much!

Regarding ownership permissions, I encountered a similar issue while using LAMP Packaged by Bitnami on a Lightsail VPS. I couldn't create files until I stumbled upon this fix:

sudo chown -R bitnami:daemon /opt/bitnami/apache/htdocs
sudo chmod -R g+w /opt/bitnami/apache/htdocs

Do you think this setup should work fine?

I've got another question about the rsync options. It appears that the deployment doesn't work when specifying exclusions without these options: --archive --verbose --compress --human-readable --progress --delete-after. Are these necessary? If so, any idea why?

Thanks in advance for your help! 🙏

@michellavezzo
Copy link

Hey @michellavezzo I managed to get it working after installing Rsync—thank you so much!

Regarding ownership permissions, I encountered a similar issue while using LAMP Packaged by Bitnami on a Lightsail VPS. I couldn't create files until I stumbled upon this fix:

sudo chown -R bitnami:daemon /opt/bitnami/apache/htdocs
sudo chmod -R g+w /opt/bitnami/apache/htdocs

Do you think this setup should work fine?

I've got another question about the rsync options. It appears that the deployment doesn't work when specifying exclusions without these options: --archive --verbose --compress --human-readable --progress --delete-after. Are these necessary? If so, any idea why?

Thanks in advance for your help! 🙏

To be honest, I don't know how to answer your questions hehe, but I hope a good citizen has his answers.

@Aatmik-Sanghvi
Copy link

Can any one check the below image and help me on it. I am setting CI/CD for AWS ec2. Trying to solve the error for more than 2 days but am not getting the proper solution on the internet 😥.
Thank you in advance.
deploy error

@mimoudix
Copy link
Author

@Aatmik-Sanghvi can you share me your workflow code ?

@mimoudix
Copy link
Author

@Aatmik-Sanghvi try this one and don't forget to give ur TARGET PATH permissions

"on": push
name: Publish Website
jobs:
  web-deploy:
    name: "\U0001F680 Deploy Website Every Commit"
    runs-on: ubuntu-latest
    steps:
      - name: "\U0001F69A Get Latest Code"
        uses: actions/checkout@v3
      - name: "\U0001F4C2 Sync Files"
        uses: SamKirkland/web-deploy@v1
        with:
          target-server: "${{ secrets.DEPLOY_HOST }}"
          remote-user: "${{ secrets.DEPLOY_USER }}"
          private-ssh-key: "${{ secrets.DEPLOY_PRIVATE_KEY }}"
          destination-path: ~/htdocs
          rsync-options:
            --archive --verbose --compress --human-readable --progress --delete-after
            --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md
            --exclude=webpack.config.js
            --exclude=.gitignore --exclude=config.php --exclude=secrets.php --exclude=node_modules/ --exclude=.vscode/
            --exclude=package.json --exclude=package-lock.json --exclude=purgecss.config.js --exclude=tailwind.config.js
            --exclude=input.css --exclude=composer.json --exclude=composer.lock --exclude=content/uploads/ --exclude=install.php --exclude=App/Ajax/install.php --exclude=webpack.config.js --exclude=App/logs/ --exclude=update_bd.sql

@Aatmik-Sanghvi
Copy link

Aatmik-Sanghvi commented Nov 19, 2024

@mimoudix sure here it is,
`name: Laravel Deployment to AWS EC2

on:
push:
branches:
- master

jobs:
deploy:
name: Deploy Laravel to EC2
runs-on: ubuntu-latest

steps:
  # Checkout the code
  - name: Checkout Code
    uses: actions/checkout@v2

  # Deploy files to EC2
  - name: Deploy to EC2
    uses: easingthemes/ssh-deploy@main
    env:
      SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
      REMOTE_HOST: ${{ secrets.EC2_HOST }}
      REMOTE_USER: ${{ secrets.EC2_USERNAME }}
      TARGET: "/var/www/html/my-book-mate"
      ARGS: "-o StrictHostKeyChecking=no"

  # Run Laravel artisan commands
  - name: Run Laravel Artisan Commands
    run: |
      ssh -o StrictHostKeyChecking=no [email protected] << 'EOF'
      cd /var/www/html/my-book-mate
      php artisan migrate --force
      php artisan cache:clear
      php artisan config:cache
      php artisan route:cache
      EOF`

@Aatmik-Sanghvi
Copy link

@Aatmik-Sanghvi try this one and don't forget to give ur TARGET PATH permissions

"on": push
name: Publish Website
jobs:
  web-deploy:
    name: "\U0001F680 Deploy Website Every Commit"
    runs-on: ubuntu-latest
    steps:
      - name: "\U0001F69A Get Latest Code"
        uses: actions/checkout@v3
      - name: "\U0001F4C2 Sync Files"
        uses: SamKirkland/web-deploy@v1
        with:
          target-server: "${{ secrets.DEPLOY_HOST }}"
          remote-user: "${{ secrets.DEPLOY_USER }}"
          private-ssh-key: "${{ secrets.DEPLOY_PRIVATE_KEY }}"
          destination-path: ~/htdocs
          rsync-options:
            --archive --verbose --compress --human-readable --progress --delete-after
            --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md
            --exclude=webpack.config.js
            --exclude=.gitignore --exclude=config.php --exclude=secrets.php --exclude=node_modules/ --exclude=.vscode/
            --exclude=package.json --exclude=package-lock.json --exclude=purgecss.config.js --exclude=tailwind.config.js
            --exclude=input.css --exclude=composer.json --exclude=composer.lock --exclude=content/uploads/ --exclude=install.php --exclude=App/Ajax/install.php --exclude=webpack.config.js --exclude=App/logs/ --exclude=update_bd.sql

@mimoudix I am not getting what are you saying about the target path permission. I am directly trying to edit the .yml file in the github so don't think so the destination-path: ~/htdocs needs to be added. let me know if i am right or wrong as I am new to adding the workflows in github actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants