It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Simply Deploying code

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 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.

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 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
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,042 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you