1
psri
7y

Q1.
What is the easiest way to set up auto restart & deploy web app on git push..? I have tried one that requires hooks/post-receive (server-side) and a make file (local)...but I don’t know how to continue writing the make file after git-push.
Q2.
Can I set up auto deployment if my repo is in bitbucket? Bitbucket allows set up Webhooks - they ask for a url..how should the url look like? Is it like “user@server.com:myrepo/hooks/post-receive”. ?

Comments
  • 2
    For Node backends I like PM2

    The way that webhooks work is that some data is sent to a URL specified by you, when some action occurs

    So on Bitbucket you'd set up your webhook so that it sends data to http://yourserver.com/webhook, and you'd then have a server-side script that handles that incoming data and does something with it (such as executing git pull)
  • 0
    @Ezard hi ezard, thanks for the reply...seems that server already has pm2, found a npmjs library for pm2-Webhook online.......

    so I do a ‘pm2 install pm2-webhook’
    And set up the file in ecosystem.json?
    The webhook.js will be the link to add into my bitbucket?
  • 2
    Depends on what you’re working on but this sounds pretty manual for the current market... bitbucket has pipelines that will allow you to CI and Deploy, GitHub has integration with most CI and CD platforms.

    Worst case it’s free and easy enough to set up a bot to watch and deploy your shit for you, or you could use something like Zapper or IFTT to get this kind of task done.

    What are you actually trying to do? Talk us through and we can give the best advice.

    Oh and where are you deploying to?
  • 1
    @jamescodesthing thank you for helping. we are working on Facebook messenger chat bot for a client. Their server set up is all fixed and there are pre-existing codes we are not suppose to touch.

    Currently our work with them is to; create our own branch on their repo, any code we do - we upload to (FileZilla), then ‘pm2 restart my ranch-app’ in terminal before we can preview it on staging site...

    I see bitbucket has Webhooks integration but will need help in writing the webhook file to link up with bitbucket....

    If pm2 has a npmjs library, can I just do a npm install on their server, change some parameters in some secret file and link it up in bitbucket?
    (- checking if my understanding is correct here? Or is it going to be so much more complicated?

    Perhaps someone can point me in the right direction. Thank you 🤘🏻
Add Comment