{"id":13587277,"url":"https://github.com/DynamicDevices/reverse-proxy","last_synced_at":"2025-04-07T21:33:29.210Z","repository":{"id":74419345,"uuid":"466720222","full_name":"DynamicDevices/reverse-proxy","owner":"DynamicDevices","description":"A Balena reverse proxy block using Traefik that makes publishing your container services a fun and easy experience.","archived":false,"fork":false,"pushed_at":"2022-03-09T22:17:09.000Z","size":79,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-02-13T21:46:39.097Z","etag":null,"topics":["balena","balenablock","balenahub","docker","embedded-linux","grafana","grafana-dashboard","monitoring","prometheus","prometheus-exporter"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/DynamicDevices.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}},"created_at":"2022-03-06T11:43:19.000Z","updated_at":"2023-08-29T23:41:45.000Z","dependencies_parsed_at":"2023-07-08T06:30:17.669Z","dependency_job_id":null,"html_url":"https://github.com/DynamicDevices/reverse-proxy","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"ec0e7d017ef1b8932c7ec2c6e5c31559d8f5ab97"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DynamicDevices%2Freverse-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DynamicDevices%2Freverse-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DynamicDevices%2Freverse-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DynamicDevices%2Freverse-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DynamicDevices","download_url":"https://codeload.github.com/DynamicDevices/reverse-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247732839,"owners_count":20986936,"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":["balena","balenablock","balenahub","docker","embedded-linux","grafana","grafana-dashboard","monitoring","prometheus","prometheus-exporter"],"created_at":"2024-08-01T15:06:08.146Z","updated_at":"2025-04-07T21:33:24.198Z","avatar_url":"https://github.com/DynamicDevices.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Overview\n\nThis is a Balena [Block](https://www.balena.io/blog/balenablocks-public-roadmap/) project to enable flexible management of on-device networking using [Traefik](https://traefik.io/)\n\n# Block Configuration\n\nThis is an initial example which will configure a node-exporter service on an internal port :9100 which is then routed by Traefik to be on a path of the public URL on :80\n\nAdd the following to a `docker-compose.yml` for your fleet.\n\n**NOTE:** I couldn't get this working for the raspberrypi4-64 which is what I am testing here. It appears to be related to an issue with Balena `--platform` parsing and I had to implement the fix shown [here](https://github.com/balena-io/balena-cli/issues/1408).\n\n```\nversion: '2'\n\nservices:\n  node-exporter:\n    # Use a specific hash of the node-exporter (which you can find on Docker Hub) as we don't currently pick up architectures correctly\n    image: dynamicdevices/balenablock-node-exporter@sha256:9c03ad3c3c7b6201c0f5a644d5d7023e8ecb42767c55945082807e16e4eb60de\n    # Restart the container if there's a problem\n    restart: always\n    # No needfor enhanced privileges\n    privileged: false\n    ports:\n    # The standard node-exporter port is 9100\n      - '9100:9100'\n    labels:\n      # Enable traefik support for this container\n      - \"traefik.enable=true\"\n      # Make it available on the \"web\" entrypoint which is defined below as :80\n      - \"traefik.http.routers.node-exporter.entrypoints=web\"\n      # Add a specific path prefix that will be expected on the URL suffix\n      - \"traefik.http.routers.node-exporter.rule=PathPrefix(`/metrics`)\"\n  traefik:\n    image: dynamicdevices/balenablock-traefik@sha256:072770347a92b1828efca812756051c1652333247fec1e56f7de3077c0b59e7e\n    container_name: traefik\n    command:\n      - \"--log.level=DEBUG\"\n      - \"--api.dashboard=true\"\n      # Uncomment this to enable the Traefik WebUI on port :8080\n      #- \"--api.insecure\"\n      - \"--providers.docker=true\"\n      - \"--providers.docker.endpoint=unix:///var/run/balena-engine.sock\"\n      #- \"--providers.docker.exposedbydefault=true\"\n      - \"--entrypoints.web.address=:80\"\n    restart: always\n    ports:\n      # The HTTP port\n      - \"80:80\"\n      # The Dashboard port\n      - \"8080:8080\"\n    labels:\n      # So that Traefik can listen to the Docker events\n      - \"io.balena.features.balena-socket=1\"\n```\n\nWith this Fleet configuration deployed you should be able browse to your public endpoint (as seen on the device dashboard)\n\nIf  you browse to the base URL you will see an error but if you browse to https://my-balena-device-id.balena-devices.com/metrics your requested will be proxied by Traefik to the node-exporter webserver running on the internal port :9100 on the device\n\nYou'll then see a list of key value pairs of device metrics)\n\n![image](https://user-images.githubusercontent.com/1537834/157541771-a4f65193-6799-404a-9a62-767322fb444c.png)\n\nThe other thing you can do here is enable insecure mode for the Traefik WebUI on port :8080 to see how it is configured.\n\n```\n      # Uncomment this to enable the Traefik WebUI on port :8080\n      - \"--api.insecure\"\n```\n\nYou can then tunnel with the Balena CLI as follows:\n\n`balena tunnel your-fleet-name 8080:8080`\n\nUse a browser to go to [localhost:8080](http://localhost:8080) and you'll see the Traefik WebUI\n\n![image](https://user-images.githubusercontent.com/1537834/157541959-fd4c22a7-961e-4e51-aa90-6f4b65272c59.png)\n\n# Rebuilding the Docker image and pushing to your own Docker registry\n\nThere is a [build-images.sh](https://github.com/DynamicDevices/reverse-proxy/blob/main/build-images.sh) script which I modified from the `pulse` block.\n\nYou'll need to change the Docker repo to your own and you should then be able to use this to build and upload the image(s).\n\nI had problems as my installation of `docker buildx` didn't have support for ARM64 building and I had to look through the information [here](https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/getting-started-with-docker-for-arm-on-linux)\n\nSpecifically I needed to register Arm executables to run on x64 machines:\n\n```\ndocker run --rm --privileged docker/binfmt:820fdd95a9972a5308930a2bdfb8573dd4447ad3\n```\n\nTo verify the qemu handlers are registered properly run:\n\n```\ncat /proc/sys/fs/binfmt_misc/qemu-aarch64\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDynamicDevices%2Freverse-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDynamicDevices%2Freverse-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDynamicDevices%2Freverse-proxy/lists"}