diff --git a/ct/mealie.sh b/ct/mealie.sh new file mode 100644 index 00000000..95796b6a --- /dev/null +++ b/ct/mealie.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +source <(curl -s https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://mealie.io + +APP="Mealie" +var_tags="${var_tags:-recipes}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-10}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /var ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating $APP LXC" + $STD apt-get update + $STD apt-get -y upgrade + msg_ok "Updated $APP LXC" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" diff --git a/install/mealie-install.sh b/install/mealie-install.sh new file mode 100644 index 00000000..20498897 --- /dev/null +++ b/install/mealie-install.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://mealie.io + +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 git +msg_ok "Installed Dependencies" + +#fetch_and_deploy_gh_release "mealie" "mealie-recipes/mealie" "tarball" "latest" "/opt/mealie" - deactivated for now + +PYTHON_VERSION="3.12" setup_uv +POSTGRES_VERSION="16" setup_postgresql +NODE_MODULE="yarn" NODE_VERSION="20" setup_nodejs + +msg_info "Get Mealie Repository" +cd /opt +git clone https://github.com/mealie-recipes/mealie +msg_ok "Get Mealie Repository" + +msg_info "Building Frontend" +cd /opt/mealie/frontend +yarn install --prefer-offline --frozen-lockfile --non-interactive --production=false --network-timeout 1000000 +yarn generate +msg_ok "Built Frontend" + +msg_info "Preparing Backend (Poetry)" +$STD uv venv /opt/mealie/.venv +$STD /opt/mealie/.venv/bin/python -m uv pip install -r requirements.txt +cd /opt/mealie +/opt/mealie/.venv/bin/uv pip install poetry==2.0.1 +/opt/mealie/.venv/bin/poetry self add "poetry-plugin-export>=1.9" +msg_ok "Prepared Poetry" + +msg_info "Building Mealie Backend Wheel" +cd /opt/mealie +/opt/mealie/.venv/bin/poetry build --output dist + +MEALIE_VERSION=$(/opt/mealie/.venv/bin/poetry version --short) +/opt/mealie/.venv/bin/poetry export --only=main --extras=pgsql --output=dist/requirements.txt +echo "mealie[pgsql]==$MEALIE_VERSION \\" >>dist/requirements.txt +/opt/mealie/.venv/bin/poetry run pip hash dist/mealie-$MEALIE_VERSION*.whl | tail -n1 | tr -d '\n' >>dist/requirements.txt +echo " \\" >>dist/requirements.txt +/opt/mealie/.venv/bin/poetry run pip hash dist/mealie-$MEALIE_VERSION*.tar.gz | tail -n1 >>dist/requirements.txt +msg_ok "Built Wheel + Requirements" + +msg_info "Installing Mealie via uv" +cd /opt/mealie +/opt/mealie/.venv/bin/uv pip install --require-hashes -r dist/requirements.txt --find-links dist +msg_ok "Installed Mealie" + +msg_info "Downloading NLTK Data" +mkdir -p /nltk_data/ +/opt/mealie/.venv/bin/python -m nltk.downloader -d /nltk_data averaged_perceptron_tagger_eng +msg_ok "Downloaded NLTK Data" + +msg_info "Creating Service" +cat </etc/systemd/system/mealie.service +[Unit] +Description=Mealie Server +After=network.target postgresql.service + +[Service] +User=root +WorkingDirectory=/opt/mealie +ExecStart=/opt/mealie/.venv/bin/python -m mealie +Restart=always +Environment=HOST=0.0.0.0 +Environment=PORT=9000 +Environment=DB_ENGINE=postgres +Environment=POSTGRES_SERVER=localhost +Environment=POSTGRES_PORT=5432 +Environment=POSTGRES_USER=mealie +Environment=POSTGRES_PASSWORD=mealie +Environment=POSTGRES_DB=mealie +Environment=NLTK_DATA=/nltk_data + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now mealie +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"