Skip to content

Commit

Permalink
init HA addon repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Hieu Le committed Dec 17, 2023
0 parents commit 8bb5bfe
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: 8xff
7 changes: 7 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
time: "06:00"
111 changes: 111 additions & 0 deletions .github/workflows/builder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Builder

env:
BUILD_ARGS: "--test"
MONITORED_FILES: "build.yaml config.yaml Dockerfile"

on:
push:
branches:
- home-assistant
pull_request:
branches:
- home-assistant

jobs:
init:
runs-on: ubuntu-latest
name: Initialize builds
outputs:
changed_addons: ${{ steps.changed_addons.outputs.addons }}
changed: ${{ steps.changed_addons.outputs.changed }}
steps:
- name: Check out the repository
uses: actions/[email protected]

- name: Get changed files
id: changed_files
uses: jitterbit/get-changed-files@v1

- name: Find add-on directories
id: addons
uses: home-assistant/actions/helpers/find-addons@master

- name: Get changed add-ons
id: changed_addons
run: |
declare -a changed_addons
for addon in ${{ steps.addons.outputs.addons }}; do
if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon ]]; then
for file in ${{ env.MONITORED_FILES }}; do
if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon/$file ]]; then
if [[ ! "${changed_addons[@]}" =~ $addon ]]; then
changed_addons+=("\"${addon}\",");
fi
fi
done
fi
done
changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev)
if [[ -n ${changed} ]]; then
echo "Changed add-ons: $changed";
echo "changed=true" >> $GITHUB_OUTPUT;
echo "addons=[$changed]" >> $GITHUB_OUTPUT;
else
echo "No add-on had any monitored files changed (${{ env.MONITORED_FILES }})";
fi
build:
needs: init
runs-on: ubuntu-latest
if: needs.init.outputs.changed == 'true'
name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on
strategy:
matrix:
addon: ${{ fromJson(needs.init.outputs.changed_addons) }}
arch: ["aarch64", "amd64", "armv7", "i386"]

steps:
- name: Check out repository
uses: actions/[email protected]

- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
with:
path: "./${{ matrix.addon }}"

- name: Check if add-on should be built
id: check
run: |
if [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then
echo "build_arch=true" >> $GITHUB_OUTPUT;
echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT;
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
echo "BUILD_ARGS=" >> $GITHUB_ENV;
fi
else
echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build";
echo "build_arch=false" >> $GITHUB_OUTPUT;
fi
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/[email protected]
with:
args: |
${{ env.BUILD_ARGS }} \
--${{ matrix.arch }} \
--target /data/${{ matrix.addon }} \
--image "${{ steps.check.outputs.image }}" \
--docker-hub "ghcr.io/${{ github.repository_owner }}" \
--addon
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/debug
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG BUILD_FROM
FROM $BUILD_FROM

# Copy init script, 8xFF relayer and agent binary
RUN wget https://github.com/8xFF/atm0s-decentralized-home-assistant-proxy/releases/download/latest/agent-x86_64-unknown-linux-musl -O agent \
wget https://github.com/8xFF/atm0s-decentralized-home-assistant-proxy/releases/download/latest/relayer-x86_64-unknown-linux-musl -O relayer

COPY data/run.sh /

CMD [ "/run.sh" ]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Home Assistant Add-on: 8xFF Decentralized Proxy

A decentralized proxy for HA.

![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]

This add-on aims to create an innovative decentralized relay server for HomeAssistant. The server allows contributions from anyone and provides a fast and optimized path between clients.

[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg
10 changes: 10 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
build_from:
aarch64: ghcr.io/home-assistant/aarch64-base:3.14
amd64: ghcr.io/home-assistant/amd64-base:3.14
armhf: ghcr.io/home-assistant/armhf-base:3.14
armv7: ghcr.io/home-assistant/armv7-base:3.14
i386: ghcr.io/home-assistant/i386-base:3.14
codenotary:
signer: [email protected]
base_image: [email protected]
29 changes: 29 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: 8xFF HA relayer agent
description: Decentralized HomeAssistant Proxy
version: 0.1.1
slug: 8xff_ha_relayer
init: false
host_network: true
url: https://github.com/8xFF/atm0s-decentralized-home-assistant-proxy
codenotary: [email protected]
image: "ghcr.io/8xff/atm0s-decentralized-home-assistant-proxy-{arch}"
map:
- ssl:rw
- share
arch:
- aarch64
- amd64
- armhf
- armv7
- i386
options:
tcp_connector_addr: 127.0.0.1:33333
http_dest: 127.0.0.1:8080
https_dest: 127.0.0.1:8443
local_key: 8xff.pem
schema:
tcp_connector_addr: str
http_dest: str
https_dest: str
local_key: str
16 changes: 16 additions & 0 deletions data/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/with-contenv bashio
set -e

RELAY_SERVER=$(bashio::config 'tcp_connector_addr')
HTTP_DEST=$(bashio::config 'http_dest')
HTTPS_DEST=$(bashio::config 'https_dest')
KEYFILE="/ssl/$(bashio::config 'local_key')"

bashio::log.info "Starting 8xFF Agent..."

exec /agent \
--tcp-connector-addr "$RELAY_SERVER" \
--http-dest "$HTTP_DEST" \
--https-dest "$HTTPS_DEST" \
--local-key "$KEYFILE" \
< /dev/null
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://developers.home-assistant.io/docs/add-ons/repository#repository-configuration
name: 8xFF's Home Assistant Add-ons
url: 'https://github.com/8xFF/'
maintainer: 8xFF Team
18 changes: 18 additions & 0 deletions translations/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
configuration:
tcp_connector_addr:
name: Relay server address
description: >-
8xFF Relay Server address in format IP:port, default to 127.0.0.1:33333
http_dest:
name: HTTP proxy destination
description: >-
HTTP Proxy destination, default to 127.0.0.1:8080
https_dest:
name: SNI-HTTPS proxy destination
description: >-
SNI-HTTPS Proxy destination, default to 127.0.0.1:8443
local_key:
name: Persistent local key
description: >-
Persistent local key location in ssl folder, default to 8xff.pem

0 comments on commit 8bb5bfe

Please sign in to comment.