Metadata-Version: 2.1
Name: heartbeat-website
Version: 0.1.0
Summary: Tracking website health using Aiven-kafka and Aiven-postgresql as backend
Home-page: https://github.com/sum12/heartbeat_website
Author: sum12
Author-email: sumitjami@gmail.com
License: MIT license
Description: Heartbeat_Website
        =================
        
        
        Tracking website health using Aiven-kafka and Aiven-postgresql as backend
        
        
        * Free software: MIT license
        * Documentation: https://heartbeat-website.readthedocs.io.
        
        
        Features
        --------
        
        * idea.txt
        
        
        Usage 
        ------
        Create jobs for producer
        ```bash
        $ cat config.json.sample
        
        {
            "topic": "hbw",
            "jobs":[
                {"url":"https://www.google.com", "after": 3},
                {"url":"https://www.amazon.com", "after": 3},
                {"url":"https://www.github.com", "after": 3, "regex_check" : "GitHub"}
            ],
            "kafka_server":"KAFKA_SERVER",
            "kafka_ssl_context": {
                "cafile":"secrets/ca.pem",
                "certfile":"secrets/service.cert",
                "keyfile":"secrets/service.key",
                "password":"KAFKA_PASSWORD"
            },
            "db_config":{
                "dsn":"DATABASE_DSN"
            }
        }
        
        ```
        
        Run
        ---
        In two differnet terminals (config.json should already be populated)
        ```
        $ heartbeat_website consumer config.json # non Daemonized 
        $ heartbeat_website producer config.json # non Daemonized 
        ```
        
        Or if you want to use Makefile. (This will install the package in current python site-packages)
        ```
        git clone https://github.com/sum12/heartbeat_website
        ```
        
        Consumer:
        ```
        cd heartbeat_website
        python3 -m venv .venv
        source .venv/bin/activate
        make database # avn login required (this will create-database in avn, download certs, change uri in config)
                      # OR tar -zxvf /path/to/provided/config.tar.gz -C .
        make consumer
        ```
        
        Producer:
        ```
        cd heartbeat_website
        python3 -m venv .venv
        source .venv/bin/activate
        make kafka # avn login required (this will create topic, download certs, change uri and password in config)
                   # OR tar -zxvf /path/to/provided/config.tar.gz -C .
        make producer
        ```
        
        
        
        Check
        -----
        
        ```bash
        psql -U avnadmin -W  -h pg-27b3353-thejamga-f238.aivencloud.com -p 15601 --dbname hbw
        Password: 
        psql (12.3, server 12.4)
        SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
        Type "help" for help.
        
        hbw=> select * from urls;
         id |          url           
        ----+------------------------
          1 | https://www.github.com
          2 | https://www.google.com
          3 | https://www.amazon.com
        (3 rows)
        
        hbw=> select to_timestamp(timestamp/1000),* from health where url_id = 1 order by id desc limit 12;
              to_timestamp      | id  |   timestamp   | code | regex_check | http_response_time | url_id 
        ------------------------+-----+---------------+------+-------------+--------------------+--------
         2020-09-06 10:06:31+00 | 775 | 1599386791332 |  200 | pass        |         0.16216135 |      1
         2020-09-06 10:06:28+00 | 772 | 1599386788133 |  200 | pass        |         0.16090631 |      1
         2020-09-06 10:06:24+00 | 769 | 1599386784929 |  200 | pass        |         0.20499349 |      1
         2020-09-06 10:06:21+00 | 766 | 1599386781673 |  200 | pass        |         0.19487572 |      1
         2020-09-06 10:06:18+00 | 763 | 1599386778427 |  200 | pass        |          0.2173233 |      1
         2020-09-06 10:06:15+00 | 760 | 1599386775172 |  200 | pass        |         0.15962481 |      1
         2020-09-06 10:06:11+00 | 757 | 1599386771977 |  200 | pass        |         0.22482872 |      1
         2020-09-06 10:06:08+00 | 754 | 1599386768698 |  200 | pass        |         0.19852567 |      1
         2020-09-06 10:06:05+00 | 751 | 1599386765464 |  200 | pass        |         0.16422033 |      1
         2020-09-06 10:06:02+00 | 748 | 1599386762262 |  200 | pass        |         0.16323495 |      1
         2020-09-06 10:05:59+00 | 745 | 1599386759059 |  200 | pass        |         0.19281459 |      1
         2020-09-06 10:05:55+00 | 742 | 1599386755827 |  200 | pass        |         0.19974017 |      1
        (12 rows)
        
        hbw=> 
        
        
        ```
        
        Test
        ----
        ```
        # tar -zxvf /path/to/provided/config.tar.gz -C heartbeat_website/ 
        cd heartbeat_website
        python3 -m venv .venv
        source .venv/bin/activate
        make install
        make test
        ```
        
        
        Credits
        -------
        
        This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
        
        .. _Cookiecutter: https://github.com/audreyr/cookiecutter
        .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
        
        
        - Everything mentioned in requirements file is awesome.
        - Each of these libs have docs available with sample those samples helped figure out API too.
        - asyncio testsing is difficult and very early stage, libraries are no ready entirely
            - Should have paid attention to this before selecting async framework
            - this made writing test cases very difficult
        
Keywords: heartbeat_website
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.5
Provides-Extra: test
