I have a linux server as my a production environment, and my node repo is on github . When I push my code, if I want to deploy it , I need to .
>local
git push
ssh user@host
>remote
cd repo
git pull
I am using node forever to auto update my code , but it is still a very troublesome .
Is there any solution , like travis-ci or heroku , can Automatically deploy my code on github ?
Travis-ci is for continuous integration (as its name) While Heroku is just a cloud platform. They are not for deployment.
My solution is to set up a git hook on your server, push to it to trigger the hook, and do whatever you want in that script.
for example, you can:
edit ~/repo/myproj/hooks/post-update
#!/bin/sh
unset GIT_DIR;
cd <your project-root>
export NODE_ENV="product"
git pull
npm install
pm2 restart <your app name>
chmod +x ~/repo/myproj/hooks/post-update
now you can add your repo on server as one of your remotes
There's some services available to monitor your deployment, such as http://dploy.io/ and https://www.codeship.io/
Feel free to use them when your business grows up.