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 Dashboard → Integration → Git.
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.
Step 3: Now, you can deploy a site from Bitbucket. First, you need to create Custom Application.
Step 4: Navigate to that Created Application Dashboard → Auto Deploy.
Step 5: Click on Bitbucket Install Now button like the below image.
Step 6: First you need to Generate ssh-key for deployment, and Copy that ssh-key to put into bitbucket account.
Step 7: Login into your Integrated bitbucket account, and Navigate to Personal Settings → SSH keys → Add key.
- Enter Label and Paste your Generated ssh-key like the below image.
- Then click on the Add key button.
Step 8: After that, select Integrated account, then select their Repository and select their Branch.
Then click on the Install Now button.
Step 9: If you want to Enable Auto Pull, then Navigate to Created Application Dashboard → Git.
Then click on Enable like the below image.
After that, Copy Webhook URL.
Login into your Integrated bitbucket account, and In your Selected repository, navigate to Repository settings → Webhooks → Add 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.
You can see your Request logs like the below image, and click on Enable History.
Step 10: If you want to Checkout branch then click on Change Branch and select checkout branch.
You can see your commit history from Webhook History section.
Step 11: If you want to Run Custom Script after pull request, then enter script in Deployment Script section and Save it.
- 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.