ssh-deploy icon indicating copy to clipboard operation
ssh-deploy copied to clipboard

deploy to server is slowly

Open yinguangyao opened this issue 3 years ago • 3 comments

when I use this action, deploy to server always spend many time. image

And my yml is as follows:

name: deploy
on:
  push:
    branches:
      - master
    paths-ignore:   # 变更不触发部署
      - README.md
  pull_request:
    branches:
      - master
    paths-ignore:   # 变更不触发部署
      - README.md
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@master
      - name: cache node_modules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json') }}
      - name: install dependencies
        run: npm install
      - name: build
        run: npm run build
      - name: Deploy to Server
        uses: easingthemes/[email protected]
        env:
            SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }}
            SOURCE: "build/"
            REMOTE_HOST: ${{ secrets.SSH_HOST }}
            REMOTE_USER: ${{ secrets.SSH_USERNAME }}
            TARGET: ${{ secrets.REMOTE_TARGET }}

yinguangyao avatar Sep 13 '20 16:09 yinguangyao

@yinguangyao, I had the same problem.

Then, I found this post, which helped me with the flags setup.

It recommends to use -rlgoDzvc instead of -rltgoDzvO since the modification time of freshly checked out files is always different from those on server. So rsync sends all the files to the server.

I switched to those flags as well and it drastically decreased the deploy time from ~4 minutes to 12 seconds: «Screenshot» 2020-10-23 at 18 04 02

Hope this helps!

bespoyasov avatar Oct 23 '20 15:10 bespoyasov

Yep. I agree that "c" is for checksum and will be better to update that in doc for convenient and fix some future new issues there. I'am for adding to ARGS section, link to man page of rsync

Triloworld avatar Nov 18 '20 22:11 Triloworld

      - name: Deploy to Aliyun Server
        uses: easingthemes/[email protected]
        env:
          SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
          ARGS: "-rlgoDzvc --delete"
          SOURCE: ${{ secrets.SOURCE }}
          REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
          REMOTE_USER: ${{ secrets.USER_NAME }}
          TARGET: ${{ secrets.TARGET }}

I also met this probleam and solved it.

xwzbupt avatar Sep 22 '22 09:09 xwzbupt

@easingthemes pls update this readme adding -c to ARGS : https://github.com/easingthemes/ssh-deploy#usage Before: ARGS: "-rltgoDzvO" After: ARGS: "-rltgoDzvOc"

Help other :)

Triloworld avatar Jan 02 '23 09:01 Triloworld

Updated, both readme and default option used in the action. I had to publish major release to not break current usage.

easingthemes avatar Jan 03 '23 08:01 easingthemes