From aca900782e99b24120730fd012e4942cd39f192d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Tue, 31 Dec 2024 18:44:46 +0100 Subject: [PATCH 01/13] Testing 5etools. --- ct/5etools.sh | 0 install/5etools-install.sh | 63 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 ct/5etools.sh create mode 100644 install/5etools-install.sh diff --git a/ct/5etools.sh b/ct/5etools.sh new file mode 100644 index 00000000..e69de29b diff --git a/install/5etools-install.sh b/install/5etools-install.sh new file mode 100644 index 00000000..18356f20 --- /dev/null +++ b/install/5etools-install.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 community-scripts ORG +# Author: TheRealVira +# License: MIT +# Source: https://5e.tools/ + +# Import Functions und Setup +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +# Installing Dependencies with the 3 core dependencies (curl;sudo;mc) +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + git \ + jq \ + apache2 + +msg_ok "Installed Dependencies" + +# Setup App +msg_info "Setup 5etools" +echo "\n"\ +" SetHandler server-status\n"\ +" Order deny,allow\n"\ +" Allow from all\n"\ +"\n"\ +>> /usr/local/apache2/conf/httpd.conf + +rm /usr/local/apache2/htdocs/index.html +wget -q "https://github.com/5etools-mirror-3/5etools-src/archive/refs/tags/${RELEASE}.zip" +unzip -q "${RELEASE}.zip" +mv "${APP}-src-${RELEASE}/" "/opt/${APP}" + +chown -R www-data: "/opt/${APP}" +chmod -R 755 "/opt/${APP}" + +# Cleaning up +msg_info "Cleaning Up" +rm -rf "v${RELEASE}.zip" +msg_ok "Setup 5etools" + +# Starting httpd +msg_info "Starting httpd" +httpd-foreground +msg_ok "Started httpd" + +motd_ssh +customize + +# Cleanup +msg_info "Cleaning up" +rm -f "/opt/v${RELEASE}.zip" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From ebcb0e846b0160bc8a7a080fc72f8ce9282630b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 20:48:05 +0100 Subject: [PATCH 02/13] Init mealie lxc. --- ct/mealie.sh | 72 +++++++++++++++++++++++ install/mealie-install.sh | 119 ++++++++++++++++++++++++++++++++++++++ json/mealie.json | 34 +++++++++++ 3 files changed, 225 insertions(+) create mode 100644 ct/mealie.sh create mode 100644 install/mealie-install.sh create mode 100644 json/mealie.json diff --git a/ct/mealie.sh b/ct/mealie.sh new file mode 100644 index 00000000..c55a0045 --- /dev/null +++ b/ct/mealie.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: TheRealVira +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/mealie-recipes/mealie + +# App Default Values +APP="mealie" +var_tags="food" +var_cpu="2" +var_ram="2048" +var_disk="6" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + # Check if installation is present | -f for file, -d for folder + if [[ ! -d "/opt/${APP}" ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -s https://api.github.com/repos/mealie-recipes/mealie/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f "/opt/${APP}_version.txt" ]]; then + # Crawling the new version and checking whether an update is required + msg_info "Updating System" + apt-get update &>/dev/null + apt-get -y upgrade &>/dev/null + msg_ok "Updated System" + + # Execute Update + msg_info "Updating ${APP}" + # TBD + + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP}" + + # Cleaning up + msg_info "Cleaning Up" + rm "${RELEASE}.zip" + $STD apt-get -y autoremove + $STD apt-get -y autoclean + msg_ok "Cleanup Completed" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9000${CL}" diff --git a/install/mealie-install.sh b/install/mealie-install.sh new file mode 100644 index 00000000..87dea676 --- /dev/null +++ b/install/mealie-install.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: TheRealVira +# License: MIT +# Source: https://github.com/mealie-recipes/mealie + +# Import Functions und Setup +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + nodejs \ + npm sudo \ + git \ + python3 \ + curl \ + build-essential \ + libwebp-dev \ + libsasl2-dev \ + libldap2-dev \ + libssl-dev \ + gnupg \ + gnupg2 \ + gnupg1 \ + gosu \ + iproute2 \ + libldap-common \ + libldap-2.5 + +rm -rf /var/lib/apt/lists/* +npm install --global yarn +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/mealie-recipes/mealie/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +msg_info "Downloading mealie ${RELEASE}" +wget -q "https://github.com/mealie-recipes/mealie/archive/refs/tags/${RELEASE}.zip" +unzip "${RELEASE}.zip" -d /app/${APP} +echo "${RELEASE}" >/app/${APP}_version.txt +msg_ok "Downloading mealie ${RELEASE}" + +msg_info "Setting up frontend" +cd /app/${APP} +yarn install \ + --prefer-offline \ + --frozen-lockfile \ + --non-interactive \ + --production=false \ + --network-timeout=1000000 +yarn generate +msg_ok "Setting up frontend" + +msg_info "Setting up ENV" +cat <>/etc/environment +MEALIE_HOME="/app" + +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 +POETRY_VERSION=1.3.1 +PYSETUP_PATH="/opt/pysetup" +VENV_PATH="/opt/pysetup/.venv" + +PRODUCTION=true +TESTING=false +LD_LIBRARY_PATH=/usr/local/lib +APP_PORT=9000 +STATIC_FILES=/spa/static +HOST 0.0.0.0 +EOF +export PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" +msg_ok "Setting up ENV" + +msg_info "Create user account" +useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc +usermod -G users abc +mkdir $MEALIE_HOME +msg_ok "Create user account" + +msg_info "Builder Image" +rm -rf /var/lib/apt/lists/* +pip install -U --no-cache-dir pip +curl -sSL https://install.python-poetry.org | python3 - +cd $PYSETUP_PATH +cp ./poetry.lock ./pyproject.toml ./ +poetry install -E pgsql --only main +msg_ok "Builder Image" + +msg_info "CRFPP Image" +mkdir -p /run/secrets +cp ./mealie $MEALIE_HOME/mealie +cp ./poetry.lock ./pyproject.toml $MEALIE_HOME/ +cd $MEALIE_HOME +. $VENV_PATH/bin/activate +poetry install -E pgsql --only main +cd ~ +python $MEALIE_HOME/mealie/scripts/install_model.py +msg_ok "CRFPP Image" + +msg_info "Copy Frontend" +cp /app/dist $STATIC_FILES +cp ./docker/entry.sh $MEALIE_HOME/run.sh +chmod +x $MEALIE_HOME/run.sh +$MEALIE_HOME/run.sh +msg_ok "Copy Frontend" + +motd_ssh +customize diff --git a/json/mealie.json b/json/mealie.json new file mode 100644 index 00000000..76ca8fc8 --- /dev/null +++ b/json/mealie.json @@ -0,0 +1,34 @@ +{ + "name": "mealie", + "slug": "mealie", + "categories": [ + 0 + ], + "date_created": "2025-01-01", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 9000, + "documentation": "https://docs.mealie.io/", + "website": "https://mealie.io/", + "logo": "https://raw.githubusercontent.com/mealie-recipes/mealie/refs/heads/mealie-next/docs/docs/assets/img/favicon.png", + "description": "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.", + "install_methods": [ + { + "type": "default", + "script": "ct/mealie.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 6, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} \ No newline at end of file From 0ae1c6492b49a464f693bc7762f8d73c29f9d4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 20:49:28 +0100 Subject: [PATCH 03/13] Removed 5etools. Different project... --- ct/5etools.sh | 0 install/5etools-install.sh | 63 -------------------------------------- 2 files changed, 63 deletions(-) delete mode 100644 ct/5etools.sh delete mode 100644 install/5etools-install.sh diff --git a/ct/5etools.sh b/ct/5etools.sh deleted file mode 100644 index e69de29b..00000000 diff --git a/install/5etools-install.sh b/install/5etools-install.sh deleted file mode 100644 index 18356f20..00000000 --- a/install/5etools-install.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2024 community-scripts ORG -# Author: TheRealVira -# License: MIT -# Source: https://5e.tools/ - -# Import Functions und Setup -source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -# Installing Dependencies with the 3 core dependencies (curl;sudo;mc) -msg_info "Installing Dependencies" -$STD apt-get install -y \ - curl \ - sudo \ - git \ - jq \ - apache2 - -msg_ok "Installed Dependencies" - -# Setup App -msg_info "Setup 5etools" -echo "\n"\ -" SetHandler server-status\n"\ -" Order deny,allow\n"\ -" Allow from all\n"\ -"\n"\ ->> /usr/local/apache2/conf/httpd.conf - -rm /usr/local/apache2/htdocs/index.html -wget -q "https://github.com/5etools-mirror-3/5etools-src/archive/refs/tags/${RELEASE}.zip" -unzip -q "${RELEASE}.zip" -mv "${APP}-src-${RELEASE}/" "/opt/${APP}" - -chown -R www-data: "/opt/${APP}" -chmod -R 755 "/opt/${APP}" - -# Cleaning up -msg_info "Cleaning Up" -rm -rf "v${RELEASE}.zip" -msg_ok "Setup 5etools" - -# Starting httpd -msg_info "Starting httpd" -httpd-foreground -msg_ok "Started httpd" - -motd_ssh -customize - -# Cleanup -msg_info "Cleaning up" -rm -f "/opt/v${RELEASE}.zip" -$STD apt-get -y autoremove -$STD apt-get -y autoclean -msg_ok "Cleaned" From 46669f4cfe4290b12202693f99835143e42ea93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:10:24 +0100 Subject: [PATCH 04/13] Added missing folder. --- install/mealie-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 87dea676..653cc45d 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -34,6 +34,7 @@ $STD apt-get install -y \ libldap-common \ libldap-2.5 +mkdir /app rm -rf /var/lib/apt/lists/* npm install --global yarn msg_ok "Installed Dependencies" From 496792f10216d3b1d9b16421fe6794b193965a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:11:53 +0100 Subject: [PATCH 05/13] fixing useradd command. --- install/mealie-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 653cc45d..4f0cccae 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -84,7 +84,7 @@ export PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" msg_ok "Setting up ENV" msg_info "Create user account" -useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc +useradd -u 911 -U -d $MEALIE_HOME abc usermod -G users abc mkdir $MEALIE_HOME msg_ok "Create user account" From 8b691a5b79fdf6d4dad8f69c7ac98dda8d38d9e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:15:15 +0100 Subject: [PATCH 06/13] source env vars. --- install/mealie-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 4f0cccae..80828016 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -81,10 +81,11 @@ STATIC_FILES=/spa/static HOST 0.0.0.0 EOF export PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" +set -a; source /etc/environment; set +a; msg_ok "Setting up ENV" msg_info "Create user account" -useradd -u 911 -U -d $MEALIE_HOME abc +useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc usermod -G users abc mkdir $MEALIE_HOME msg_ok "Create user account" From f8f890f01fd5eec663a0c86bd950df72a41b5fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:18:35 +0100 Subject: [PATCH 07/13] Added unzip. --- install/mealie-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 80828016..745914b6 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -21,6 +21,7 @@ $STD apt-get install -y \ git \ python3 \ curl \ + unzip \ build-essential \ libwebp-dev \ libsasl2-dev \ From 7f69965576ef2383a84f19583c0c425f24475d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:22:02 +0100 Subject: [PATCH 08/13] Added mc. --- install/mealie-install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 745914b6..c555a5c1 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -17,11 +17,12 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ nodejs \ - npm sudo \ + npm \ + sudo \ git \ python3 \ curl \ - unzip \ + mc \ build-essential \ libwebp-dev \ libsasl2-dev \ From 36c004706b65d2f4e6745fbf8e61e91487e3dc13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:25:13 +0100 Subject: [PATCH 09/13] fixes. --- install/mealie-install.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index c555a5c1..6d2df870 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -37,7 +37,6 @@ $STD apt-get install -y \ libldap-2.5 mkdir /app -rm -rf /var/lib/apt/lists/* npm install --global yarn msg_ok "Installed Dependencies" @@ -50,13 +49,13 @@ msg_ok "Downloading mealie ${RELEASE}" msg_info "Setting up frontend" cd /app/${APP} -yarn install \ +npm yarn install \ --prefer-offline \ --frozen-lockfile \ --non-interactive \ --production=false \ --network-timeout=1000000 -yarn generate +npm yarn generate msg_ok "Setting up frontend" msg_info "Setting up ENV" @@ -93,7 +92,6 @@ mkdir $MEALIE_HOME msg_ok "Create user account" msg_info "Builder Image" -rm -rf /var/lib/apt/lists/* pip install -U --no-cache-dir pip curl -sSL https://install.python-poetry.org | python3 - cd $PYSETUP_PATH From 1f1e0c31bf7c8aa605185893ff3cdd6d9af7eacc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:27:31 +0100 Subject: [PATCH 10/13] Fixing name issues. --- install/mealie-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 6d2df870..77424595 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -43,12 +43,12 @@ msg_ok "Installed Dependencies" RELEASE=$(curl -s https://api.github.com/repos/mealie-recipes/mealie/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') msg_info "Downloading mealie ${RELEASE}" wget -q "https://github.com/mealie-recipes/mealie/archive/refs/tags/${RELEASE}.zip" -unzip "${RELEASE}.zip" -d /app/${APP} -echo "${RELEASE}" >/app/${APP}_version.txt +unzip "${RELEASE}.zip" -d /app/mealie +echo "${RELEASE}" >/app/mealie_version.txt msg_ok "Downloading mealie ${RELEASE}" msg_info "Setting up frontend" -cd /app/${APP} +cd /app/mealie npm yarn install \ --prefer-offline \ --frozen-lockfile \ From 303f08e488ad36e6b0b9ec66df86d586e072275c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:28:44 +0100 Subject: [PATCH 11/13] removed duplicate mkdir. --- install/mealie-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 77424595..36777875 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -88,7 +88,6 @@ msg_ok "Setting up ENV" msg_info "Create user account" useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc usermod -G users abc -mkdir $MEALIE_HOME msg_ok "Create user account" msg_info "Builder Image" From 66015ba45c365f9f0c5d6e80c36de5713540b910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:31:37 +0100 Subject: [PATCH 12/13] debugging npm yarn. --- install/mealie-install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 36777875..28310a18 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -37,7 +37,8 @@ $STD apt-get install -y \ libldap-2.5 mkdir /app -npm install --global yarn +$STD npm install -g npm +$STD npm install -g yarn msg_ok "Installed Dependencies" RELEASE=$(curl -s https://api.github.com/repos/mealie-recipes/mealie/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') @@ -49,13 +50,13 @@ msg_ok "Downloading mealie ${RELEASE}" msg_info "Setting up frontend" cd /app/mealie -npm yarn install \ +yarn install \ --prefer-offline \ --frozen-lockfile \ --non-interactive \ --production=false \ --network-timeout=1000000 -npm yarn generate +yarn generate msg_ok "Setting up frontend" msg_info "Setting up ENV" From f3db85739ea131f505a48ec283f6f06f3bb789aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Wed, 1 Jan 2025 21:35:10 +0100 Subject: [PATCH 13/13] debugging npm yarn. --- install/mealie-install.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/install/mealie-install.sh b/install/mealie-install.sh index 28310a18..14732119 100644 --- a/install/mealie-install.sh +++ b/install/mealie-install.sh @@ -37,8 +37,7 @@ $STD apt-get install -y \ libldap-2.5 mkdir /app -$STD npm install -g npm -$STD npm install -g yarn +npm install -g yarn msg_ok "Installed Dependencies" RELEASE=$(curl -s https://api.github.com/repos/mealie-recipes/mealie/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') @@ -50,13 +49,13 @@ msg_ok "Downloading mealie ${RELEASE}" msg_info "Setting up frontend" cd /app/mealie -yarn install \ +/usr/local/bin/yarn install \ --prefer-offline \ --frozen-lockfile \ --non-interactive \ --production=false \ --network-timeout=1000000 -yarn generate +/usr/local/bin/yarn generate msg_ok "Setting up frontend" msg_info "Setting up ENV"