Deploy you apps in seconds using the webhook feature
- clone this repo and open a terminal in the repo
- Install dependencies
npm i
oryarn
- Create the deployments config
cp deployment.config.json.example deployment.config.json
- Add your config and Start the server
Your Deployment configurations live in the deployment.config.json
file.
[
{
"name": "Awesome-App",
"command": "cd path && git pull"
}
]
It is basically an array. If your repository is private, you may want to use deploy keys or cache your git credentials with the git credentials helper.
$ git config --global credential.helper 'cache --timeout=600'
The command above would cache your credentials for 600 seconds. You might want to set-up a cron job to be doing this atleast once a day.
$ sudo crontab -e
$ 29 0 * * * git config --global credential.helper 'cache --timeout=31556952'
The cron job above runs everyday at 12:30 AM in your server's local time.
- name: This is the name of your repo as it is on github. eg
opensource254/deployer
would be deployer. - Command: The bash command you want to run. This is basically a deploy command. Eg. For an Expressjs application using
pm2
this would becd <full path> && git pull && npm i && npm restart [process-id]
. Or you could insert the path of the script to be excecuted.bash path-to-script/script.sh
orbash ./path-to-script/script.sh
. If you want to change the port that this app runs, create a.env
file and addPORT=<prefered_port>
At this point, Your endpoint is ready for webhooks. It would be a great idea to run this behind a reverse proxy and give it a domain or a subdomain like. mydomain.com
Then on the Github webhook settings,
- webhook url
https://mydomain.com/<provider>
- Content Type
application/json
The provider can be any of these
- github
- gitlab
- bitbucket
- Currently only the Github security is supported.
- All the repos/webhooks SHOULD use on key provided in the .env
SECRET=<your-secret>
Add this secret to your webhook secret too.
- If a security check fails, the endpoint will respond with error 403
Two notifications channels are currently supported.
- Email (The current supported protocal is SMTP)
- Slack Turning notifications on
ALLOW_NOTIFICATIONS=true
// Notify on successful deployment
SUCCESS_NOTIFICATIONS=false
// Notify on failures/warnings
ERROR_NOTIFICATIONS=false
Add the config details in the .env file. example
SMTP_HOST=smtp.mailtrap.io
SMTP_PORT=2525
SMTP_USERNAME=
SMTP_PASSWORD=
// The email to send notifications to
NOTIFICATION_EMAIL=
// The from address that will be shown in the email
NOTIFICATION_FROM=
Slack config is as simple as adding the webhook config.
Create a Slack app and add the webhook url for the app to .env
like below
SLACK_WEBHOOK_URL=
Configuration erros are logged in the error.log file. This file is not version controlled.
Sat, 13 Jun 2020 10:00:10 GMT Config: your-awesome-config, Error: /bin/sh: 1: c: not found
Sat, 13 Jun 2020 10:00:18 GMT Config: your-awesome-config, Error: /bin/sh: 1: c: not found
Sat, 13 Jun 2020 10:01:58 GMT Config: your-awesome-config, Error: /bin/sh: 1: ks: not found
- Basic functionality
- Refactor
- Webhook Security
- Notifications
- Web interface
Please visit our guidelines
This project has not been properly tested use it at your own risk.