First Version

This commit is contained in:
Alexandre
2022-12-26 08:09:53 +01:00
committed by GitHub
parent 8b8bf9251f
commit 71570ff755
11 changed files with 421 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ joplin: joplin/config.* # Image : yes
lidarr: lidarr/config.* # Image : yes
mealie: mealie/config.* # Image : yes
mealie_api: mealie_api/config.* # Image : yes
mealie_frontend: mealie_frontend/config.* # IImage : yes
myelectricaldata: myelectricaldata/config.* # Image : yes
myelectricaldata_dev: myelectricaldata_dev/config.* # Image : yes
mylar3: mylar3/config.* # Image : yes

View File

@@ -0,0 +1,7 @@
## v1.0.0-beta-1 (25-12-2022)
- Update to latest version from hay-kot/mealie
## 1.0.0 (25-12-2022)
- Update to latest version from hay-kot/mealie
- New addon

109
mealie_frontend/Dockerfile Normal file
View File

@@ -0,0 +1,109 @@
#============================#
# ALEXBELGIUM'S DOCKERFILE #
#============================#
# _.------.
# _.-` ('>.-`"""-.
# '.--'` _'` _ .--.)
# -' '-.-';` `
# ' - _.' ``'--.
# '---` .-'""`
# /`
#=== Home Assistant Addon ===#
#################
# 1 Build Image #
#################
ARG BUILD_FROM
ARG BUILD_VERSION
ARG BUILD_UPSTREAM="v1.0.0beta-5"
FROM ${BUILD_FROM}${BUILD_UPSTREAM}
##################
# 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|/data|g'
##################
# 3 Install apps #
##################
# Add rootfs
COPY rootfs/ /
# Corrects permissions for s6 v3
RUN if [ -d /etc/cont-init.d ]; then chmod -R 755 /etc/cont-init.d; fi && \
if [ -d /etc/services.d ]; then chmod -R 755 /etc/services.d; fi && \
if [ -f /entrypoint.sh ]; then chmod 755 /entrypoint.sh; fi
# Modules
ARG MODULES="00-banner.sh 01-custom_script.sh"
# Automatic modules download
RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
&& apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true \
&& mkdir -p /etc/cont-init.d \
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
&& chmod -R 755 /etc/cont-init.d
# Manual apps
ENV PACKAGES="jq curl bash"
# Automatic apps & bashio
# hadolint ignore=SC2015
RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
&& chmod 777 /automatic_packages.sh \
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
&& rm /automatic_packages.sh
################
# 4 Entrypoint #
################
RUN \
# Add custom instructions to run.sh
sed -i '1d' /app/mealie/run.sh \
&& cat /app/mealie/run.sh >> /run.txt \
&& cat /run.txt > /app/mealie/run.sh \
&& chmod +x /app/mealie/run.sh
############
# 5 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}

64
mealie_frontend/README.md Normal file
View File

@@ -0,0 +1,64 @@
# Hass.io Add-ons: Mealie frontend
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
![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_frontend%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_frontend%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_frontend%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://github.com/alexbelgium/hassio-addons/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter)
[![Builder](https://github.com/alexbelgium/hassio-addons/workflows/Builder/badge.svg)](https://github.com/alexbelgium/hassio-addons/actions/workflows/builder.yaml)
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&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://git-lister.onrender.com/frontend/stars/alexbelgium/hassio-addons?limit=30)](https://github.com/alexbelgium/hassio-addons/stargazers)
## About
Mealie is a self hosted recipe manager and meal planner with a Restfrontend backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family.
This addon is based on the [docker image](https://hub.docker.com/r/hkotel/mealie) from hay-kot.
This addon contains only the frontend, the frontend is installed with another addon.
## 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.
## Configuration
- Start the addon. Wait a while and check the log for any errors.
- Install the Mealie Frontend Addon, configure it and start it
Options can be configured through two ways :
- Addon options
```yaml
ssl: true/false
certfile: fullchain.pem #ssl certificate, must be located in /ssl
keyfile: privkey.pem #sslkeyfile, must be located in /ssl
```
- Config.yaml
Additional options can be configured using the config.yaml file found in /config/addons_config/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
Read here : https://hay-kot.github.io/mealie/documentation/community-guide/home-assistant/
## Support
If you have in issue with your installation, please be sure to checkout github.
[repository]: https://github.com/alexbelgium/hassio-addons

View File

@@ -0,0 +1,58 @@
#include <tunables/global>
profile mealie_frontend_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/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,
}

View File

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

View File

@@ -0,0 +1,45 @@
{
"arch": [
"aarch64",
"amd64"
],
"codenotary": "alexandrep.github@gmail.com",
"description": "A Self Hosted Recipe Manager (frontend)",
"environment": {
"DB_ENGINE": "sqlite",
"WEB_GUNICORN": "true"
},
"image": "ghcr.io/alexbelgium/mealie_frontend-{arch}",
"map": [
"config:rw",
"share:rw",
"ssl:rw"
],
"name": "Do not use (Mealie frontend)",
"options": {
"PGID": 1000,
"PUID": 1000,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"ssl": false
},
"panel_icon": "mdi:silverware-fork-knife",
"ports": {
"9000/tcp": 9000
},
"ports_description": {
"9000/tcp": "frontend port"
},
"schema": {
"BASE_URL": "str?",
"PGID": "int",
"PUID": "int",
"certfile": "str",
"keyfile": "str",
"ssl": "bool"
},
"slug": "mealie_frontend",
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "v1.0.0-beta-1",
"webui": "[PROTO:ssl]://[HOST]:[PORT:9000]"
}

BIN
mealie_frontend/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
mealie_frontend/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,118 @@
#!/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 "$SCRIPTS: exiting $?"
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
###############
# CONFIG YAML #
###############
CONFIGSOURCE="/config/addons_config/mealie_frontend/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 #
###############
echo "Permissions adapted"
chmod 777 /data
chown -R "$(bashio::config "PUID"):$(bashio::config "PGID")" /data
#######
# SSL #
#######
bashio::config.require.ssl
if bashio::config.true 'ssl'; then
bashio::log.info "Configuring ssl"
CERTFILE=$(bashio::config 'certfile')
KEYFILE=$(bashio::config 'keyfile')
if [ -f /app/Caddyfile ]; then sed -i "7 i tls /ssl/$CERTFILE /ssl/$KEYFILE" /app/Caddyfile; fi
if [ -f /app/frontend/Caddyfile ]; then sed -i "7 i tls /ssl/$CERTFILE /ssl/$KEYFILE" /app/frontend/Caddyfile; fi
fi
bashio::log.info "Starting app"
fi

View File

@@ -0,0 +1,10 @@
{
"github_beta": "true",
"github_fulltag": "true",
"last_update": "25-12-2022",
"repository": "alexbelgium/hassio-addons",
"slug": "mealie_frontend",
"source": "github",
"upstream_repo": "hay-kot/mealie",
"upstream_version": "v1.0.0-beta-1"
}