Deployment Automation for NodeJS with Bitbucket. Automatically clean -> pull -> install -> restart your nodejs application on server after push on Bitbucket repository. You can work on multiple branches. And get notifications via Slack.
- forever (>= 1.0 required)
- git (required)
- node (>= 8.6 required)
Download this repository and;
npm install
Rename sample file config.yml.dist to config.yml
mv config.yml.dist config.yml
server:
# web service port number
port: 8080
slack:
# slack application webhook url.
webhook: "https://hooks.slack.com/services/ [ SLACK HOOK URL HERE ]"
# slack message channel.
channel: "#deploy"
# slack application username.
username: "deploybot"
# if you want welcome message on start. Set to true.
welcome: true
bitbucket:
# cretae a bitbucket webhook url and put path name here.
# ex. http://yourserver.com:8080/mySecretPathName ---> handler: "/mySecretPathName"
handler: "/[ BITBUCKET WEB HOOK PATH HERE ]"
branches:
master:
# Live project path on your server
deployment: "/var/projects/[ PROJECT LIVE PATH ON SERVER ]/"
# if you need "git reset --hard" command set true
gitreset: true
# if you need "npm install" command set true
npminstall: true
# if you want slack notification set true
notification: true
# auto restart project with "forever restart index.js" command after deployment.
development:
# Development project path on your server
deployment: "/var/projects/[ PROJECT DEVELOPMENT PATH ON SERVER ]/"
gitreset: true
npminstall: true
notification: true
# you can add new branch config here...
npm run start
forever start index.js
Incoming Webhooks are a simple way to post messages from apps into Slack. Creating an Incoming Webhook gives you a unique URL to which you send a JSON payload with the message text and some options. You can use all the usual markup and attachments with Incoming Webhooks to make the messages stand out.
How to find slack webhook url: https://api.slack.com/incoming-webhooks
-
Navigate to your Bitbucket repository. In the left navigation, select Settings.
-
In the Title field, enter Node Deploy Bot and paste your created handler url (http://yourserver.com:8080/mySecretPathName) into the URL field.
You’re now done!
If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.