Search code examples
bitbucket-pipelineslaravel-envoy

How to setup deployment to the remote SSH server using pipelines


I'm creating pipeline which will responsible to run deployment script on my remote server when I commit changes to develop branch. I am using laravel envoyer. what I need is just to run envoy run deploy on my remote server after commit.

I was using steps described here

Here is bitbucket-pipelines.yml config

pipelines:
 branches:
  develop:
   - step:
    script:
     - ssh -t user@example.com
     - cd /var/www/project_folder/html
     - envoy run deploy

Infinite execution happening and I get following message

Pseudo-terminal will not be allocated because stdin is not a terminal. Warning: Permanently added the RSA host key for IP address '104.236.241.243' to the list of known hosts. Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-138-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud 156 packages can be updated. 0 updates are security updates. * System restart required * mesg: ttyname failed: Inappropriate ioctl for device


Solution

  • The error shows what is wrong, your server needs a restart, also the next two commands will not be executed on the remote server, change the ssh command to include the commands to execute on the remote server:

    ssh -t user@example.com "cd /var/www/project_folder/html && envoy run deploy"