{"id":16662797,"url":"https://github.com/bobymcbobs/go-rpi-gpio-api","last_synced_at":"2026-04-11T13:03:43.854Z","repository":{"id":141362099,"uuid":"240588088","full_name":"BobyMCbobs/go-rpi-gpio-api","owner":"BobyMCbobs","description":"A HTTP API to control the GPIO of a Raspberry Pi","archived":false,"fork":false,"pushed_at":"2020-07-26T00:14:04.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T14:55:43.785Z","etag":null,"topics":["cloud","containers","docker","gitlab","golang","gpio","http","kubernetes","raspberry-pi"],"latest_commit_sha":null,"homepage":"https://gitlab.com/bobymcbobs/go-rpi-gpio-api","language":"Go","has_issues":false,"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/BobyMCbobs.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":"2020-02-14T19:55:10.000Z","updated_at":"2023-02-27T01:39:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"18a6b5cd-9e96-4f65-b346-92f27342728a","html_url":"https://github.com/BobyMCbobs/go-rpi-gpio-api","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobyMCbobs%2Fgo-rpi-gpio-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobyMCbobs%2Fgo-rpi-gpio-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobyMCbobs%2Fgo-rpi-gpio-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobyMCbobs%2Fgo-rpi-gpio-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BobyMCbobs","download_url":"https://codeload.github.com/BobyMCbobs/go-rpi-gpio-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243301128,"owners_count":20269286,"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":["cloud","containers","docker","gitlab","golang","gpio","http","kubernetes","raspberry-pi"],"created_at":"2024-10-12T10:38:56.472Z","updated_at":"2025-12-30T22:52:13.654Z","avatar_url":"https://github.com/BobyMCbobs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"http://www.gnu.org/licenses/gpl-3.0.html\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-GPL%20v3-blue.svg\" alt=\"License\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://gitlab.com/bobymcbobs/go-rpi-gpio-api/releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/version-0.0.1-brightgreen.svg\" /\u003e\n\u003c/a\u003e\n\n# go-rpi-gpio-api\n\n\u003e A simple cloud-native golang api webserver for controlling a Raspberry Pi's GPIO pins\n\n## Features\n- Simple bearer token authorization support\n- TLS/SSL support\n- \\\u003e5MB container image\n\n## API endpoints\n| Endpoint                    | Purpose                                       |\n| -                           | -                                             |\n| `/api/pin`                  | List all pins (1-40) and their current states |\n| `/api/pin/{number}`         | Get a single pin and return it's status       |\n| `/api/pin/{number}/{state}` | Modify a pin's state (0 for low, 1 for high)  |\n\n### Example request responses\n\n#### All pins\n```json\n{\n  \"metadata\": {\n    \"selfLink\": \"/api/pin\",\n    \"version\": \"0.0.1\",\n    \"timestamp\": 1581673372,\n    \"response\": \"Fetched all pins\"\n  },\n  \"spec\": [\n    {\n      \"number\": 1,\n      \"state\": 1\n    },\n    {\n      \"number\": 2,\n      \"state\": 1\n    },\n```\n...\n```\n    {\n      \"number\": 39,\n      \"state\": 1\n    },\n    {\n      \"number\": 40,\n      \"state\": 0\n    }\n  ]\n}\n```\n\n### A single pin\n```json\n{\n  \"metadata\": {\n    \"selfLink\": \"/api/pin/39\",\n    \"version\": \"0.0.1\",\n    \"timestamp\": 1581673438,\n    \"response\": \"Fetched pin state\"\n  },\n  \"spec\": {\n    \"number\": 39,\n    \"state\": 1\n  }\n}\n```\n\n## Local usage\n```bash\ndocker run -it --rm --privileged -p 8080:8080 registry.gitlab.com/bobymcbobs/go-rpi-gpio-api:latest\n```\n\n## Building\n```bash\ndocker build -t registry.gitlab.com/bobymcbobs/go-rpi-gpio-api:latest .\n```\n\nNote: since golang supports cross compilation, this container (Linux+arm) can be built from any supported platform!\n\n## Deployment in k8s\nMake sure you update the values in the yaml files\n```bash\nkubectl apply -f k8s-manifests/\n```\n\n## Environment variables\n\n| Name                   | Purpose                                          | Defaults     |\n| -                      | -                                                | -            |\n| `APP_AUTH_SECRET`      | require a value in Authorization bearer header   |              |\n| `APP_PORT`             | the port and interface which the app serves from | `:8080`      |\n| `APP_PORT_TLS`         | the port and interface which the app serves from | `:4433`      |\n| `APP_USE_TLS`          | run the app with TLS enabled                     | `false`      |\n| `APP_TLS_PUBLIC_CERT`  | the public certificate for the app to use        | `server.crt` |\n| `APP_TLS_PRIVATE_CERT` | the private cert for the app to use              | `server.tls` |\n\n## Notes\nCommunication to GPIO pins requires either root privileges or preferably the user to be in the `gpio` group.\nWhen deploying in Kubernetes, an init container automatically sets the correct privileges for accessing the GPIO pins.\n\nTo manually configure GPIO access, on each Raspberry Pi node:\n```sh\naddgroup --gid 997 gpio\nchown root.gpio /dev/gpiomem\nchmod g+rw /dev/gpiomem\n```\n\n## License\nCopyright 2019-2020 Caleb Woodbine.\nThis project is licensed under the [GPL-3.0](http://www.gnu.org/licenses/gpl-3.0.html) and is [Free Software](https://www.gnu.org/philosophy/free-sw.en.html).\nThis program comes with absolutely no warranty.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobymcbobs%2Fgo-rpi-gpio-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobymcbobs%2Fgo-rpi-gpio-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobymcbobs%2Fgo-rpi-gpio-api/lists"}