Automatic deployments - Laravel Bitbucket Repo > Larasail > Digital Ocean

chrissutcliffe121

Dec 27th, 2021 11:15 AM

I have a Laravel website (repo in Bitbucket) deployed to a Digital Ocean droplet that I setup using Larasail (https://github.com/thedevdojo/larasail).

Every time I push code to Bitbucket, I want it to be deployed to Digital Ocean automatically.

What is the best way to achieve this?

I previously used Laravel Forge but would like to try and avoid the monthly cost.

bobbyiliev

Dec 29th, 2021 02:00 AM

Hi there,

I've not done this with bitbucket, but with GitHub using the following package:

https://github.com/deployphp/deployer

With bitbucket this should be achievable using their Pieplens. I had a similar discussion here:

https://www.digitalocean.com/community/questions/how-to-set-up-automatic-deploy-with-bitbucket-and-droplet

As a side note is there a specific reason why you prefer bitbucket rather than GitHub?

Best,

Bobby

chrissutcliffe121

Dec 29th, 2021 09:25 AM

Thanks I will take a look at deployer.

From having a quick look, I guess I don't need deployer to provision as I am using larasail for that, its just the deployment aspect. Or may be it would be easier to do everything via deployer.

As for bitbucket/github - I think I use bitbucket because years ago you couldn't have free private repos on github. However I do have an account and see you can easily move repos from bitbucket to github, so I could easily change.

Thanks,

bobbyiliev

Dec 29th, 2021 09:32 AM

Hi there,

Ah yes I remember that time too. I used to use GitLab for the exact same reason but moved to GitHub a year or so ago.

There is a Deployer package for Laravel too which might be helpful:

Laravel Deployer

chrissutcliffe121

Dec 29th, 2021 10:44 AM

Thanks for the link.

This article seems to be exactly what I am looking for: https://lorisleiva.com/deploy-your-laravel-app-from-scratch/install-and-configure-deployer

Do you use Deployer? What do you use to run Laravel on your local machine out of interest? I am using Laragon (old school!) and it doesn't look like deployer will work. I get 'dep' is not recognised in my terminal.

Chris.

bobbyiliev

Dec 29th, 2021 11:05 AM

Hey Chris,

What I've been doing recently is to use a small $5/mo remote server for my dev work. I basically setup the whole server using LaraSail then with VS Code there is that extension called Remote SSH, which let's you connect to your server over SSH directly via VS Code and it is just like editing files locally.

Kind of an odd apraoch but it's nice that I have my dev projects up and running all the time and I can access them via my different laptops/PCs. Also it is nice to have identical dev and prod environments.

Also, I've used deployer a few months ago together with LaraSail, I remember that it worked almost out of the box with some minor configuration changes.