{"id":22214357,"url":"https://github.com/zstyblik/sample1","last_synced_at":"2025-08-19T08:33:43.662Z","repository":{"id":41901646,"uuid":"117508339","full_name":"zstyblik/sample1","owner":"zstyblik","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-24T08:37:34.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-24T09:31:36.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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}},"created_at":"2018-01-15T06:52:24.000Z","updated_at":"2025-05-24T08:37:36.000Z","dependencies_parsed_at":"2024-04-17T01:33:06.201Z","dependency_job_id":"6a016fda-8b86-4dc4-a4a3-cdf6ca0c8828","html_url":"https://github.com/zstyblik/sample1","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zstyblik/sample1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zstyblik","download_url":"https://codeload.github.com/zstyblik/sample1/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zstyblik%2Fsample1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271121784,"owners_count":24702874,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-12-02T21:15:59.075Z","updated_at":"2025-08-19T08:33:43.616Z","avatar_url":"https://github.com/zstyblik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sample1\n\nsample1 is a vagrant box provisioned by ansible with:\n\n* HAproxy acting as load-balancer\n* web application written in Django(Python) running in Docker container to\n  store/list events in DB\n* PostgreSQL running in Docker container\n\nDespite there are two instances of web application, PostgreSQL is obviously\nSPOF in this example.\n\n## Dependencies\n\n* ansible=7.3.0\n* vagrant=2.4.1\n\n## How-to run/setup\n\n```\n# Install ansible dependencies\nansible-galaxy install -p provisioning/roles/ -r requirements.yml\n# Start and provision vagrant environment\nvagrant up\n```\n\n## Web application\n\nOnce vagrant environment is up, web application should be reachable at\n`http://localhost:8080`.\n\n## URIs\n\nFollowin URIs are available:\n\n* `/events`\n  * `GET` to list events in DB\n  * `POST` to push event into DB\n* `/event/\u003cid\u003e/` to show one particular event stored in DB\n\n## Structure of Event\n\nEvent is expected to be in JSON format with the following mandatory attributes:\n\n* `timestamp` - seconds since 1970-01-01 00:00:00 UTC aka Unix timestamp\n* `message` - text\n\n## How-to test\n\n```\n# In order to push some event run the following command\ncurl -XPOST -H 'Content-Type: application/json' http://localhost:8080/events \\\n    -d '{\"timestamp\": 1515948504, \"message\": \"Printer is on fire\"}'\n# To list events stored in DB\ncurl http://localhost:8080/events\n# And to get the detail of particular event\ncurl http://localhost:8080/event/1/\n```\n\n## Extra notes\n\nPostgreSQL configuration is being fetched from ENV variables. Therefore, sadly\nthese variables must be set in order to use `manage.py`.\n\n* `POSTGRES_HOST`\n* `POSTGRES_DB`\n* `POSTGRES_USER`\n* `POSTGRES_PASS`\n\n# References\n\n* https://github.com/geerlingguy/ansible-vagrant-examples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzstyblik%2Fsample1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzstyblik%2Fsample1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzstyblik%2Fsample1/lists"}