Giter Club home page Giter Club logo

packtpub-free-learning's Introduction

codecov

About

This app downloads the title and cover of packtpub's free book. Uses the puppeteer package to control google-chrome in headless mode. It sends the downloaded information to the chat system (rocketchat) via the axios library. Integration with rocketchat involves the use of webhooks (incoming integration). Unit testing via jest library. Development environment created via docker-compose. Pipeline for build, test, audit dependiences and deploy via Gitlab-CI.

screenshot

Running

Run make init, on first run. This command is shortcut for:

  • install required npm packages
  • provision rocketchat docker service (add incoming integration)
  • initialize the replica set for mongo

If you don't do it the rocketchar container will not up: packtpubfreelearning_rocketchat_1 node main.js Exit 1 Open webrowser and go to url rocketchat.lvh.me and finish configuration.

Invoke the command docker-compose exec puppeteer node /home/node/app/src/index.js Or use shortcut make puppeteer

Gitlab CI/CD variables

SSH_PRIVATE_KEY - private ssh key to deploy

PROD_CONFIG - .env file contents

CODECOV_TOKEN - token for codecov

DOCKER_USERNAME - docker hub username (default value morawskim)

DOCKER_PASSWORD - docker hub password or access token

Deploying

To deploy this script use docker. You can use docker-compose or docker swarm. In deploy/docker-compose.sensi.yml you can found example configuration.

If you don't change timezone then default value UTC will be used. You can also set env CRON_EXPRESSION if you want to change the default time to fetch the information about the free book. The default value is 7:50 AM.

In .env file you must have ROCKETCHAT_WEBHOOK_URL set to your incoming webhook URL.

packtpub-free-learning's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

konkmak

packtpub-free-learning's Issues

Add node-cron package

We give up service and timer units of systemd.
Our docker's image will be always running. Thanks to node-cron package our script will be called only once a day. If something bad happend and the container exits, docker can restart container.

Provisioning rocketchat service

Write js script to provisioning rocketchat service. This script should add incoming integration.
After added integration should update .env file.

Finally add this script to make init target

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.