Skip to content
Snippets Groups Projects
Select Git revision
  • 8d325bd7c8b089530e16984ad76d6cf2d6c11709
  • master default protected
  • v1
3 results

events-wrangler

  • Clone with SSH
  • Clone with HTTPS
  • VALLET Nathan's avatar
    VALLET Nathan authored
    8d325bd7
    History

    events wrangler

    the event wrangler wrangles and fuse all your remote logs into one place.

    installation

    This program creates an html file, but it needs to be delivered somehow. You should install a web server like apache or nginx to access the file from a distance. after that you can download the packaged python app from the releases. Be sure to have the correct owner and permissions:

    aggreg:/home/aggreg# chown aggreg:aggreg eventswrangler
    aggreg:/home/aggreg# chmod 774 eventswrangler
    aggreg:/home/aggreg# ls -l
    total 3252
    -rwxrwxr--    1 aggreg   aggreg     3328757 May 25 14:31 eventswrangler
    

    In this case, the program will be run on the aggreg user and aggreg group. Grab the config from the configuration section or from the conf.yml file and put it in /etc/eventswrangler.yml or somewhere else if you use the --config command line switch. This program is not a daemon and will terminate when it’s done, so put it in the user’s crontab:

    0-59/5 * * * * /home/aggreg/eventswrangler
    

    This will run the program every 5 minutes. There is a CSS style cheets in the repo that can be used by simply copying the css folder to your website’s root.

    invocation

    usage: eventswrangler [-h] [-c CONFIG]
    
    obtain events feeds from RSS and compile them into a nice webpage
    
    options:
      -h, --help            show this help message and exit
      -c CONFIG, --config CONFIG
                            specifies a config path instead of the default config path
                            /etc/eventswrangler.yml
    

    configuration

    The configuration is a yaml file with the following keys:

    sources
    is a list containing each RSS feed’s website base domain (with http or https prepended)
    rss-name
    the path of the rss file to looks for
    destination
    where to write the resulting html file
    tri-chrono
    whether to sort by time, more recent up and older down.

    configuration file example

    sources:
      - http://serveur1
      - http://serveur2
      - http://serveur3
    rss-name: flux.rss
    destination: /var/www/localhost/htdocs/index.html
    tri-chrono: true
    

    building

    There are many ways in which you can package this applications to someone else. Here I will describe a way to create a self-contained build (to the exception of the python interpreter itself) using zipapp: clone the repository and cd into it:

    $ git clone https://etulab.univ-amu.fr/v23004467/events-wrangler.git
    $ cd events-wrangler
    

    create a ‘build’ directory where the main python script and it’s dependencies will be:

    $ mkidr build
    

    install the dependencies into it:

    $ pip install -r requirements.txt --target build
    

    then either copy and link the aggreg.py file:

    $ cp aggreg.py build/
    # OR
    $ ln -s $REPODIR/aggreg.py build/aggreg.py
    

    then you can create the self packaged app with this command:

    $ python -m zipapp -m aggreg:main -o eventswrangler -p "/usr/bin/env python" ./build
    

    this will produce an executable named eventswrangler.