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:
- Keep the GitHub App, and let a workflow call a deploy hook once the tests pass, with the deployment trigger set to manual.
- Build in the workflow and copy the result with rsync over SSH. Set the deployment trigger to manual, so pushes do not also deploy through the GitHub App. The blog post on GitHub Actions has two templates.
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.
- On your local machine, generate a dedicated key pair:
ssh-keygen -t ed25519 -f /tmp/key-github -N "" - In the dashboard, add the public key (
/tmp/key-github.pub) as a deploy key in the SSH keys settings of the environment. - On GitHub, go to the repository → Settings → Secrets and variables → Actions and add a new secret named
SSH_PRIVATE_KEYwith the contents of the private key (/tmp/key-github). - Delete both key files from
/tmponce 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:~/
DESTINATIONis the SSH address of the environment, shown in the dashboard.StrictHostKeyChecking=noskips the host key check. To check it, add the host key of fortrabbit toknown_hostsin the workflow instead.