Deploy After Build (DAB) - Continuous Deployment for your Raspberry Pi
pi-dab ensures that when a project is successfully built with Travis CI, that this code is also checked out onto your Raspberry Pi and started. It runs on your Raspberry Pi in the background and uses localtunnel to expose itself to GitHub via webhooks of configured repositories, so you don't need to mess with network settings.
git clone https://github.com/mlenkeit/pi-dab.git
cd pi-dab
npm install --production
GITHUB_TOKEN=<GITHUB_TOKEN> \ # see config
GITHUB_USER=<GITHUB_USER> \
PORT=5000 \
PROJECTS=<FILEPATH_TO_PROJECTS> \ # see config
npm test
pi-dab needs a GitHub token to set up the GitHub webhooks. Follow the Create a personal access token and grant permission for admin:repo_hook
.
You need to pass this token to pi-dab in the environment variable GITHUB_TOKEN
.
For each project that pi-dab should listen to, you can configure:
- name: the GitHub repo name including user/organization:
<user>/<repo>
- dir: the directory on your pi where the project is located at
- githubWebhook: the id of the GitHub webhook that pi-dab should use
- postCheckoutScript: the commands that are executed after checkout. The
cwd
isdir
, so can you e.g. runnpm install --production
.
Example:
module.exports = [{
name: 'mlenkeit/pi-dab',
dir: '/home/pi/pi-dab',
githubWebhook: 1234,
postCheckoutScript: 'npm install --production'
}];