Skip to content
← Back to activity

Immutable solution version

Using BitBucket Pipelines to Deploy onto VPS via SSH Access

Version 2Sign in to save

Complete solution

Guide Using BitBucket Pipelines to Deploy onto VPS via SSH Access: are going to be run into a Docker container and not on your VPS. The commands you are defining under `script`. Use this when you hit exactly this in Using. Not for different errors or different tools.

TL;DR: are going to be run into a Docker container and not on your VPS. The commands you are defining under script

Fix

  1. are going to be run into a Docker container and not on your VPS. Expected: this specific failure stops.

  2. Create a bash file. Expected: this specific failure stops.

  3. on your VPS, to do all your deployment tasks [code: #/var/www/html php artisan down git pull origin master composer install --no-dev --prefer-dist php artisan cache:clear php artisan config:cache php artisan route:cache php artisan migrate php artisan up echo 'Deploy finished.' ] 2 - Create a script. Expected: this specific failure stops.

  4. in your repository, like so [code: echo "Deploy script started" cd /var/www/html sh pull.sh echo "Deploy script finished execution" ] 3 - Finally update your. Expected: this specific failure stops.

Details

The commands you are defining under script Instead, put all your commands in a bash file on your server. pull.sh deploy.sh bitbucket-pipelines.yml file [code: image: atlassian/default-image:latest pipelines: default: - step: deployment: staging script: - cat ./deploy.sh | ssh [user]@[host] - echo "Deploy step finished" ] I would recommend to already have your repo cloned on your VPS in /var/www/html and test your pull.sh file manually first.

When to use

You hit exactly this: Using BitBucket Pipelines to Deploy onto VPS via SSH Access in Using.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

Using.

Evidence

Asked on Stack Overflow so:50053687: Stack Overflow #50053687 (score 38, accepted answer, 78 votes): I have been trying to wrap my head around how to utilise BitBucket's Pipelines to auto-deploy my (Laravel) application onto a Vultr Server instance.

I have the following steps I do manually, which I am trying to replicate autonomously:

I commit my changes and push to BitBucket repo I log into my server using Terminal: ssh root@ipaddress I cd to the correct directory: cd /var/www/html/app/ I then pull from my BitBucket repo: git pull origin master I then run some commands: composer install, php artisa The verified fix/answer: The commands you are defining under script` are going to be run into a Docker container and not on your VPS.

Instead, put all your commands in a bash file on your server.

1 - Create a bash file pull.sh on your VPS, to do all your deployment tasks

[code: #/var/www/html php artisan down git pull origin master composer install --no-dev --prefer-dist php artisan cache:clear php artisan config:cache php artisan route:cache php artisan migrate php artisan up echo 'Deploy finished.' ]

2 - Create a script deploy.sh in your repository, like so

[code: echo "Deploy script started" cd /var/www/html sh pull.sh echo "Deploy script finished execution" ]

3 - Finally update your bitbucket-pipelines.yml file

[code: image: atlassian/default-image:latest

pipelines: default:

  • step:

deployment: staging script:

  • cat ./deploy.sh | ssh [user]@[host]
  • echo "Deploy step finished" ]

I would recommend to already have your repo cloned on your VPS in /var/www/html and test your pull.sh file manually first. Source: https://stackoverflow.com/questions/50053687/using-bitbucket-pipelines-to-deploy-onto-vps-via-ssh-access

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_a_D35HaIsdisdGscCfHpmw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Using BitBucket Pipelines to Deploy onto VPS via SSH Access <span>— Vectle</span></a>