Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy from bitbucket to live server

I recently start using git and have some doubt about the best workflow.

1 - Is best to use an online repository like Bitbucket as intermetiate between my local and remote servers? O it will be better to deploy directly from local to remote?

I think it will be great to have this middle repository because it will be like a backup, but also will complicate my workflow.

2 - If I push my code to Bitbucket what is the best way to deploy the code to remote server? I have found some differents ways:

  • Create a git repository on live server I make a pull from bitbucket
  • Use bitbucket hooks like in this posts: http://jonathannicol.com/blog/2013/11/19/automated-git-deployments-from-bitbucket/ or this other http://brandonsummers.name/blog/2012/02/10/using-bitbucket-for-automated-deployments/
  • Use specialiced service like http://dploy.io/
  • Use an automation tool like capistrano

I want the more efective way in long terms that don't give me a lot of headaches. I don't mind to pay or learn something new (I never use capistrano..).

If you know any alternative way I would love to read about!

like image 892
ThemesCreator Avatar asked Oct 22 '14 21:10

ThemesCreator


People also ask

How do Bitbucket deployments work?

The key tenet of continuous delivery is keeping your code always releasable. In Bitbucket, that means you are doing feature branches with branch-based validation (automated/manual testing and code review), then merging to the default main branch with release-ready code that is automatically or manually deployed.

Does bitbucket server have pipelines?

Bitbucket Pipelines is an integrated CI/CD service built into Bitbucket. It allows you to automatically build, test, and even deploy your code based on a configuration file in your repository. Essentially, we create containers in the cloud for you.

How connect Bitbucket to ec2?

Sign in to the AWS Management Console, and open the AWS Developer Tools console at https://console.aws.amazon.com/codesuite/settings/connections . Choose Settings > Connections, and then choose Create connection. To create a connection to a Bitbucket repository, under Select a provider, choose Bitbucket.


1 Answers

I've just gone through the same setup myself with a rails 4 project I've been working on locally, and now deploying to a remote server.

You should most definitely be using some sort of source version control! I'm currently using bitbucket which has been awesome for my setup and workflow, as well as having the added benefit of being free for private repo's.

You are on the right track there, my workflow looks like this currently:

local dev -> commit to bitbucket Then using capistrano, even though the script is run locally the actions still get fired remotely on the server, so that looks like this.

                                               (bitbucket repo)
                                                       ^
                                                       |
(local dev) deploy capistrano -> (server) fetches from bitbucket and runs capistrano commands

The first two resources detail the process I followed: http://robmclarty.com/blog/how-to-deploy-a-rails-4-app-with-git-and-capistrano

http://matteodepalo.github.io/blog/2013/03/07/how-i-migrated-from-heroku-to-digital-ocean-with-chef-and-capistrano/

When you want to get a little more fancy and automated I suggest adding in something like Chef that you can use to configure the server itself (so you can spin up VM's or VPS's and run a few scripts to have it setup in a couple minutes as opposed to installing all the packages manually)

like image 108
user1022156 Avatar answered Oct 16 '22 14:10

user1022156