Deploy code to custom server

Nikolay Nikolov February 9, 2019

Hi, my servers are not in Amazon or some similar hosting. How can I deploy my code to a custom webserver? Is there some tutorial for this?

Now I am deploying from my dev server, where I am starting a script, wchich is copyng all the code to my prod server with scp. How to do this from bitbucket deployment?

Thanks!

Nik

1 comment

Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 9, 2019

Hi Nikolay,

Just confirming that you're using Bitbucket Cloud (bitbucket.org) rather than Bitbucket S Server (your own installation)?

If you are using Bitbucket Cloud, are you using Bitbucket Pipelines?

If so, you can set up custom deployment using Pipelines - here is a guide: https://confluence.atlassian.com/bitbucket/bitbucket-deployments-940695276.html

I hope that helps!

Like Nikolay Nikolov likes this
Nikolay Nikolov February 10, 2019

Hi Martyn, thanks!

I will play a bit with this deployment settings.

Nikolay Nikolov February 10, 2019

I have another question. When I use the steps for example for the branch feature/*

feature/*:
- step:
name: Build feature
script:
- echo "done Tests"
- step:
name: Deploy to staging
deployment: staging
trigger: manual
script:
- sh deploy/deploy.sh "staging" $BITBUCKET_BRANCH
- step:
name: Deploy to production
deployment: production
trigger: manual
script:
- sh deploy/deploy.sh "production" $BITBUCKET_BRANCH

Then I can not deploy direct to production, without to deploy to staging. Is there some possibility, where the QA can choose, where to deploy?

For example I want to set 3 feature servers, where the QA can deploy to test the branch:

Deploy to qa_server1 

Deploy to qa_server2

Deploy to qa_server3

At this moment the QA can not deploy direct to qa_server3, without to deploy on qa_server1 and qa_server2 .

How can I solve this?

Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 10, 2019

Hi Nikolay,

 

One option to try is to use a number of custom pipelines.

Each custom pipeline must be triggered manually, and when you trigger it you can select which pipeline to trigger. 

You can read more about custom pipelines here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html#Configurebitbucket-pipelines.yml-ci_custom

So you could have the following pipelines:

1. Build feature (automatic) - would have only one step from your existing pipeline above*

2. Deploy to qa_server1

3. Deploy to qa_server2

4. Deploy to qa_server3

5. Deploy to production

 

I hope that helps!

Nikolay Nikolov February 10, 2019

Hi Martyn, how can I add custom script only for the branches feature/* 

Is this possible?

Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 10, 2019

Do you mean get a pipeline to run for only some branches?

Here is an example to do just that: https://confluence.atlassian.com/bitbucket/branch-workflows-856697482.html 

Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 10, 2019

If you're trying to get a step to run only for feature/* branches, you could run the custom script for every branch but add logic to the script that only executes certain steps based on the branch name.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events