GitHub

Published

Updated

🐙

Connect your GitHub repositories.

GitHub connects to fortrabbit through the fortrabbit GitHub App, which deploys on every push. For a custom pipeline, GitHub Actions can build the code and copy it to fortrabbit with rsync instead.

About GitHub

GitHub, owned by Microsoft, hosts Git repositories with pull requests, issues and CI. Git is the version control system, GitHub hosts it, see the Git intro.

Pricing

GitHub Free includes unlimited public and private repositories, see GitHub pricing. fortrabbit charges nothing for the integration.

Built-in GitHub integration

The fortrabbit GitHub App connects repositories to apps and deploys on every push. The stack detector and the software templates preset the build commands and post deploy commands. See the deployment intro.

Using GitHub Actions

GitHub Actions runs tests and builds on GitHub. Two ways to combine it with fortrabbit:

Provide GitHub Actions code access

The rsync route needs SSH access. Use a key pair of its own: the public key as a deploy key of the environment, the private key as a secret in GitHub.

  1. On your local machine, generate a dedicated key pair: ssh-keygen -t ed25519 -f /tmp/key-github -N ""
  2. In the dashboard, add the public key (/tmp/key-github.pub) as a deploy key in the SSH keys settings of the environment.
  3. On GitHub, go to the repository → Settings → Secrets and variables → Actions and add a new secret named SSH_PRIVATE_KEY with the contents of the private key (/tmp/key-github).
  4. Delete both key files from /tmp once done.

Example: deploy via rsync

This workflow builds assets with Node.js, installs Composer dependencies, and deploys the result to fortrabbit via rsync.

.github/workflows/deploy.yml:

name: Deploy to fortrabbit
on:
  push:
    branches:
      - main
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    env:
      DESTINATION: '{{app-env-id}}@ssh.{{region}}.frbit.app'
    steps:
      - uses: actions/checkout@v4

      - name: Set up SSH
        uses: webfactory/ssh-agent@v0.9.0
        with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version-file: 'package.json'

      - name: Install Node dependencies and build
        run: |
          npm ci
          npm run build

      - name: Remove source assets
        run: rm -rf <your-source-assets-folder>

      # Install PHP dependencies
      - name: Install Composer dependencies
        run: |
          composer validate
          composer install --prefer-dist --no-dev --no-progress --optimize-autoloader --ignore-platform-reqs
      # Deploy
      - name: Deploy via rsync
        run: |
          rsync -azh -e 'ssh -o StrictHostKeyChecking=no' \
            ./ \
            --rsync-path='rsync' \
            $DESTINATION:~/
yaml
  • DESTINATION is the SSH address of the environment, shown in the dashboard.
  • StrictHostKeyChecking=no skips the host key check. To check it, add the host key of fortrabbit to known_hosts in the workflow instead.

Written by humans and AI in collaboration.

AI use & editorial processEdit on GitHub ↗