poke

Simple server to listen on port and touch configured files


Keywords
inotify, server
License
MIT
Install
pip install poke==0.0.4

Documentation

poke

poke

Poke is a simple one-file python webserver that when run can touch files on the system. It is usefull when you want to trigger inotify on a remote system such or a Vagrant, Virtualbox or Docker virtual os with mounted shared folders which otherwise will not detect changes made to those files on host os.

istallation

The most simple way to get poke is with pip:

pip install poke

Alternatively you can get the development version by cloning this repository, creating a virtualenvironment and installing dependencies:

git clone git@github.com:projectshift/poke.git
cd poke
virtualenv env
source env/bin/activate
pip install -r requirements.txt

configuration

To configure poke create a small configuration file in yaml format. Name it however you like and put it somewhere, You can define any number of apps, any number of files to touch and any number of allowed hosts. Here is a full config example:

allowed-hosts:
  - 127.0.0.1
  - 33.33.33.1
apps:
  flask:
    - '/path/to/file/to/touch.py'
  bottle:
    - '/path/to/file/to/touch.py'
    - '/path/to/file/to/touch_as_well.py'

running

You will need to create a configuration file in yaml format somewhere and tell poke about it when you run:

poke -c /path/to/config.yml

This will start a webserver on '0.0.0.0' (default) and port 34567 (default). Yet you can customize those as well like this:

poke -c /path/to/config.yml --host '127.0.0.1' --port '9994'

You can then hit a url for your app either with GET or POST and poke will trigger a touch (mtime update) on a number of files confiured for this app. If those are watched by inotify or other tools that will trigger an event you defined.

An example of app url woud be: http://127.0.0.1:9994/app-name/

Whatch however for configuration value of allowed-hosts as only requests from listed addresses are allowed for security. And if you don't want to bother with starting poke every time you - run it as a service or use some process control system like supervisor