test mealie

This commit is contained in:
Alexandre
2024-10-12 13:33:39 +02:00
parent 2b37de8f8b
commit 68b3639a3a
21 changed files with 1204 additions and 0 deletions

172
zzz_test/CHANGELOG.md Normal file
View File

@@ -0,0 +1,172 @@
## v2.0-beta (10-10-2024)
- Switched to v2.0 beta, should hopefully solve everyone's issues!
## v1.12.0-4 (22-09-2024)
- Minor bugs fixed
## v1.12.0-3 (22-09-2024)
- Another version with 1.12 to try to solve issues with config not recognized
## v1.12.0-2 (25-08-2024)
- BACKUP BEFORE UPDATING !!!
- WARNING : version 1.12 erroneously updated to 2.0. Your database could become corrupted if you update from 1.12. You need to restore your homeassistant config directory before updating to this version Alas there is no easy solution to move back from Mealie 2.0 to 1.2.
- If you had a backup from mealie :
- make a clean install (rename folder /homeassistant/addons_config/mealie_data to mealie_data.bak)
- restart the latest version of the addon (which will fully reset) and restore your backup
- If you have a backup from homeassistant of the /config folder :
- you should rename the folder /homeassistant/addons_config/mealie_data to mealie_data.bak
- extract your backup
- Copy the /homeassistant/addons_config/mealie_data folder from your backup to the same path in homeassistant
- Wait for the addon to move back to 2.0 to use your database that was upgraded...
If you have neither, alas Mealie has no way to way back from the upgrade that occurred... For info, I've improved the system to make sure that the data is backuped in the future (this function did not exist when I created the addon) but this doesn't help for this specific issue.
## v1.12.0 (24-08-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.11.0 (03-08-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.10.2 (06-07-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.9.0 (22-06-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.8.0 (08-06-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.7.0 (25-05-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.6.0 (11-05-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.5.1-2 (01-05-2024)
- Minor bugs fixed
## v1.5.1 (20-04-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.4.0 (06-04-2024)
- Update to latest version from hay-kot/mealie (changelog : https://github.com/hay-kot/mealie/releases)
## v1.3.2 (16-03-2024)
- Update to latest version from hay-kot/mealie
## v1.3.1 (09-03-2024)
- Update to latest version from hay-kot/mealie
## v1.2.0 (17-02-2024)
- Update to latest version from hay-kot/mealie
## v1.1.1 (03-02-2024)
- Update to latest version from hay-kot/mealie
## v1.0.0-11 (30-01-2024)
- Fix : incorrect redirect https://github.com/alexbelgium/hassio-addons/issues/1210
## v1.0.0-10 (26-01-2024)
- Fix : .secret permissions denied by allowing again 0 as default user
## v1.0.0-8 (24-01-2024)
- Minor bugs fixed
## v1.0.0-7 (24-01-2024)
- Feat : exposed DATA_DIR in options to set a custom path
## v1.0.0-5 (23-01-2024)
- Fix : avoid spamming of "GET /api/app/about"
## v1.0.0-4 (23-01-2024)
- Breaking change : port 9001 (mapped to 9090 by default) both for http and https
## v1.0.0-3 (22-01-2024)
- Minor bugs fixed
## v1.0.0 (22-01-2024)
- Switch of container to official version 1.0.0
- Adaptation of ports : please check addon options page
- Root user not anymore supported by upstream image, setting it to root (0:0) will revert to 1000:1000
- Default user of 1000:1000
## v1.0.0-RC1.1 (14-10-2023)
- Update to latest version from hay-kot/mealie
## v1.0.0-beta-5-4 (20-06-2023)
- Minor bugs fixed
## v1.0.0-beta-5-3 (07-06-2023)
- Minor bugs fixed
- Fix : avoid loop when upgrading from <1.0 versions https://github.com/alexbelgium/hassio-addons/issues/856
## v1.0.0-beta-5-2 (04-06-2023)
- Minor bugs fixed
## v1.0.0-beta-4 (07-05-2023)
- Minor bugs fixed
## v1.0.0-beta-3 (11-04-2023)
- Minor bugs fixed
## v1.0.0-beta-2 (11-04-2023)
- Fix : ssl (https://github.com/alexbelgium/hassio-addons/issues/782)
- Implemented healthcheck
## v1.0.0-beta-1 (07-01-2023)
- Update to latest version from hay-kot/mealie
## 1.0.1 (03-01-2023)
- Migrates data to cp -r /data/\* /config/ to enable usage of new addons
- WARNING : update to supervisor 2022.11 before installing
- Optional passing of env variables by adding them in a config.yml file (see readme)
- Breaking change : amd64 updated to mealie 1.0
- You'll lose your database : first do a backup from within mealie, then restore after upgrading
## 1.0.0 (18-06-2022)
- Update to latest version from hay-kot/mealie
## 1.0.0.1 (26-05-2022)
- Update to latest version from hay-kot/mealie
- Add codenotary sign
## 0.5.6 (04-02-2022)
- Update to latest version from hay-kot/mealie
## 0.5.5 (04-02-2022)
- Update to latest version from hay-kot/mealie
- New standardized logic for Dockerfile build and packages installation
## 0.5.4 (03-12-2021)
- Update to latest version from hay-kot/mealie
## 0.5.3 (31-10-2021)
- Update to latest version from hay-kot/mealie
- Added ssl option
## 0.5.2 (26-07-2021)
- Update to latest version from hay-kot/mealie
- :arrow_up: Initial release

274
zzz_test/Dockerfile Normal file
View File

@@ -0,0 +1,274 @@
#============================#
# ALEXBELGIUM'S DOCKERFILE #
#============================#
# _.------.
# _.-` ('>.-`"""-.
# '.--'` _'` _ .--.)
# -' '-.-';` `
# ' - _.' ``'--.
# '---` .-'""`
# /`
#=== Home Assistant Addon ===#
#################
# 1 Build Image #
#################
ARG BUILD_FROM
ARG BUILD_VERSION
FROM ${BUILD_FROM} AS base-addon
##################
# 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
# Correct data path
# hadolint ignore=DL4006
RUN grep -rl "/app/data" /app | xargs sed -i 's|/app/data|/config/addons_config/mealie_data|g' && \
sed -i "s|change_user$|# change_user|g" /app/run.sh
##################
# 3 Install Apps #
##################
# Add rootfs
COPY rootfs/ /
# 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"
# 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="nginx"
# 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 Integrate Mealie Dockerfile - Frontend Build
###############################################
# Define build arguments for SUB_PATH
ARG SUB_PATH=/mealie_path/
ENV SUB_PATH=${SUB_PATH}
# Frontend Builder Stage
FROM node:16 AS mealie-frontend-builder
WORKDIR /app/frontend
# Copy frontend source code
COPY ./frontend .
# Install dependencies
RUN yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false \
--network-timeout 1000000
# Pass SUB_PATH to the build environment
ENV SUB_PATH=${SUB_PATH}
# Build the frontend
RUN yarn generate
###############################################
# 5 Integrate Mealie Dockerfile - Python Base and Dependencies
###############################################
FROM python:3.10-slim AS mealie-python-base
ENV MEALIE_HOME="/app"
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv"
# Prepend poetry and venv to PATH
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
# Create user account
RUN useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc \
&& usermod -G users abc \
&& mkdir $MEALIE_HOME
# Builder Base Image
FROM mealie-python-base AS mealie-builder-base
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
curl \
build-essential \
libpq-dev \
libwebp-dev \
# LDAP Dependencies
libsasl2-dev libldap2-dev libssl-dev \
gnupg gnupg2 gnupg1 \
&& rm -rf /var/lib/apt/lists/* \
&& pip install -U --no-cache-dir pip
# Install Poetry
ENV POETRY_VERSION=1.3.1
RUN curl -sSL https://install.python-poetry.org | python3 -
# Copy project requirement files
WORKDIR $PYSETUP_PATH
COPY ./poetry.lock ./pyproject.toml ./
# Install runtime dependencies
RUN poetry install -E pgsql --only main
# CRFPP Image (Assuming it's needed)
FROM hkotel/crfpp AS crfpp
RUN echo "crfpp-container"
# Production Image
FROM mealie-python-base AS mealie-production
LABEL org.opencontainers.image.source="https://github.com/mealie-recipes/mealie"
ENV PRODUCTION=true
ENV TESTING=false
ARG COMMIT
ENV GIT_COMMIT_HASH=${COMMIT}
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
gosu \
iproute2 \
libldap-common \
libldap-2.5 \
&& rm -rf /var/lib/apt/lists/*
# Create directory for Docker Secrets
RUN mkdir -p /run/secrets
# Copy Poetry and virtual environment from builder-base
COPY --from=mealie-builder-base $POETRY_HOME $POETRY_HOME
COPY --from=mealie-builder-base $PYSETUP_PATH $PYSETUP_PATH
ENV LD_LIBRARY_PATH=/usr/local/lib
# Copy CRF++ binaries
COPY --from=crfpp /usr/local/lib/ /usr/local/lib
COPY --from=crfpp /usr/local/bin/crf_learn /usr/local/bin/crf_learn
COPY --from=crfpp /usr/local/bin/crf_test /usr/local/bin/crf_test
# Copy backend application
COPY ./mealie $MEALIE_HOME/mealie
COPY ./poetry.lock ./pyproject.toml $MEALIE_HOME/
# Alembic migrations
COPY ./alembic $MEALIE_HOME/alembic
COPY ./alembic.ini $MEALIE_HOME/
# Install Python runtime dependencies
WORKDIR $MEALIE_HOME
RUN . $VENV_PATH/bin/activate && poetry install -E pgsql --only main
WORKDIR /
# Install CRF++ Models
RUN python $MEALIE_HOME/mealie/scripts/install_model.py
# Define volumes and environment variables
VOLUME [ "$MEALIE_HOME/data/" ]
ENV APP_PORT=9000
EXPOSE ${APP_PORT}
# Healthcheck
HEALTHCHECK CMD python $MEALIE_HOME/mealie/scripts/healthcheck.py || exit 1
# ----------------------------------
# 6 Integrate Mealie Dockerfile - Copy Frontend
ENV STATIC_FILES=/spa/static
COPY --from=mealie-frontend-builder /app/frontend/dist ${STATIC_FILES}
ENV HOST=0.0.0.0
EXPOSE ${APP_PORT}
# ----------------------------------
# 7 Entrypoint and Scripts
# 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
# Modify run.sh for ARMv7
RUN \
# Add custom instructions to run.sh on armv7
sed -i '1d' /app/run.sh \
&& cat /app/run.sh >> /run.txt \
&& cat /run.txt > /app/run.sh \
&& chmod +x /app/run.sh
# Copy and set entrypoint script
COPY ./docker/entry.sh $MEALIE_HOME/run.sh
RUN chmod +x $MEALIE_HOME/run.sh
ENTRYPOINT ["/app/run.sh"]
############
# 8 Labels #
############
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG 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}
#################
# 9 Healthcheck #
#################

128
zzz_test/README.md Normal file
View File

@@ -0,0 +1,128 @@
## &#9888; Open Issue : [[Mealie] Unable to locate custom environment variables (opened 2024-08-31)](https://github.com/alexbelgium/hassio-addons/issues/1558) by [@user34756361233](https://github.com/user34756361233)
## &#9888; Open Issue : [🐛 [Mealie] Mealie not recognising login details (opened 2024-09-20)](https://github.com/alexbelgium/hassio-addons/issues/1580) by [@Valve90210](https://github.com/Valve90210)
## &#9888; Open Issue : [🐛 [Mealie] Error when starting braking after upgrading from 1.12.0-2 to 1.12.0-4 (opened 2024-09-24)](https://github.com/alexbelgium/hassio-addons/issues/1583) by [@jack5mikemotown](https://github.com/jack5mikemotown)
## &#9888; Open Issue : [🐛 [Mealie] Not able to restore backup from standalone Mealie 12.2.0 (opened 2024-09-25)](https://github.com/alexbelgium/hassio-addons/issues/1585) by [@phellarv](https://github.com/phellarv)
# Hass.io Add-ons: Mealie
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
[![Donate][paypal-badge]](https://www.paypal.com/donate/?hosted_button_id=DZFULJZTP3UQA)
![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fmealie%2Fconfig.json)
![Ingress](https://img.shields.io/badge/dynamic/json?label=Ingress&query=%24.ingress&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fmealie%2Fconfig.json)
![Arch](https://img.shields.io/badge/dynamic/json?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fmealie%2Fconfig.json)
[![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%20(no%20paypal)-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white
[paypal-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee%20with%20Paypal-0070BA?logo=paypal&style=flat&logoColor=white
Warning : armv7 only supported up to version 0.4.3! It won't be updated with later versions
_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)
![downloads evolution](https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/mealie/stats.png)
## About
Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family.
This addon for mealie 1.0 is based on the combined [docker image](https://hub.docker.com/r/hendrix04/mealie-combined) from hendrix04.
This addon is based on the [docker image](https://hub.docker.com/r/hkotel/mealie) from hay-kot.
## Configuration
- Start the addon. Wait a while and check the log for any errors.
- Open yourdomain.com:9925 (where ":9925" is the port configured in the addon).
- Default
- Username: changeme@email.com
- Password: MyPassword
Options can be configured through two ways :
- Addon options
```yaml
"BASE_URL": Optional, external base url
"PGID": user ID
"PUID": "group ID
"certfile": fullchain.pem #ssl certificate, must be located in /ssl
"keyfile": privkey.pem #sslkeyfile, must be located in /ssl
"ssl": ssl: true/false
"ALLOW_SIGNUP": Allow signup of users
```
- Config.yaml
Additional options can be configured using the config.yaml file found in /homeassistant/addons_config/xxx-mealie/config.yaml
The complete list of options can be seen here : https://nightly.mealie.io/documentation/getting-started/installation/backend-config/
## Integration with HA
### Detailed infos (Thanks @michelangelonz)
Create a restful sensor
```yaml
sensor:
- platform: rest
resource: "http://###.###.#.#:9090/api/groups/mealplans/today"
method: GET
name: Mealie todays meal
headers:
Authorization: Bearer <put auth here>
value_template: "{{ value_json.value }}"
json_attributes_path: $..recipe
json_attributes:
- name
- id
- totalTime
- prepTime
- performTime
- description
- slug
```
Create template sensors from attributes
```yaml
- name: TodaysDinner
unique_id: sensor.TodaysDinner
state: "{{ state_attr('sensor.mealie_todays_meal', 'name') }}"
- name: TodaysDinnerDescription
unique_id: sensor.DinnerDescription
state: "{{ state_attr('sensor.mealie_todays_meal', 'description') }}"
- name: TodaysDinnerSlug
unique_id: sensor.DinnerSlug
state: "{{ state_attr('sensor.mealie_todays_meal', 'slug') }}"
- name: TodaysDinnerID
unique_id: sensor.DinnerID
state: "{{ state_attr('sensor.mealie_todays_meal', 'id') }}"
```
Add a generic camera for image
http://###.###.#.#:9090/api/media/recipes/{{ state_attr('sensor.mealie_todays_meal', 'id') }}/images/min-original.webp
### Global infos
Read here : https://hay-kot.github.io/mealie/documentation/community-guide/home-assistant/
## 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.
1. Install this add-on.
1. Click the `Save` button to store your configuration.
1. Start the add-on.
1. Check the logs of the add-on to see if everything went well.
1. Carefully configure the add-on to your preferences, see the official documentation for for that.
## Support
If you have in issue with your installation, please be sure to checkout github.
[repository]: https://github.com/alexbelgium/hassio-addons

59
zzz_test/apparmor.txt Normal file
View File

@@ -0,0 +1,59 @@
#include <tunables/global>
profile mealie_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,
# 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,
/dev/fuse mrwkl,
/dev/sda1 mrwkl,
/dev/sdb1 mrwkl,
/dev/nvme0 mrwkl,
/dev/nvme1 mrwkl,
/dev/mmcblk0p1 mrwkl,
# 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,
}

9
zzz_test/build.json Normal file
View File

@@ -0,0 +1,9 @@
{
"build_from": {
"aarch64": "hkotel/mealie:nightly",
"amd64": "hkotel/mealie:nightly"
},
"codenotary": {
"signer": "alexandrep.github@gmail.com"
}
}

117
zzz_test/config.json Normal file
View File

@@ -0,0 +1,117 @@
{
"arch": [
"aarch64",
"amd64"
],
"codenotary": "alexandrep.github@gmail.com",
"description": "Mealie is a self hosted recipe manager and meal planner built in Vue",
"devices": [
"/dev/dri",
"/dev/dri/card0",
"/dev/dri/card1",
"/dev/dri/renderD128",
"/dev/vchiq",
"/dev/video10",
"/dev/video11",
"/dev/video12",
"/dev/video13",
"/dev/video14",
"/dev/video15",
"/dev/video16",
"/dev/ttyUSB0",
"/dev/sda",
"/dev/sdb",
"/dev/sdc",
"/dev/sdd",
"/dev/sde",
"/dev/sdf",
"/dev/sdg",
"/dev/nvme",
"/dev/nvme0n1p1",
"/dev/nvme0n1p2",
"/dev/nvme0n1p3",
"/dev/nvme1n1p1",
"/dev/nvme1n1p2",
"/dev/nvme1n1p3",
"/dev/nvme2n1p1",
"/dev/nvme2n1p2",
"/dev/nvme3n1p3",
"/dev/mmcblk",
"/dev/fuse",
"/dev/sda1",
"/dev/sdb1",
"/dev/sdc1",
"/dev/sdd1",
"/dev/sde1",
"/dev/sdf1",
"/dev/sdg1",
"/dev/sda2",
"/dev/sdb2",
"/dev/sdc2",
"/dev/sdd2",
"/dev/sde2",
"/dev/sdf2",
"/dev/sdg2",
"/dev/sda3",
"/dev/sdb3",
"/dev/sda4",
"/dev/sdb4",
"/dev/sda5",
"/dev/sda6",
"/dev/sda7",
"/dev/sda8",
"/dev/nvme0",
"/dev/nvme1",
"/dev/nvme2"
],
"environment": {
"DATA_DIR": "/config/addons_config/mealie_data",
"DB_ENGINE": "sqlite",
"MAX_WORKERS": "1",
"WEB_CONCURRENCY": "2",
"WEB_GUNICORN": "true",
"WORKERS_PER_CORE": "0.5"
},
"image": "ghcr.io/alexbelgium/test-{arch}",
"ingress": true,
"map": [
"config:rw",
"share:rw",
"ssl:rw"
],
"name": "Mealie test",
"options": {
"ALLOW_SIGNUP": true,
"BASE_SUBPATH": "/mealie",
"DATA_DIR": "/config/addons_config/mealie_data",
"PGID": 1000,
"PUID": 1000,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"ssl": false
},
"panel_admin": false,
"panel_icon": "mdi:silverware-fork-knife",
"ports": {
"9001/tcp": 9090
},
"ports_description": {
"9001/tcp": "Web interface"
},
"schema": {
"ALLOW_SIGNUP": "bool",
"BASE_URL": "str?",
"BASE_SUBPATH": "str?",
"DATA_DIR": "str?",
"PGID": "int",
"PUID": "int",
"certfile": "str",
"keyfile": "str",
"ssl": "bool"
},
"slug": "test",
"udev": true,
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "v2.0-beta_ingress_test",
"webui": "[PROTO:ssl]://[HOST]:[PORT:9001]"
}

BIN
zzz_test/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
zzz_test/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,32 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
if bashio::config.true 'ssl'; then
bashio::log.info "Add ssl"
# Validate ssl
bashio::config.require.ssl
# Adapt nginx template
certfile=$(bashio::config 'certfile')
keyfile=$(bashio::config 'keyfile')
sed -i "s|%%certfile%%|${certfile}|g" /etc/nginx/servers/ssl.conf
sed -i "s|%%keyfile%%|${keyfile}|g" /etc/nginx/servers/ssl.conf
sed -i "s|9001;|9001 ssl;|g" /etc/nginx/servers/ssl.conf
else
sed -i "/ssl/d" /etc/nginx/servers/ssl.conf
fi
bashio::log.info "Adapting for ingress"
ingress_port=$(bashio::addon.ingress_port)
ingress_interface=$(bashio::addon.ip_address)
base_path="$(bashio::config 'BASE_SUBPATH')"
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
sed -i "s/%%BASE_SUBPATH%%/${base_path}/g" /etc/nginx/servers/ingress.conf

View File

@@ -0,0 +1,96 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View File

@@ -0,0 +1,16 @@
proxy_http_version 1.1;
proxy_ignore_client_abort off;
proxy_read_timeout 86400s;
proxy_redirect off;
proxy_send_timeout 86400s;
proxy_max_temp_file_size 0;
proxy_hide_header X-Frame-Options;
proxy_set_header Accept-Encoding "";
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;

View File

@@ -0,0 +1 @@
resolver 127.0.0.11 ipv6=off;

View File

@@ -0,0 +1,6 @@
root /dev/null;
server_name $hostname;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;

View File

@@ -0,0 +1,9 @@
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;
ssl_ecdh_curve secp384r1;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;

View File

@@ -0,0 +1,3 @@
upstream backend {
server 127.0.0.1:9925;
}

View File

@@ -0,0 +1,78 @@
# Run nginx in foreground.
daemon off;
# This is run inside Docker.
user root;
# Pid storage location.
pid /var/run/nginx.pid;
# Set number of worker processes.
worker_processes auto;
# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;
# Write error log to Hass.io add-on log.
error_log /proc/1/fd/1 error;
# Load allowed environment vars
env HASSIO_TOKEN;
# Load dynamic modules.
include /etc/nginx/modules/*.conf;
# Max num of simultaneous connections by a worker process.
events {
worker_connections 8192;
}
http {
include /etc/nginx/includes/mime.types;
# https://emby.media/community/index.php?/topic/93074-how-to-emby-with-nginx-with-windows-specific-tips-and-csp-options/
server_names_hash_bucket_size 64;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;
proxy_connect_timeout 1h;
log_format hassio '[$time_local] $status '
'$http_x_forwarded_for($remote_addr) '
'$request ($http_user_agent)';
access_log /proc/1/fd/1 hassio;
client_max_body_size 4G;
default_type application/octet-stream;
gzip on;
keepalive_timeout 65;
sendfile on;
server_tokens off;
tcp_nodelay on;
tcp_nopush on;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/includes/resolver.conf;
include /etc/nginx/includes/upstream.conf;
include /etc/nginx/servers/*.conf;
}

View File

@@ -0,0 +1,40 @@
server {
listen %%interface%%:%%port%% default_server;
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;
# https://emby.media/community/index.php?/topic/104238-playback-error-no-compatible-streams-are-currently-available/&do=findComment&comment=1097946
proxy_buffering off;
gzip_static off;
client_max_body_size 0;
location / {
# Proxy pass
proxy_pass http://localhost:9000;
# Next three lines allow websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Improve ip handling
proxy_hide_header X-Powered-By;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding "";
proxy_read_timeout 90;
add_header X-Frame-Options "SAMEORIGIN";
add_header 'Referrer-Policy' 'no-referrer';
}
# Correct base_url
absolute_redirect off;
proxy_redirect / %%ingress_entry%%/;
proxy_set_header Accept-Encoding "";
sub_filter_once off;
sub_filter_types *;
sub_filter %%BASE_SUBPATH%%/ %%ingress_entry%%/;
sub_filter 'href="/"' 'href="%%ingress_entry%%/"';
sub_filter '"\/"' '"%%ingress_entry%%\/"';
}

View File

@@ -0,0 +1,28 @@
server {
listen 9001;
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;
ssl_certificate /ssl/%%certfile%%;
ssl_certificate_key /ssl/%%keyfile%%;
location / {
# Proxy pass
proxy_pass http://localhost:9000;
# Next three lines allow websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Improve ip handling
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding "";
proxy_read_timeout 90;
}
}

125
zzz_test/rootfs/run.txt Normal file
View File

@@ -0,0 +1,125 @@
#!/usr/bin/env bashio
# shellcheck shell=bash
set -e
if [ ! -f /started ]; then
touch /started
####################
# Starting scripts #
####################
for SCRIPTS in /etc/cont-init.d/*; do
[ -e "$SCRIPTS" ] || continue
echo "$SCRIPTS: executing"
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
chmod a+x "$SCRIPTS"
# Change shebang if no s6 supervision
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS"
/."$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
rm "$SCRIPTS"
done
####################
# Export variables #
####################
bashio::log.info "Exporting variables"
for k in $(bashio::jq "/data/options.json" 'keys | .[]'); do
bashio::log.blue "$k"="$(bashio::config "$k")"
export "$k"="$(bashio::config "$k")"
done
####################
# MIGRATE DATA DIR #
####################
#if [ -d /homeassistant/addons_config/mealie_data ] && [ ! -f /homeassistant/addons_config/mealie_data/migrated ]; then
# bashio::log.warning "Migrating data, current data will not be touched"
# cp -rnf /homeassistant/addons_config/mealie_data/* /config/ || true
# touch /homeassistant/addons_config/mealie_data/migrated
#fi
#if [ -f /homeassistant/addons_config/mealie/config.yaml ] && [ ! -f /homeassistant/addons_config/mealie/migrated ]; then
# bashio::log.warning "Migrating config.yaml, current data will not be touched"
# cp -nf /homeassistant/addons_config/mealie/config.yaml /config/ || true
# touch /homeassistant/addons_config/mealie/migrated
#fi
###############
# CONFIG YAML #
###############
CONFIGSOURCE="/config/addons_config/mealie/config.yaml"
if [ -f "$CONFIGSOURCE" ]; then
bashio::log.info "config.yaml found in $CONFIGSOURCE, exporting variables"
# Helper function
function parse_yaml {
local prefix=$2 || local prefix=""
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
-e "s| #.*$||g" \
-e "s|#.*$||g" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
}
}'
}
# Get list of parameters in a file
parse_yaml "$CONFIGSOURCE" "" >/tmpfile
while IFS= read -r line; do
# Clean output
line="${line//[\"\']/}"
# Check if secret
if [[ "${line}" == *'!secret '* ]]; then
echo "secret detected"
secret=${line#*secret }
# Check if single match
secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml)
[[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file"
# Get text
secret=$(sed -n "/$secret:/p" /config/secrets.yaml)
secret=${secret#*: }
line="${line%%=*}='$secret'"
fi
# Data validation
if [[ "$line" =~ ^.+[=].+$ ]]; then
export "$line"
# Show in log
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
else
bashio::exit.nok "$line does not follow the correct structure. Please check your yaml file."
fi
done <"/tmpfile"
else
bashio::log.info "No config.yaml found in $CONFIGSOURCE, using default parameters"
fi
###############
# PERMISSIONS #
###############
chmod -R 777 /data
mkdir -p "$DATA_DIR"
cd "$DATA_DIR" || true
chown -R "$PUID:$PGID" .
echo "Permissions adapted"
bashio::log.info "Starting nginx"
nginx & true
bashio::log.info "Starting app"
fi

BIN
zzz_test/stats.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

11
zzz_test/updater.json Normal file
View File

@@ -0,0 +1,11 @@
{
"github_beta": "true",
"github_fulltag": "true",
"last_update": "24-08-2024",
"paused": "true",
"repository": "alexbelgium/hassio-addons",
"slug": "mealie",
"source": "github",
"upstream_repo": "hay-kot/mealie",
"upstream_version": "v1.12.0"
}