A toy website status checker testing the current state of async Kafka and Postgres integrations.
-
Make sure you have Python 3.8 installed, and you are in the project root folder.
-
Create and activate a virtual environment
With the builtin
venvmodulepython3 -m venv ~/venvs/website-status source ~/venvs/website-status/bin/activate
or with
virtualenvmkvirtualenv website-status workon website-status
-
Install the dependencies and the project:
pip install -r requirements.txt inv install
-
Create a
.envfile based on theenv_example:This requires a Kafka and Postgres service running somewhere. Aiven is a great choice for this!
Important: when setting up Kafka, make sure to create these topics:
- check_websites
- write_website_status
-
Make sure
websites.jsoncontains the websites you want to check. -
Start the website status check collection, write and trigger as separate process:
./bin/run_check.sh
./bin/run_write.sh
./bin/run_trigger.sh
You should see in your Postgres database the result of the status checks!
inv check- Install the dev requirements:
inv deps
- Run the tests with coverage report:
inv test - Run the tests without coverage report:
inv test --no-coverage
It's a very simple website availability checker using async integrations with:
Kafka(aiokafka)Postgres(asyncpg)