{"id":13477407,"url":"https://github.com/cuducos/my-internet-speed","last_synced_at":"2025-03-27T05:31:38.371Z","repository":{"id":76813180,"uuid":"133280879","full_name":"cuducos/my-internet-speed","owner":"cuducos","description":"🛎️ Monitor the speed your ISP is delivering","archived":true,"fork":false,"pushed_at":"2021-01-05T13:53:23.000Z","size":137,"stargazers_count":136,"open_issues_count":3,"forks_count":13,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-10-30T10:40:25.298Z","etag":null,"topics":["internet-speed","isp","monitoring"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cuducos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["cuducos"]}},"created_at":"2018-05-13T23:00:20.000Z","updated_at":"2024-10-03T05:13:26.000Z","dependencies_parsed_at":"2023-03-06T13:30:20.135Z","dependency_job_id":null,"html_url":"https://github.com/cuducos/my-internet-speed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Fmy-internet-speed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Fmy-internet-speed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Fmy-internet-speed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Fmy-internet-speed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuducos","download_url":"https://codeload.github.com/cuducos/my-internet-speed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791594,"owners_count":20672666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["internet-speed","isp","monitoring"],"created_at":"2024-07-31T16:01:42.385Z","updated_at":"2025-03-27T05:31:37.809Z","avatar_url":"https://github.com/cuducos.png","language":"Python","funding_links":["https://github.com/sponsors/cuducos"],"categories":["Python"],"sub_categories":[],"readme":"[![Tests](https://img.shields.io/travis/cuducos/my-internet-speed.svg)](https://travis-ci.org/cuducos/my-internet-speed)\n[![Coverage](https://img.shields.io/codeclimate/coverage/cuducos/my-internet-speed.svg)](https://codeclimate.com/github/cuducos/my-internet-speed)\n[![Maintainability](https://img.shields.io/codeclimate/maintainability-percentage/cuducos/my-internet-speed.svg)](https://codeclimate.com/github/cuducos/my-internet-speed)\n\n# My Internet Speed\n\nI wrote this app so I can **periodically** monitor my internet speed and:\n\n* Collect data to build a report about the quality of the service provided by\n  my ISP\n* Automatically tweet my ISP when the speed is lower than expected – surely\n  **optional**\n* Store speed test results in PostgreSQL\n* Check all speed test results in a web API\n* Monitor all speed test tasks\n\nAt home this runs on my Raspberry Pi, but not all services are compatible —\ncheck [my ideal setup](#my-ideal-setup) for a suggestion on how to run these\nservices.\n\n## Installing\n\n### Requirements\n\n**It is important** to run this app in a computer connected to the internet via\nethernet cable, **not via wireless** – this is the way to have some accuracy in\ntesting the speed.\n\n* [Docker](https://docs.docker.com/install/)\n* [Docker Compose](https://docs.docker.com/compose/install/)\n\nOptionally, if you want the Twitter feature to work (it will **only** tweet\nwhen the speed is below the configures threshold):\n\n* Twitter consumer key and secret\n* Twitter access token and access token secret\n\nYou can get these Twitter credentials at the [Twitter Application Management\ndashboard](https://apps.twitter.com/).\n\nSome speed test backends do not provide a URL with the results. In these cases\nwe take a screenshot from the speed test result and upload it to\n[Imgur](https://imgur.com/). If you want to use this feature, you need an\naccount there and a client ID for a registered application.\n\n### Settings\n\nBefore you get started, copy `.env.sample` as `.env` and edit as follows:\n\n1. Set `INTERVAL` according to how often (in minutes) you want to run the speed\n   test (e.g.: `20` for _20min_)\n1. Set your `TIMEZONE` accordingly\n\nThe default speed test backend is [SpeedTest](https://speedtest.net) but you\ncan use\n[EAQ (Entidade Aferidora da Qualidade de Banda Larga)](http://www.brasilbandalarga.com.br/)\ncertified by [ANATEL](https://www.anatel.gov.br/) setting `BACKEND` to\n`brasil_banda_larga`.\n\nIf you want the app to post tweets:\n\n1. Add your Twitter credentials at the top of the file\n1. Set `CONTRACT_SPEED` to the speed in Mbps you are paying for (e.g.: `60` if\n   you contract says _60Mbps_)\n1. Set `THRESHOLD` to the minimum percentage of the contract speed you contract\n   or local laws enforces your ISP (e.g.: `0.4` for 40%)\n1. Set your tweet message using `{contract_speed}` where the contract speed in\n   Mbps should be (for example, `60` for _60Mbps_), `{real_speed}` where the\n   measured speed should be, and `{percentage}` where comparing both should be\n   (feel free to use the Twitter handle of your ISP too)\n1. Add `{result_url}` in order to add the link to the result provided by the\n   speed test backend\n\nFor example, if:\n\n* the measured speed is 20Mpbs\n* your `CONTRACT_SPEED` is `60`\n* the `THRESHOLD` is `0.4`\n* and `TWEET` is configures as  `I pay for {contract_speed}, but now @MyISP is\n  working at {real_speed} – merely {percentage} of what I'm paying for :(\n  {result_url}`\n\nThe final tweet would be:\n\n\u003e I pay for 60Mbps, but now @MyISP is working at 20Mbps – merely 33% of what\n\u003e I'm paing for :( http://www.speedtest.net/result/7307126311\n\nIf you like this app, add `#MyInternetSpeed\nhttps://github.com/cuducos/my-internet-speed` to your tweets ; )\n\n### Database\n\nThis `docker-compose.yml` lefts out the `db` container from all possible\n`depends_on` in order to make it easier to use an external/remote database to\npersist data (just point `POSTGRES`s variables and the `PGRST` ones to\nsomewhere else).\n\nThus if you are using the Docker database it is useful to start it manually\nfirst:\n\n```console\n$ docker-compose up -d db\n```\n\nIn both cases run this one off command to create the database tables:\n\n```console\n$ docker-compose run --rm beat python \\\n  -c \"from my_internet_speed.models import Result; Result.create_table()\"\n```\n\n### Spinning up the app\n\n```console\n$ docker-compose up -d\n```\n\n#### Services and compatibility\n\n##### Containers\n\nThis spins up different services that might be useful to check the status of\nthe speed tests:\n\n| Name | URL |  ARM (RaspberryPi) compatibility | Description |\n|:-----|:----|:--------------------------------:|:------------|\n| `beat` | | ✅ | Main app that periodically runs the speed tests |\n| `dashboard` | `http://localhost:3000/` | 🚫 | Minimalist dashboard with monthly speed test results |\n| `api` | `http://localhost:3001/result/` | 🚫 | API to the database with all speed test results (check [Postgrest](https://postgrest.org/en/v5.0/api.html) for advanced filtering and exporting formats) |\n| `flower` | `http://localhost:5555/` | ✅ | [Flower](https://flower.readthedocs.io/) dashboard for asynchronous tasks |\n| `db` | | ✅ | Database to store the speed test results |\n| `broker` | | ✅ | Queue to run the speed tests |\n| `chrome` | | 🚫 | Selenium web driver used for backends that requires a browser |\n\n##### Backends\n\n| Name | Python path | ARM (RaspberryPi) compatibility |\n|:-----|:------------|:-------------------------------:|\n| [SpeedTest](https://speedtest.net/) | `my_internet_speed.backends.speed_test_net.SpeedTest` | ✅ |\n| [Barsil Banda Larga](http://www.brasilbandalarga.com.br/) | `my_internet_speed.backends.brasil_banda_larga.SpeedTest` | 🚫 |\n\n#### My ideal setup\n\nGiven the ARM processor incompatibilities, I actually use three computers to\nrun these services:\n\n1. In my **RaspberryPi** (ARM processor, but it is still the only device with\nethernet cable I have) I run `beat`, `broker` and `flower`:\u003cbr\u003e\n`$ docker-compose up -d beat flower`\n2. In my **main computer** (x86 processor) I run the `api` and the `dashboard`\nso I can check the results:\u003cbr\u003e`$ docker-compose up -d beat dashboard`\n3. The database I run **in the cloud**, a free tier at _tiny turtle_ (free) at\n[ElephantSQL](https://www.elephantsql.com/)\n\n#### Troubleshooting\n\n##### `UnixHTTPConnectionPool(host='localhost', port=None): Read timed out.`\n\nI was getting this error in my Raspberry Pi when trying to run `docker-compose\nup`. This seams to be a workaround:\n\n```console\n$ export DOCKER_CLIENT_TIMEOUT=600\n$ export COMPOSE_HTTP_TIMEOUT=600\n```\n\n## Testing\n\n```console\n$ docker-compose run --rm beat py.test\n```\n\nAlso we use [Black](https://github.com/ambv/black) code formatter:\n\n```console\n$ docker-compose run --rm beat black . --check\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuducos%2Fmy-internet-speed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuducos%2Fmy-internet-speed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuducos%2Fmy-internet-speed/lists"}