Bitbucket
🪣
Bring your own bucket.
Integrate the second most popular Git-as-a-service provider with your fortrabbit workflow.
At the time of the writing, there is no fortrabbit Bitbucket app to automatically integrate Bitbucket. Also, this article might be outdated. Get in touch with us if you want this feature or something is not working out.
# About Bitbucket
Bitbucket, similar to GitHub, is a Git hosting service that offers advanced Git work-flows, such as 'pull requests'. It offers private repos in a free plan. It also offers paid plans for "growing teams".
# Deployment pipeline
You can use Bitbucket Pipelines to deploy your code to fortrabbit. This involves creating a pipeline that syncs your code to the fortrabbit App using rsync.
# Prerequisites
- Generate a dedicated SSH key pair locally (e.g.
ssh-keygen -t ed25519 -f bitbucket_deploy_key -C "Bitbucket CI"). - Copy the public key (
bitbucket_deploy_key.pub) and add it as a deploy key in the fortrabbit dashboard. - Copy the private key (
bitbucket_deploy_key) and add it to your Bitbucket repository variables asSSH_PRIVATE_KEY.
# Example pipeline
Create or update your bitbucket-pipelines.yml file in the root of your repository. The following code is UNTESTED:
image: alpine:latest pipelines: branches: main: - step: name: Deploy to Production script: - apk add --no-cache rsync openssh-client # Setup SSH agent - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh # Add fortrabbit to known hosts (replace region if necessary) - ssh-keyscan -H ssh.{{region}}.frbit.app >> ~/.ssh/known_hosts # Sync to fortrabbit - rsync -av --delete ./ {{app-env-id}}@ssh.{{region}}.frbit.app:yml