Cookies ahead

Our support chat tool "Intercom" would like to collect some more data on you. See the related link for more details.

Docs

Codeberg

🏔️

Free as in freedom.

Integrate Codeberg with fortrabbit using Woodpecker CI.

At the time of writing, there is no native fortrabbit Codeberg app. This article describes how to set up a manual integration using Codeberg CI (Woodpecker). Ping us with your requirements or if something is not working out here.

About Codeberg

Codeberg is a democratic community-driven, non-profit software development platform operated by Codeberg e.V. It is based on Forgejo (a fork of Gitea) and provides a privacy-friendly alternative to commercial Git hosting services.

Deployment pipeline

Codeberg uses Woodpecker CI for its CI/CD pipelines. You can use it to deploy your code to fortrabbit. This involves creating a pipeline that syncs your code to fortrabbit using rsync.

Prerequisites

  1. Generate SSH key: You need a dedicated SSH key pair for the pipeline. Generate one locally (e.g. ssh-keygen -t ed25519 -f codeberg_deploy_key -C "Codeberg CI").
  2. Add to fortrabbit: Copy the public key (codeberg_deploy_key.pub) and add it as a deploy key in the fortrabbit dashboard.
  3. Add to Codeberg:
    • Go to your repository settings in Codeberg.
    • Navigate to Settings > Secrets.
    • Add a new secret named SSH_PRIVATE_KEY and paste the content of your private key (codeberg_deploy_key).

Example pipeline

Create a .woodpecker.yml file in the root of your repository. The following code is UNTESTED:

steps:
  deploy:
    image: alpine:latest
    secrets: [ssh_private_key]
    when:
      branch: main
      event: push
    commands:
      - 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

Written by a human. Review, grammar checks and typo fixes by AI.

AI use & editorial processEdit on GitHub ↗