Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Automated deployment from my repo to remote private server

Hi guys, i have enabled BB pipeline and wanted to auto deploy to my staging remote server when a commit happens either sftp or ssh method.

The problem now here is my staging server in GCP do not have a public IP. Currently i will perform git pull from server each time my dev perform a commit.

I want to keep my server as private and please suggest how i can push the commit to remote server automatically from my BB cloud.

Thanks

1 answer

1 accepted

0 votes
Answer accepted
Norbert C Atlassian Team Dec 13, 2021

Hi Poobalan,

Thank you for contacting Atlassian Community! I'm Norbert from Bitbucket Cloud Support, it's nice to meet you! Also, welcome to the Atlassian Community :)

I'd like to inform you that in case your staging server doesn't have a public IP, unfortunately Bitbucket Pipelines will not be able to connect as Bitbucket Pipelines needs an accessible IP in order to connect to your instance.

As a workaround what I'd like to suggest you is to host the Bitbucket Pipelines in your own environment using Pipelines Runners

With Pipelines Runners, you don't need to have a public IP and in case you run the builds in your own internal network, you will be able to access the other IPs within your network.

Please let us know if you have any further question?

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Hi Norbert, Thanks for the feedback and alternative method. I will test it out.

Also as additional info for you, i can connect to my remote server with openVpn and ssh. So it there a way to integrate the pipeline with the OpenVpn or can i modify the deployment yaml file so the push happens via vpn to my private remote server. im just checking if i can use my existing pipeline with this method.

Thanks!

Norbert C Atlassian Team Dec 14, 2021

Hi Poobalan,

Unfortunately it's not possible to connect Bitbucket Pipelines to a VPN. 

Currently we have a feature request for this as you can see in the link below:

BCLOUD-12753 - Allow customers to connect the pipelines builds to their own VPN server

 

Our development team will give a first-hand update on that ticket if there's any progress made so I would suggest keeping a watch and vote for it.

 

Do note however that there's no ETA on enhancement request, and all enhancements are implemented with this policy in mind: Implementation of New Features Policy

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Hi Norbert, noted on the vpn feature.

About the pipeline runner, all i need to do is add runner in my repo, and then set up a server with docker and run the token command to register it?

The question, can i have this runner host in my private network? similar to my remote server network? can please enlighten me on this or share some guides?

Hi Norbert, ignore my previous reply.

Here is the goof update, i have successfully setup configure my pipeline runner and its online now.

So all i wanted to happen is, when ever a commit to master branch i want this pipeline to be run my deploy.sh script which sits in my remote server via ssh. (my deploy.sh will perform git pull from my BB repo).

So the clarity is, where should i configure the ssh access to my remote server? In my bitbucket repo or in my runner host?

if you have a sample script/guide please share and enlighten with me.

Thanks!

Norbert C Atlassian Team Dec 14, 2021

Hi Poobalan,

Based on your description, I believe the following Atlassian Pipes in suitable for you: https://bitbucket.org/atlassian/ssh-run/src/master/

What this Atlassian Pipes does is that it connects to your server via SSH and then you can setup that it runs a script on the remote server. A sample script would be the following:

script:
  - pipe: atlassian/ssh-run:0.4.0
    variables:
      SSH_USER: 'user'
      SERVER: 'IP of the server'
SSH_KEY: $MY_SSH_KEY MODE: 'command' COMMAND: './deploy.sh'

Regarding the SSH key, what I would like to suggest you is to encode the private SSH key to a base64 format and use it as an environmental variable in your Pipelines.

Please let me know if it was successful :).

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

184 views 2 4
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