Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.6 KiB
ARM Deploy to OrangePi via Ansible — Design Spec
Overview
After a successful Gitea release, a separate workflow automatically deploys the ARM64 Docker image to an OrangePi using Ansible. The Gitea runner acts as the Ansible controller and SSHes into the OrangePi to copy artifacts and restart the container.
Trigger
A new deploy.yml workflow triggers via workflow_run when the Release Pipeline workflow completes successfully. This keeps deployment concerns separate from the build/release workflow.
New Files
.gitea/workflows/deploy.yml— deployment workflowansible/inventory.ini— Ansible inventory for the OrangePiansible/deploy.yml— Ansible playbook
Workflow Steps (deploy.yml)
- Checkout the repository (to access ansible files)
- Install Ansible on the runner
- Write
ANSIBLE_SSH_KEYsecret to a temp file (/tmp/ansible_key) withchmod 600 - Resolve the release tag from
github.event.workflow_run.head_branch - Download
brainwave-arm64.tar.gzanddocker-compose.arm64.ymlfrom the Gitea release usingwgetagainst the Gitea release download URL - Run
ansible-playbook ansible/deploy.yml -i ansible/inventory.ini - Clean up the SSH key temp file
Playbook Tasks (ansible/deploy.yml)
Runs against the orangepi host group. Tasks in order:
- Ensure
/home/user/brainwavedirectory exists - Copy
brainwave-arm64.tar.gzto/home/user/brainwave/ - Copy
docker-compose.arm64.ymlto/home/user/brainwave/docker-compose.yml - Load the Docker image:
docker load -i /home/user/brainwave/brainwave-arm64.tar.gz - Run
docker compose up -din/home/user/brainwave
Inventory (ansible/inventory.ini)
[orangepi]
orangepi ansible_host={{ ANSIBLE_HOST }} ansible_user={{ ANSIBLE_USER }} ansible_ssh_private_key_file=/tmp/ansible_key
Host and user are injected at runtime from Gitea secrets via environment variables or extra-vars.
Secrets Required
| Secret | Description |
|---|---|
ANSIBLE_HOST |
OrangePi IP address or hostname |
ANSIBLE_USER |
SSH username on the OrangePi |
ANSIBLE_SSH_KEY |
Full content of the SSH private key |
These must be added to the Gitea repository settings under Settings → Secrets.
Deploy Directory
All files are deployed to /home/user/brainwave on the OrangePi. The docker-compose file is renamed to docker-compose.yml so docker compose commands work without specifying a filename.
Error Handling
- The workflow only runs if
github.event.workflow_run.conclusion == 'success', preventing deploys from failed releases. - The SSH key temp file is always cleaned up in a final step regardless of success or failure.