Merge pull request #2359 from alexbelgium/codex/create-karakeep-addon-for-existing-app

Remove Karakeep binary assets
This commit is contained in:
Alexandre
2026-01-11 16:31:45 +01:00
committed by GitHub
18 changed files with 482 additions and 0 deletions

2
karakeep/CHANGELOG.md Normal file
View File

@@ -0,0 +1,2 @@
## 0.30.0 (2026-01-11)
- Initial add-on release

168
karakeep/Dockerfile Normal file
View File

@@ -0,0 +1,168 @@
#============================#
# ALEXBELGIUM'S DOCKERFILE #
#============================#
# _.------.
# _.-` ('>.-`"""-.
# '.--'` _'` _ .--.)
# -' '-.-';` `
# ' - _.' ``'--.
# '---` .-'""`
# /`
#=== Home Assistant Addon ===#
#################
# 1 Build Image #
#################
ARG BUILD_FROM
ARG BUILD_VERSION
ARG MEILI_VERSION="v1.13.3"
FROM getmeili/meilisearch:${MEILI_VERSION} AS meilisearch
FROM ${BUILD_FROM}
##################
# 2 Modify Image #
##################
# Set S6 wait time
ENV S6_CMD_WAIT_FOR_SERVICES=1 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
S6_SERVICES_GRACETIME=0
ENV \
DATA_DIR="/data" \
MEILI_DIR="/config/meili" \
DISABLE_NEW_RELEASE_CHECK=true \
BROWSER_WEB_URL="http://127.0.0.1:9222" \
MEILI_ADDR="http://127.0.0.1:7700" \
MEILI_MASTER_KEY="0uIHQXWthY2L2yqCWGVGu2axN+l4qcDEc+Of/7e8X7bEyZ8k" \
MEILI_NO_ANALYTICS=true \
XDG_CACHE_HOME="/data/cache"
ENV \
CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/usr/lib/chromium/ \
CHROMIUM_FLAGS="--disable-software-rasterizer --disable-dev-shm-usage" \
MEILI_HTTP_ADDR=0.0.0.0:7700 \
MEILI_SERVER_PROVIDER=docker \
MEILI_ENV=production
# Image specific modifications
RUN \
apk upgrade --no-cache --available \
&& apk add --no-cache \
chromium \
chromium-swiftshader \
ttf-freefont \
font-noto-emoji \
font-wqy-zenhei \
&& mkdir -p /usr/src/chrome \
&& adduser -D chrome \
&& chown -R chrome:chrome /usr/src/chrome
COPY --from=meilisearch /bin/meilisearch /bin/meilitool /bin/
##################
# 3 Install apps #
##################
# Add rootfs
COPY rootfs/ /
RUN chmod +x /etc/s6-overlay/s6-rc.d/*/run
# Uses /bin for compatibility purposes
# hadolint ignore=DL4005
RUN if [ ! -f /bin/sh ] && [ -f /usr/bin/sh ]; then ln -s /usr/bin/sh /bin/sh; fi && \
if [ ! -f /bin/bash ] && [ -f /usr/bin/bash ]; then ln -s /usr/bin/bash /bin/bash; fi
# Modules
ARG MODULES="00-banner.sh 01-custom_script.sh 00-global_var.sh"
# Automatic modules download
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automodules.sh" "/ha_automodules.sh"
RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh
# Manual apps
ENV PACKAGES=""
# Automatic apps & bashio
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_autoapps.sh" "/ha_autoapps.sh"
RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps.sh
################
# 4 Entrypoint #
################
# Add entrypoint
ENV S6_STAGE2_HOOK=/ha_entrypoint.sh
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint.sh" "/ha_entrypoint.sh"
# Entrypoint modifications
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh"
RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh
# Standalone bashio command
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/bashio-standalone.sh" "/.bashio-standalone.sh"
RUN chmod 777 /.bashio-standalone.sh
############
# 5 Labels #
############
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG BUILD_VERSION
ENV BUILD_VERSION="${BUILD_VERSION}"
LABEL \
io.hass.name="${BUILD_NAME}" \
io.hass.description="${BUILD_DESCRIPTION}" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="alexbelgium (https://github.com/alexbelgium)" \
org.opencontainers.image.title="${BUILD_NAME}" \
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
org.opencontainers.image.vendor="Home Assistant Add-ons" \
org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://github.com/alexbelgium" \
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}
#################
# 6 Healthcheck #
#################
# Avoid spamming logs
# hadolint ignore=SC2016
RUN \
# Handle Apache configuration
if [ -d /etc/apache2/sites-available ]; then \
for file in /etc/apache2/sites-*/*.conf; do \
sed -i '/<VirtualHost/a \ \n # Match requests with the custom User-Agent "HealthCheck" \n SetEnvIf User-Agent "HealthCheck" dontlog \n # Exclude matching requests from access logs \n CustomLog ${APACHE_LOG_DIR}/access.log combined env=!dontlog' "$file"; \
done; \
fi && \
\
# Handle Nginx configuration
if [ -f /etc/nginx/nginx.conf ]; then \
awk '/http \{/{print; print "map $http_user_agent $dontlog {\n default 0;\n \"~*HealthCheck\" 1;\n}\naccess_log /var/log/nginx/access.log combined if=$dontlog;"; next}1' /etc/nginx/nginx.conf > /etc/nginx/nginx.conf.new && \
mv /etc/nginx/nginx.conf.new /etc/nginx/nginx.conf; \
fi
ENV HEALTH_PORT="3000" \
HEALTH_URL="/api/health"
HEALTHCHECK \
--interval=5s \
--retries=5 \
--start-period=30s \
--timeout=25s \
CMD curl -A "HealthCheck: Docker/1.0" -s -f "http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" &>/dev/null || exit 1

