0

I'm trying to set up a build server so that every time it completes a build, it notifies/pings my Raspberry Pi, which will then run some scripts and do some testing stuff.

My first idea was to set up an API server on my Pi, and the server would send an HTTP POST request to my Pi. My problem is I'm on a work network and I'm unable to expose the server running on my Pi to the internet at large.

Anyone have any ideas for a different way for a server to ping a Raspberry Pi over the internet? Ideally some solution that is python scriptable.

Thanks.

3
  • 1
    google MQTT ... – jsotola Oct 15 '20 at 19:46
  • Maybe this: scp a file from your server to the RPi when the build is completed. Monitor the presence of this file on your RPi & start your script when it does. OR: from the server, do this: echo "command" | ssh user@yourRPihost – Seamus Oct 15 '20 at 22:21
  • The problem is that the Pi is not visible to the build server. The server is hosted by Bitbucket. – Peter Kapteyn Oct 16 '20 at 15:07
1

You can subscribe to a "topic" if your build server can publish the "topic" that may be brokered externally. There are many options for the pub-sub model depending on your infrastructure. You could use a public broker or host your own co-located with your build server (that could, in the first place, receive the subscribe request from your RPi).

The RPi client can be written in Python (per your preference) with all the bells and whistles you would like but the simplest would be to leverage Node-RED (personal opinion) for a quick proof-of-concept.

Kind regards.

0

A tricky one, but my first idea is to invert the Observer pattern. It would be less efficient, but has the advantage of being possible in this situation.

Your server could host the API and when called return either it has updated or not. Then have the pi poll every minute or so.

I know, its not pretty, but it would work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.