deployphp / action

GitHub Action for Deployer
MIT License
227 stars 46 forks source link

Deploy fails possibly because of wrong ssh user #26

Closed hotrush closed 2 years ago

hotrush commented 2 years ago

My workflow steps look like this:

      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'
      - name: Prepare .env
        run: echo $ENV_FILE >> ~/.env
        env:
          ENV_FILE: ${{ secrets.ENV_FILE }}
      - name: Deploy
        uses: deployphp/action@v1
        with:
          private-key: ${{ secrets.PRIVATE_KEY }}
          dep: deploy -vvv

But it couldn't deploy

Run deployphp/action@v1
  with:
    private-key: ***
    dep: deploy -vvv
Downloading "https://deployer.org/deployer.phar".
[localhost] > git rev-parse --abbrev-ref HEAD
[localhost] < HEAD
✈︎ Deploying HEAD on x.x.x.x
• done on [x.x.x.x]
➤ Executing task deploy:prepare
[x.x.x.x] > echo $0
[x.x.x.x] < ssh multiplexing initialization
[x.x.x.x] < Permission denied, please try again.
[x.x.x.x] < Permission denied, please try again.
[x.x.x.x] < runner@x.x.x.x: Permission denied (publickey,password).
➤ Executing task deploy:failed
• done on [x.x.x.x]
✔ Ok [0ms]
➤ Executing task deploy:unlock
[x.x.x.x] > rm -f ~/app/.dep/deploy.lock
[x.x.x.x] < ssh multiplexing initialization
[x.x.x.x] < Permission denied, please try again.
[x.x.x.x] < Permission denied, please try again.
[x.x.x.x] < runner@x.x.x.x: Permission denied (publickey,password).

In Client.php line 103:

  [Deployer\Exception\RuntimeException (-1)]                     
  The command "rm -f ~/app/.dep/deploy.lock" failed.    

  Exit Code: -1 (Unknown error)                                  

  Host Name: x.x.x.x                                       

  ================                                               
  Permission denied, please try again.                           
  Permission denied, please try again.                           
  runner@x.x.x.x: Permission denied (publickey,password).  

I can see it tries to connect as runner@x.x.x.x, but my deploy.php has another user

host('x.x.x.x')
    ->set('remote_user', 'user')
    ->set('deploy_path', '~/{{application}}');

Any ideas? Thanks

antonmedv commented 2 years ago

Specify version of deployphp/action.

Closing as this is not an Deployer issue.

hotrush commented 2 years ago

I think action version is the latest - uses: deployphp/action@v1

Sorted it out yesterday, the problem is that I tried to setup deploying with v7 deployer version, but action downloads v6 by default (probably because v7 is rc for now). But it doesn't mentioned anywhere in docs or readmes, so some confusing. Thanks

antonmedv commented 2 years ago

In readme:

  # Deployer version to download from deployer.org.
  # First, the action will check for Deployer binary at those paths:
  # - `vendor/bin/dep`
  # - `deployer.phar`
  # If the binary not found, phar version will be downloaded from
  # deployer.org.
  # Optional.
  deployer-version: "7.0.0"
hotrush commented 2 years ago

Yes, but it downloads v6 by default, not v7. That's why it wasn't obvious for me.

For example the next wording will be more clear

  # Deployer version to download from deployer.org.
  # First, the action will check for Deployer binary at those paths:
  # - `vendor/bin/dep`
  # - `deployer.phar`
  # If the binary not found, phar version will be downloaded from
  # deployer.org.
  # Optional. Default: "^6.0.0"
  deployer-version: "7.0.0"