111
karakeep/README.md Normal file
View File

@@ -0,0 +1,111 @@
# Home assistant add-on: Karakeep
I maintain this and other Home Assistant add-ons in my free time: keeping up with upstream changes, HA changes, and testing on real hardware takes a lot of time (and some money). I use around 5-10 of my >110 addons so regularly I install test machines (and purchase some test services such as vpn) that I don't use myself to troubleshoot and improve the addons
If this add-on saves you time or makes your setup easier, I would be very grateful for your support!
[![Buy me a coffee][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
[![Donate via PayPal][paypal-badge]](https://www.paypal.com/donate/?hosted_button_id=DZFULJZTP3UQA)
## Addon informations
![Version](https://img.shields.io/badge/dynamic/yaml?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fkarakeep%2Fconfig.yaml)
![Ingress](https://img.shields.io/badge/dynamic/yaml?label=Ingress&query=%24.ingress&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fkarakeep%2Fconfig.yaml)
![Arch](https://img.shields.io/badge/dynamic/yaml?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fkarakeep%2Fconfig.yaml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9c6cf10bdbba45ecb202d7f579b5be0e)](https://www.codacy.com/gh/alexbelgium/hassio-addons/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexbelgium/hassio-addons&utm_campaign=Badge_Grade)
[![GitHub Super-Linter](https://img.shields.io/github/actions/workflow/status/alexbelgium/hassio-addons/weekly-supelinter.yaml?label=Lint%20code%20base)](https://github.com/alexbelgium/hassio-addons/actions/workflows/weekly-supelinter.yaml)
[![Builder](https://img.shields.io/github/actions/workflow/status/alexbelgium/hassio-addons/onpush_builder.yaml?label=Builder)](https://github.com/alexbelgium/hassio-addons/actions/workflows/onpush_builder.yaml)
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white
[paypal-badge]: https://img.shields.io/badge/Donate%20via%20PayPal-0070BA?logo=paypal&style=flat&logoColor=white
_Thanks to everyone having starred my repo! To star it click on the image below, then it will be on top right. Thanks!_
[![Stargazers repo roster for @alexbelgium/hassio-addons](https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.github/stars2.svg)](https://github.com/alexbelgium/hassio-addons/stargazers)
## About
[Karakeep](https://karakeep.app/) is a bookmark-everything app with a touch of AI for the data hoarders out there. It stores content, screenshots, and metadata with search powered by Meilisearch.
This addon is based on the [official Karakeep Docker image](https://github.com/karakeep-app/karakeep).
## Configuration
Webui can be found at `<your-ip>:3000`.
### Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `NEXTAUTH_SECRET` | password | **Required** | Secret key for authentication (generate a long random string). |
| `NEXTAUTH_URL` | str | | Public URL used by NextAuth (optional). |
| `DISABLE_SIGNUPS` | bool | `false` | Disable new account signups. |
| `MAX_ASSET_SIZE_MB` | int | `4` | Max asset upload size. |
| `OCR_LANGS` | str | | OCR language codes (comma-separated). |
| `OCR_CONFIDENCE_THRESHOLD` | int | | OCR confidence threshold (0-100). |
| `OPENAI_BASE_URL` | str | | Custom OpenAI base URL. |
| `OPENAI_API_KEY` | password | | OpenAI API key. |
| `OLLAMA_BASE_URL` | str | | Ollama base URL. |
| `INFERENCE_TEXT_MODEL` | str | | Text inference model name. |
| `INFERENCE_IMAGE_MODEL` | str | | Image inference model name. |
| `EMBEDDING_TEXT_MODEL` | str | | Embedding model name. |
| `INFERENCE_CONTEXT_LENGTH` | int | | Inference context length. |
| `INFERENCE_LANG` | str | | Language used for inference. |
| `INFERENCE_JOB_TIMEOUT_SEC` | int | | Timeout for inference jobs. |
| `CRAWLER_DOWNLOAD_BANNER_IMAGE` | bool | `true` | Download banner image during crawl. |
| `CRAWLER_STORE_SCREENSHOT` | bool | `false` | Store screenshot during crawl. |
| `CRAWLER_FULL_PAGE_SCREENSHOT` | bool | `false` | Capture full-page screenshots. |
| `CRAWLER_FULL_PAGE_ARCHIVE` | bool | `false` | Store full-page archive. |
| `CRAWLER_JOB_TIMEOUT_SEC` | int | | Crawler job timeout. |
| `CRAWLER_NAVIGATE_TIMEOUT_SEC` | int | | Navigation timeout. |
| `CRAWLER_VIDEO_DOWNLOAD` | bool | | Enable video downloads. |
| `CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE` | int | | Max video size (MB). |
| `CRAWLER_VIDEO_DOWNLOAD_TIMEOUT_SEC` | int | | Video download timeout. |
| `CRAWLER_ENABLE_ADBLOCKER` | bool | `true` | Enable ad blocking in the crawler. |
| `CHROME_EXTENSIONS_DIR` | str | `/share/karakeep/extensions` | Host-mounted extensions directory for headless Chromium. |
| `MEILI_MASTER_KEY` | password | | Meilisearch master key. |
| `MEILI_ADDR` | str | | Meilisearch URL. |
| `BROWSER_WEB_URL` | str | | Chromium remote debugging URL. |
| `DATA_DIR` | str | | Data directory (leave default). |
| `TZ` | str | `Etc/UTC` | Timezone. |
### Extensions for headless Chromium
This add-on loads extensions in headless Chromium with the `--headless=new` flag. To use the included defaults:
1. Create these folders on the host (via the `/share` mount):
- `/share/karakeep/extensions/i-dont-care-about-cookies`
- `/share/karakeep/extensions/ublock-origin`
2. Unzip each extension into its corresponding folder.
3. Restart the add-on.
You can override the base folder with the `CHROME_EXTENSIONS_DIR` option. Any missing extension folder is skipped at runtime.
### Custom Scripts and Environment Variables
This addon supports custom scripts and environment variables through the `addon_config` mapping:
- **Custom scripts**: See [Running Custom Scripts in Addons](https://github.com/alexbelgium/hassio-addons/wiki/Running-custom-scripts-in-Addons)
- **env_vars option**: Use the add-on `env_vars` option to pass extra environment variables (uppercase or lowercase names). See https://github.com/alexbelgium/hassio-addons/wiki/Add-Environment-variables-to-your-Addon-2 for details.
## Installation
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance. [![Add repository on my Home Assistant][repository-badge]][repository-url]
1. Install this add-on.
1. Click the `Save` button to store your configuration.
1. Set the `NEXTAUTH_SECRET` option to a secure random string.
1. Start the add-on.
1. Check the logs of the add-on to see if everything went well.
1. Open the webUI and complete the onboarding.
## Support
Create an issue on GitHub if you need support.
[repository]: https://github.com/alexbelgium/hassio-addons
[repository-badge]: https://img.shields.io/badge/Add%20repository%20to%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge
[repository-url]: https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons

66
karakeep/apparmor.txt Normal file
View File

@@ -0,0 +1,66 @@
#include <tunables/global>
profile karakeep_addon flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
capability,
file,
signal,
mount,
umount,
remount,
network udp,
network tcp,
network dgram,
network stream,
network inet,
network inet6,
network netlink raw,
network unix dgram,
capability setgid,
capability setuid,
capability sys_admin,
capability dac_read_search,
# capability dac_override,
# capability sys_rawio,
# S6-Overlay
/init ix,
/run/{s6,s6-rc*,service}/** ix,
/package/** ix,
/command/** ix,
/run/{,**} rwk,
/dev/tty rw,
/bin/** ix,
/usr/bin/** ix,
/usr/lib/bashio/** ix,
/etc/s6/** rix,
/run/s6/** rix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/init rix,
/var/run/** mrwkl,
/var/run/ mrwkl,
/dev/i2c-1 mrwkl,
# Files required
/dev/fuse mrwkl,
/dev/sda1 mrwkl,
/dev/sdb1 mrwkl,
/dev/nvme0 mrwkl,
/dev/nvme1 mrwkl,
/dev/mmcblk0p1 mrwkl,
/dev/* mrwkl,
/tmp/** mrkwl,
# Data access
/data/** rw,
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
ptrace (trace,read) peer=docker-default,
# docker daemon confinement requires explict allow rule for signal
signal (receive) set=(kill,term) peer=/usr/bin/docker,
}

4
karakeep/build.yaml Normal file
View File

@@ -0,0 +1,4 @@
---
build_from:
aarch64: ghcr.io/karakeep-app/karakeep:0.30.0
amd64: ghcr.io/karakeep-app/karakeep:0.30.0

78
karakeep/config.yaml Normal file
View File

@@ -0,0 +1,78 @@
arch:
- aarch64
- amd64
description: bookmark-everything app with a touch of AI for the data hoarders out there
environment:
BROWSER_WEB_URL: http://127.0.0.1:9222
CHROME_EXTENSIONS_DIR: /share/karakeep/extensions
DATA_DIR: /data
DISABLE_NEW_RELEASE_CHECK: "true"
MEILI_ADDR: http://127.0.0.1:7700
MEILI_MASTER_KEY: 0uIHQXWthY2L2yqCWGVGu2axN+l4qcDEc+Of/7e8X7bEyZ8k
MEILI_NO_ANALYTICS: "true"
XDG_CACHE_HOME: /data/cache
image: ghcr.io/alexbelgium/karakeep-{arch}
init: false
map:
- addon_config:rw
- share:rw
name: Karakeep
options:
env_vars: []
CHROME_EXTENSIONS_DIR: /share/karakeep/extensions
CRAWLER_DOWNLOAD_BANNER_IMAGE: true
CRAWLER_ENABLE_ADBLOCKER: true
CRAWLER_FULL_PAGE_ARCHIVE: false
CRAWLER_FULL_PAGE_SCREENSHOT: false
CRAWLER_STORE_SCREENSHOT: false
DISABLE_SIGNUPS: false
BROWSER_WEB_URL: http://127.0.0.1:9222
DATA_DIR: /data
MAX_ASSET_SIZE_MB: 4
MEILI_ADDR: http://127.0.0.1:7700
MEILI_MASTER_KEY: 0uIHQXWthY2L2yqCWGVGu2axN+l4qcDEc+Of/7e8X7bEyZ8k
NEXTAUTH_SECRET: jnE2An0WyIKZvO+WgKJrn8WPW+c3DzV+c9ntBp8CdobTOmpJ
TZ: Etc/UTC
ports:
3000/tcp: 3000
ports_description:
3000/tcp: Web UI
schema:
env_vars:
- name: match(^[A-Za-z0-9_]+$)
value: str?
BROWSER_WEB_URL: str?
CHROME_EXTENSIONS_DIR: str?
DATA_DIR: str?
DISABLE_SIGNUPS: bool
MEILI_ADDR: str?
MEILI_MASTER_KEY: password
MAX_ASSET_SIZE_MB: int?
NEXTAUTH_SECRET: password
NEXTAUTH_URL: str?
OCR_LANGS: str?
OCR_CONFIDENCE_THRESHOLD: int(0,100)?
OPENAI_BASE_URL: str?
OPENAI_API_KEY: password?
OLLAMA_BASE_URL: str?
INFERENCE_TEXT_MODEL: str?
INFERENCE_IMAGE_MODEL: str?
EMBEDDING_TEXT_MODEL: str?
INFERENCE_CONTEXT_LENGTH: int(0,)?
INFERENCE_LANG: str?
INFERENCE_JOB_TIMEOUT_SEC: int(0,)?
CRAWLER_DOWNLOAD_BANNER_IMAGE: bool
CRAWLER_STORE_SCREENSHOT: bool
CRAWLER_FULL_PAGE_SCREENSHOT: bool
CRAWLER_FULL_PAGE_ARCHIVE: bool
CRAWLER_JOB_TIMEOUT_SEC: int(0,)?
CRAWLER_NAVIGATE_TIMEOUT_SEC: int(0,)?
CRAWLER_VIDEO_DOWNLOAD: bool?
CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE: int?
CRAWLER_VIDEO_DOWNLOAD_TIMEOUT_SEC: int(0,)?
CRAWLER_ENABLE_ADBLOCKER: bool
TZ: str?
slug: karakeep
url: https://github.com/alexbelgium/hassio-addons/tree/master/karakeep
version: "0.30.0"
webui: "[PROTO:ssl]://[HOST]:[PORT:3000]"

View File

@@ -0,0 +1,15 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
set -e
bashio::log.info "Creating folders"
mkdir -p \
/data/cache \
/data/chrome \
/share/karakeep/extensions \
/config/meili
if id chrome &>/dev/null; then
chown -R chrome:chrome /data/cache /data/chrome
fi

View File

@@ -0,0 +1,21 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
set -e
EXTENSIONS_DIR="${CHROME_EXTENSIONS_DIR:-/share/karakeep/extensions}"
extensions=()
for extension in "${EXTENSIONS_DIR}/i-dont-care-about-cookies" "${EXTENSIONS_DIR}/ublock-origin"; do
if [ -d "$extension" ]; then
extensions+=("$extension")
fi
done
extension_flag=""
if [ ${#extensions[@]} -gt 0 ]; then
extension_flag="--load-extension=$(IFS=,; echo "${extensions[*]}")"
fi
cd /usr/src/chrome
exec su chrome -c "chromium-browser --headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 --hide-scrollbars --disable-crash-reporter --no-crash-upload --user-data-dir=/data/chrome ${extension_flag}"

View File

@@ -0,0 +1 @@
longrun

View File

@@ -0,0 +1,7 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
set -e
mkdir -p "${MEILI_DIR}"
exec /bin/meilisearch --db-path "${MEILI_DIR}" --no-analytics --experimental-dumpless-upgrade

View File

@@ -0,0 +1 @@
longrun

8
karakeep/updater.json Normal file
View File

@@ -0,0 +1,8 @@
{
"last_update": "11-01-2026",
"repository": "alexbelgium/hassio-addons",
"slug": "karakeep",
"source": "github",
"upstream_repo": "karakeep-app/karakeep",
"upstream_version": "0.30.0"
}