Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wendevlin committed Apr 29, 2024
1 parent 2a50325 commit c1dadf8
Show file tree
Hide file tree
Showing 58 changed files with 917 additions and 229 deletions.
25 changes: 0 additions & 25 deletions .devcontainer.json

This file was deleted.

19 changes: 0 additions & 19 deletions .vscode/tasks.json

This file was deleted.

12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
# Example Home Assistant add-on repository
# Home Assistant Homedocs add-on repository

This repository can be used as a "blueprint" for add-on development to help you get started.

Add-on documentation: <https://developers.home-assistant.io/docs/add-ons>

[![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fhome-assistant%2Faddons-example)
[![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fmasterwendu%2Fhomeassistant-addons)

## Add-ons

This repository contains the following add-ons

### [Example add-on](./example)
### [HomeDocs](./homedocs)

![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]

_Example add-on to use as a blueprint for new add-ons._
_Document stuff with Markdown based on Astro Starlight_

<!--
Expand Down
15 changes: 0 additions & 15 deletions example/CHANGELOG.md

This file was deleted.

10 changes: 0 additions & 10 deletions example/DOCS.md

This file was deleted.

12 changes: 0 additions & 12 deletions example/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions example/README.md

This file was deleted.

57 changes: 0 additions & 57 deletions example/apparmor.txt

This file was deleted.

20 changes: 0 additions & 20 deletions example/config.yaml

This file was deleted.

Binary file removed example/icon.png
Binary file not shown.
Binary file removed example/logo.png
Binary file not shown.
15 changes: 0 additions & 15 deletions example/rootfs/etc/services.d/example/finish

This file was deleted.

19 changes: 0 additions & 19 deletions example/rootfs/etc/services.d/example/run

This file was deleted.

3 changes: 0 additions & 3 deletions example/rootfs/usr/bin/my_program

This file was deleted.

4 changes: 0 additions & 4 deletions example/translations/en.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions homedocs/.mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tools]
node = "20"
bun = "1.1.6"
5 changes: 5 additions & 0 deletions homedocs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->

## 1.0.0

- Initial release
25 changes: 25 additions & 0 deletions homedocs/DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Home Assistant Add-on: Homedocs

This addon helps you document stuff around your home inside home assistant in a nice way.

## How to use

1. Install the addon
2. Start the addon
3. the addon creates a folder called `homedocs` in your config folder
4. the addon copies some sample data to this folder
5. edit the markdown files in the `homedocs` folder
- in the `content/docs` folder you can write your documentation
- all images should be placed in the `assets` folder
- the will be automatically optimized by astro
6. The addon will recognize the changes and build the site after a give timeout (60 seconds is default)
- the timeout is needed because the build takes some time and can just runs once in parallel.
7. open the webui to see your beautiful documentation

### how to edit the documentation

The documentation lies in your `config` directory under `homedocs`. When you edit or add/remove the markdown files, your changes will be build after the build timeout and you will see the changes inside the webui.

#### Use the Studio Code Server addon

I recommend to use the [Studio Code Server](https://github.com/hassio-addons/addon-vscode) to edit your documentation, because it is very convenient to edit markdown files with it and you can just drag and drop files into the addon.
43 changes: 43 additions & 0 deletions homedocs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ARG BUILD_FROM
FROM $BUILD_FROM

# Install requirements for add-on
RUN apk add --update --no-cache nodejs npm bash ca-certificates wget
# Install glibc to run Bun
RUN if [[ $(uname -m) == "aarch64" ]] ; \
then \
# aarch64
wget https://raw.githubusercontent.com/squishyu/alpine-pkg-glibc-aarch64-bin/master/glibc-2.26-r1.apk ; \
apk add --no-cache --allow-untrusted --force-overwrite glibc-2.26-r1.apk ; \
rm glibc-2.26-r1.apk ; \
else \
# x86_64
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk ; \
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub ; \
apk add --no-cache --force-overwrite glibc-2.28-r0.apk ; \
rm glibc-2.28-r0.apk ; \
fi

# Install Bun
RUN npm install -g bun

# Copy starlight data
COPY starlight /starlight
WORKDIR /starlight
RUN bun install

# copy and setup webserver
COPY webserver/dist/index.js /webserver/index.js
COPY webserver/src/templates /webserver/templates
RUN mkdir -p /webserver/public

# copy and setup run script
COPY run.sh /
RUN chmod a+x /run.sh

# Disable astro telemetry
RUN bunx astro telemetry disable

WORKDIR /webserver

CMD [ "/run.sh" ]
Loading

0 comments on commit c1dadf8

Please sign in to comment.