Skip to main content

Bitbucket

If you are using ServerAvatar to manage your servers and sites, You can quickly deploy a site on your server using a simple Bitbucket auto installer.

Once you have connected your server with ServerAvatar, You can follow the steps given below to automatically install Bitbucket repository on your server.

Step 1: First, you need to Integrate Git, Navigate to DashboardIntegrationGit.

Step 2: Click on Bitbucket Link Bitbucket button like the below image. After that, allow authorize to serveravatar for deploy your project and your bitbucket account connected with serveravatar account.

Application - Bitbucket

Step 3: Now, you can deploy a site from Bitbucket. First, you need to create Custom Application.

Step 4: Navigate to that Created Application DashboardAuto Deploy.

Step 5: Click on Bitbucket Install Now button like the below image.

Application - Bitbucket

Step 6: First you need to Generate ssh-key for deployment, and Copy that ssh-key to put into bitbucket account.

Application - Bitbucket

Step 7: Login into your Integrated bitbucket account, and Navigate to Personal SettingsSSH keysAdd key.

  • Enter Label and Paste your Generated ssh-key like the below image.
  • Then click on the Add key button.

Application - Bitbucket

Step 8: After that, select Integrated account, then select their Repository and select their Branch.

  • Then click on the Install Now button.

    Application - Bitbucket

Step 9: If you want to Enable Auto Pull, then Navigate to Created Application DashboardGit.

  • Then click on Enable like the below image.

    Application - Bitbucket

  • After that, Copy Webhook URL.

    Application - Bitbucket

  • Login into your Integrated bitbucket account, and In your Selected repository, navigate to Repository settingsWebhooksAdd webhook, and use the following settings:

    • Title: Enter title
    • URL: Your Copied Webhook URL
    • Active: Check
    • SSL/TLS: Uncheck for Skip certificate verification
    • Triggers: Repository push
  • Click Save to save your settings, and the request should start working.

    Application - Bitbucket

  • You can see your Request logs like the below image, and click on Enable History.

    Application - Bitbucket

Step 10: If you want to Checkout branch then click on Change Branch and select checkout branch.

Application - Bitbucket

  • You can see your commit history from Webhook History section.

    Application - Bitbucket

Step 11: If you want to Run Custom Script after pull request, then enter script in Deployment Script section and Save it.

Application - Bitbucket

  • When the webhook receives a push request, you might want to run a Custom Script to clear some cache or upgrade your web application. You can write a script to do this command in Deployment Script section.
info

Please use # (hashtag) for comment in Deployment Script.

  • The script will be running inside your Application root folder. If your deployment script includes composer and php command, it will use default PHP-CLI. If you want to run a script using a different PHP version, you must use replacer.

    Replacer

    • Replacer is where you can tell the deployment script to run specific php version.

    • For example this: {PHP70} artisan cache:clear

    • Will be translated to this: /usr/bin/php7.0 artisan cache:clear

    • You can always type full path to PHP version if you don't want to use replacer.