GitLab
🦊
Tanuki, a Japanese racoon dog.
Integrate GitLab with your fortrabbit workflow using CI/CD pipelines.
At the time of writing, there is no native fortrabbit GitLab app. This article describes how to set up a manual integration using GitLab CI/CD. Ping us with your requirements or something is not working out here.
# About GitLab
GitLab is a popular tool that provides a Git-repository manager with wiki, issue-tracking and CI/CD pipeline features. You can use GitLab CI/CD to deploy your code to fortrabbit. This involves creating a pipeline that syncs your code to fortrabbit using rsync.
# Prerequisites
- Generate SSH key: You need a dedicated SSH key pair for the pipeline. Generate one locally (e.g.
ssh-keygen -t ed25519 -f gitlab_deploy_key -C "GitLab CI"). - Add to fortrabbit: Copy the public key (
gitlab_deploy_key.pub) and add it as a deploy key in the fortrabbit dashboard. - Add to GitLab: Copy the private key (
gitlab_deploy_key) and add it to your GitLab project's CI/CD variables asSSH_PRIVATE_KEY.
# Example workflow
Create or update your .gitlab-ci.yml file in the root of your repository. The following code is UNTESTED:
stages: - deploy deploy_production: stage: deploy image: alpine:latest only: - main 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:yaml