Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Simply Deploying code

ragnar May 30, 2018

Hi

I want to deploy the code that I have in bitbucket to my remote server. After that some other tasks.

I have the keys, known host fingerprint is fetched. Now I need to know how to tell bitbucket on commit, deploy my code to a simple VM and restart httpd.

How to do that?

1 answer

1 accepted

1 vote
Answer accepted
Matt Ryall
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2018

Try putting in the commands you use to deploy code to the VM from your machine. Uploading the code could be done using rsync (or scp/sftp, depending on what you prefer):

pipelines:
default:
- step:
script:
- rsync -rvz . user@my.server.com:/path/to/website/ # upload code
- ssh user@my.server.com "httpd -k graceful" # restart apache

Note that you don't normally need to restart Apache to pick up changed files. They should appear as soon as you change the files with rsync. So only the first command above should be necessary to deploy your code.

If you're still having trouble, a bit more information about the type of project you're deploying, what hosting you're using, and any error messages, would help us be more specific.

ragnar May 30, 2018

Thanks!

That did the job. The apache restart command is just so i could know how to run some other commands if there is some need.

The hardest part for me was to find out what kind of logic is needed to run some common bash one line commands. If there is some official documentation for the same problem, could you please refer it. If not, could you please create it. Some times the easiest things can get challenging and hinder further tasks.

It would be great to see some full real life examples on how different teams have built their whole pipelines and deployment systems. At the moment it is not so easy to find some good mature examples.

Linette
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2018

Hi Ragnar,

Glad Matt was able to help you out! (for context, I'm the new writer for Bitbucket Pipelines)

Whilst we do have some examples which incidentally have some basic code in, in our configure bibucket-pipelines.yml page we really don't have anything that makes the whole journey obvious with real world type examples, and that's something I'm hoping to change as I settle into the role.

Thanks for getting involved with the community, and I hope your journey with Pipelines is a great one!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events