Skip to content

Deployer breaks when server is managed by Serverpilot.io due to SSH MOTD #2541

@pryley

Description

@pryley
  • Deployer version: v7.0.0-beta.23
  • Deployment OS: macOS 11.3

YAML

import: 
    - recipe/laravel.php
    - contrib/php-fpm.php
    - contrib/npm.php

config:
  application: website
  branch: main
  base_deploy_path: /srv/users/serverpilot/apps
  config_file: ~/.ssh/config
  php_fpm_service: php7.4-fpm-sp
  remote_user: serverpilot
  repository: git@github.com:user/website.git
  shared_dirs:
    - users
  ssh_multiplexing: true
  writable_dirs:
    - storage/statamic

hosts:
  production:
    deploy_path: '{{base_deploy_path}}/{{application}}'
    hostname: domain.com
  staging:
    deploy_path: '{{base_deploy_path}}/staging-{{application}}'
    hostname: staging.domain.com

tasks:
  deploy:
    - deploy:prepare
    - deploy:vendors
    - artisan:storage:link
    - artisan:view:cache
    - artisan:config:cache
    - artisan:optimize
    - npm:install
    - npm:run:production
    - please:cache:clear
    - deploy:publish
    - php-fpm:reload
  npm:run:production:
    script:
      - 'cd {{release_or_current_path}} && npm run production'
  please:assets:meta:
    script:
      - 'cd {{release_or_current_path}} && php please assets:meta'
  please:git:commit:
    script:
      - 'cd {{release_or_current_path}} && php please git:commit'
  please:glide:clear:
    script:
      - 'cd {{release_or_current_path}} && php please glide:clear'
  please:cache:clear:
    script:
      - 'cd {{release_or_current_path}} && php please cache:clear'

after:
  deploy:failed: deploy:unlock

Here is the error

[staging] run cd /srv/users/serverpilot/apps/staging-website && ([ -f /srv/users/serverpilot/apps/staging-website/.dep/repo/HEAD ] || **********************************************************************
*  Learn about SSH, SFTP, PHP, MySQL, apps, cron, and more at:       *
*  https://serverpilot.io/community/articles/system-user-guide       *
*                                                                    *
*  To use a specific PHP version for the 'php' command, see:         *
*  https://serverpilot.io/community/articles/how-to-use-the-php-cli  *
**********************************************************************
/usr/bin/git clone --mirror git@github.com:user/website.git /srv/users/serverpilot/apps/staging-website/.dep/repo 2>&1)
[staging] **********************************************************************
[staging] *  Learn about SSH, SFTP, PHP, MySQL, apps, cron, and more at:       *
[staging] *  https://serverpilot.io/community/articles/system-user-guide       *
[staging] *                                                                    *
[staging] *  To use a specific PHP version for the 'php' command, see:         *
[staging] *  https://serverpilot.io/community/articles/how-to-use-the-php-cli  *
[staging] **********************************************************************
[staging] bash: line 1: release: command not found
[staging] bash: line 2: release: command not found
[staging] bash: line 3: release: command not found
[staging] bash: line 4: release: command not found
[staging] bash: line 5: release: command not found
[staging] bash: line 6: release: command not found
[staging] bash: line 7: release: command not found

Here is the fix

  1. Edit the following file: /etc/profile.d/serverpilot-login-message.sh
  2. Delete the following lines to remove the Message of the day:
elif [[ "$HOME" == /srv/users/* ]]; then
    echo "**********************************************************************"
    echo "*  Learn about SSH, SFTP, PHP, MySQL, apps, cron, and more at:       *"
    echo "*  https://serverpilot.io/community/articles/system-user-guide       *"
    echo "*                                                                    *"
    echo "*  To use a specific PHP version for the 'php' command, see:         *"
    echo "*  https://serverpilot.io/community/articles/how-to-use-the-php-cli  *"
    echo "**********************************************************************"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions