Git Product home page Git Product logo

drudge-www's Introduction

Drudge Report via MQTT

Very simple sister project to drudge-mqtt to display the most recent N articles and subscribe for real-time updates.

Dependencies

  • Coming soon...

Configuration

Controlled using environment variables.

Defaults

# Logging
# Winston / https://www.npmjs.com/package/winston
LOG_LEVEL=info

# Database/Persistence (sqlite)
DB_PATH=""

# MQTT
MQTT_URL=""
MQTT_TOPIC="news/drudge"

Development

Start up a docker container:

docker run -it --rm \
  -v "$PWD":/app \
  -u $(id -u ${USER}):$(id -g ${USER}) \
  -p 3000:3000 \
  node:lts \
  /bin/bash
  • Force running container using the currently logged in user. This will allow you to edit files from the host without running into permissions issues.

Install dependencies:

cd /app
npm install
npm run watch

Local testing

Using a .env file, adjust the development REQ_URL to a locally hosted version. There are several samples saved as part of this repo.

Sample .env file

LOG_LEVEL=info

# polling
POLL_FREQUENCY=120

# request
REQ_URL="http://{dev_server_ip}:8097/test/source/2019_02_14_4.html"

# persistence
DB_PATH="/tmp/drudge.db"

# MQTT
MQTT_URL="mqtt://{mqtt_server_host}:1883"
MQTT_USERNAME="news_drudge"
MQTT_PASSWORD="ABC123"
MQTT_TOPIC="news/drudge"

Python v2:

cd python3 -m SimpleHTTPServer 8097

Python v3:

python3 -m http.server 8097

Deployment

I have opted not published the container to Docker hub, you'll need to build it on your own.

Build

docker build -t drudge-mqtt:latest .

To-Do

Here are a few things that would make this better

  • Code refactor to plugins to make testing easier/possible. Possibly use a well known and published plugin framework.
  • Create a service which will create a screenshot (JPEG) and/or PDF of the article when published. Puppeteer from google looks like a very well supported project. See .ci / node8 / Dockerfile.linux for an example
  • Small web based GUI which displays the most recently published links
  • Ability to automatically delete old articles based on the ts_last database column. This timestamp is the last time the specific link was seen.
  • RSS feed
  • Refactor code to remove event emitter and rely solely on MQTT
  • Break each lib file into a package and utilize lerna for managing those packages.
  • React (Native) sample application which subscribes to the MQTT stream for a real-time dashboard.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.