{"id":24264664,"url":"https://github.com/zstyblik/sample3","last_synced_at":"2026-02-07T15:10:26.793Z","repository":{"id":271562905,"uuid":"890551864","full_name":"zstyblik/sample3","owner":"zstyblik","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-10T12:21:23.000Z","size":274,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-16T17:21:43.953Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zstyblik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-18T19:10:43.000Z","updated_at":"2025-06-10T12:21:26.000Z","dependencies_parsed_at":"2025-06-11T10:43:22.618Z","dependency_job_id":"07617ee5-d4ae-4b92-90d6-6474a435a213","html_url":"https://github.com/zstyblik/sample3","commit_stats":null,"previous_names":["zstyblik/sample3"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zstyblik/sample3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zstyblik","download_url":"https://codeload.github.com/zstyblik/sample3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29197835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T14:35:27.868Z","status":"ssl_error","status_checked_at":"2026-02-07T14:25:51.081Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-01-15T09:40:42.117Z","updated_at":"2026-02-07T15:10:26.772Z","avatar_url":"https://github.com/zstyblik.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dpetv2\n\n## Application\n\nApplication is a simple Python script which gets weather forecast from\n[OpenWeathermap] API for given city(by default Prague, Czech Rep.), generates\nsimple HTML page from [Jinja2] template, and stores data and HTML page on S3.\n\nApplication is capable of running either as AWS Lambda function or in Docker\ncontainer. `Dockerfile` is included, but hasn't been tested beyond localhost.\nAlso, it's not being built as part of pipeline, because it currently isn't used\nfor anything.\n\nDependencies can be found in `app/requirements/`. Requirements are split in\norder to save CI minutes, because there is no reason to install everything in\norder to lint the source code. Ideally, lint dependencies would be split even\nfurther, but then there is a practical side of things and the current state is\nfine for now.\n\n![weather_app_demo][weather_app_demo]\n\n### Environment variables\n\nMandatory variables:\n\n* `WEATHER_API_KEY` - OpenWeathermap API key\n* `WEATHER_S3_BUCKET` - Name of S3 bucket where data will be stored\n* `WEATHER_SM_SECRET_NAME` - Name of Secrets manager secret which contains API\n  key, but it might be used to store other variables, eg. `prod/weather/secrets`\n\nNote that either `WEATHER_SM_SECRET_NAME` or `WEATHER_API_KEY` must be provided.\n\nOther variables:\n\n* `WEATHER_TOWN` - Name of town, eg. `prague`\n* `WEATHER_COUNTRY` - Name of country, eg. `cz`\n* `WEATHER_API_URL` - OpenWeathermap API URL, eg. `https://api.openweathermap.org`\n\n## Architecture in brief\n\nArchitecture is as follows:\n\n* CloudFront in order to serve HTML page\n* S3 for storage\n* Lamba function for data processing\n* EventBridge rule in order to periodically trigger Lambda function\n* Secrets Manager in order to store API key\n\nAnything capable of scheduling and running(ECS, EKS, ...) Docker container\nwould be backup in case of Lambda wouldn't work.\n\nAlternatives are S3 without CloudFront, ELB, EC2 with public IP address - there\nare probably more. While S3 alone is capable of hosting and serving static HTML\nfiles, it doesn't provide HTTPS which could and would be problematic due to\nmixed content(images from OpenWeathermap are served over HTTPS). ELB has its\nuses, however you have to pay for it whethere there is a traffic coming through\nor not. Also, something has to serve that traffic. To use API Gateway, while\nmost likely possible, seemend like an abuse.\n\nSecrets Manager is utilized in order to securely store API key.\n\n## Terraform\n\n* modules would normally be in a separate repository and versioned\n* environments are separate, because you might use different accounts or even\n  multiple providers\n* terraform workspaces might actually be nice for DEV/review\n* cleanup of DEV/review is, in my opinion, a bit unstable as it is\n* production terraform fmt, validate and plan are available even in branches,\n  because you don't want to find (problem) out when you're about to deploy into\n  production. Unpopular question, but - separate pipeline?\n\n## TODOs/problems\n\n* Python - more unit tests\n* Python - it might be nice to show historical data.\n* HTML - design is nonexistent.\n* HTML - better layout since one or two iterations weren't enough.\n* gitlab - workaround for `git tag --push` which triggers pipeline was\n  initially hard to figure out. This brought another set of problems which were\n  resolved later on(at least for now).\n* gitlab - script which creates new git tag might need more work.\n* gitlab - it'd be nice to propagate git tag further down the line. Store new\n  version(tag) into file and pass it down as an artifact, read as necessary?\n* gitlab - terraform is no longer supported by gitlab, therefore \"custom\"\n  solution is used instead. Also, there was a worry about version compatibility\n  since gitlab provides, used to provide, only specific version of terraform.\n* gitlab - \"environment\" is in need of improvement, eg. auto stop, on_stop,\n  URL(if possible) etc.\n* gitlab - spit some parts off into different files and maybe even parent-child\n  pipelines(?), because `.gitlab-ci.yml` has gained some weight.\n* how much should be in terraform for deploy depends. Sooner or later it will\n  be too much and `terraform plan` will take too long, eg. everything around\n  CloudFront takes long time, or AWS API limits will be reached.\n* deployment of application should and could be verified by triggering Lambda\n  and then waiting for data either to appear on S3 and/or check\n  `Last-Modified`. Check through CDN should be done as well, if it is\n  provisioned(CDN might not be provisioned in case of MR).\n\nI probably forgot to add somethng.\n\n\n![dpetv2_main_pipeline][dpetv2_main_pipeline]\n![dpetv2_mr_pipeline][dpetv2_mr_pipeline]\n![dpetv2_mr_pipeline_tests][dpetv2_mr_pipeline_tests]\n\n[OpenWeathermap]: https://openweathermap.org/\n[Jinja2]: https://pypi.org/project/Jinja2/\n[weather_app_demo]: ../assets/weather_app_demo.png?raw=true\n[dpetv2_main_pipeline]: ../assets/dpetv2_main_pipeline.png?raw=true\n[dpetv2_mr_pipeline]: ../assets/dpetv2_mr_pipeline.png?raw=true\n[dpetv2_mr_pipeline_tests]: ../assets/dpetv2_mr_pipeline_tests.png?raw=true\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzstyblik%2Fsample3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzstyblik%2Fsample3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzstyblik%2Fsample3/lists"}