{"id":17668399,"url":"https://github.com/rgee0/postcodedaylight","last_synced_at":"2025-03-30T13:16:28.260Z","repository":{"id":115402872,"uuid":"93208860","full_name":"rgee0/postcodedaylight","owner":"rgee0","description":"Simple example program for use with OpenFaaS - https://github.com/openfaas/faas. Supply a UK postcode to find the remaining hours of daylight.","archived":false,"fork":false,"pushed_at":"2017-09-18T18:51:31.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T15:12:27.958Z","etag":null,"topics":["faas","functions","golang","openfaas","serverless"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rgee0.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-02T22:39:30.000Z","updated_at":"2018-07-01T19:36:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"f646631c-855d-4df9-8a7e-90960b944a66","html_url":"https://github.com/rgee0/postcodedaylight","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/rgee0%2Fpostcodedaylight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgee0%2Fpostcodedaylight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgee0%2Fpostcodedaylight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rgee0%2Fpostcodedaylight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rgee0","download_url":"https://codeload.github.com/rgee0/postcodedaylight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246320198,"owners_count":20758410,"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":["faas","functions","golang","openfaas","serverless"],"created_at":"2024-10-23T23:08:07.408Z","updated_at":"2025-03-30T13:16:28.232Z","avatar_url":"https://github.com/rgee0.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/rgee0/postcodedaylight)](https://goreportcard.com/report/github.com/rgee0/postcodedaylight)\n# postcodedaylight\n\nSample function used to evaluate [faas](https://github.com/alexellis/faas) from [get-faas.com](http://docs.get-faas.com/).  The function accepts a UK postcode and returns the daylight hours for that place using a combination of endpoints offered by [postcodes.io](https://postcodes.io) and [sunrise-sunset.org](https://sunrise-sunset.org/api).  [sunrise-sunset.org](https://sunrise-sunset.org/api) do ask that usage is kept at 'reasonable request volumes' and that attribution to them be shown; please bear this in mind if using downstream.\n\nYou can execute the function like this:\n\n`curl http://localhost:8080/function/func_postcodedaylight -d \"SW1A 1AA\"`\n\n(or use the [FaaS UI](http://localhost:8080/ui/) to pass the postcode as text)\n\nThe response for a valid UK postcode should look like this:\n\n`Duration of daylight today at SW1A1AA : 16h25m34s (4h28m46s until sunset).`\n\n## Installation\n\nYou can either install `postcodedaylight` via your FaaS compose file or you can add it via the UI.\n\n### Compose file\n\nAdd this to your FaaS `docker-compose.yml` \n\n```\n    # Returns the amount of daylight to expect for a given postcode        \n    postcodedaylight:\n        image: rgee0/postcodedaylight:latest\n        labels:\n            function: \"true\"\n        depends_on:\n            - gateway\n        networks:\n            - functions\n        environment:\n            fprocess: \"/go/bin/postcodedaylight\"\n            no_proxy: \"gateway\"\n            https_proxy: $https_proxy\n```\nand then redeploy the FaaS func stack\n`docker stack deploy -c docker-compose.yml func`\n\nn.b. Remember to change the image to `rgee0/postcodedaylight:latest-armhf` if running on a Raspberry Pi.\n\n### UI\n\nUse the `CREATE NEW FUNCTION` link and add these details:\n\n- Image: `rgee0/postcodedaylight:latest`\n- Service name: `func_postcodedaylight`\n- fProcess: `/go/bin/postcodedaylight`\n- Network: `func_functions`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgee0%2Fpostcodedaylight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frgee0%2Fpostcodedaylight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frgee0%2Fpostcodedaylight/lists"}