Skip to content

Commit 9297ee5

Browse files
Mealie (#5968)
* 'Add new script' * increase json * env * release crawling with jq * spelling in update * curl * Update mealie-install.sh --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
1 parent 3fc21c7 commit 9297ee5

4 files changed

Lines changed: 286 additions & 0 deletions

File tree

ct/headers/mealie

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__ ___ ___
2+
/ |/ /__ ____ _/ (_)__
3+
/ /|_/ / _ \/ __ `/ / / _ \
4+
/ / / / __/ /_/ / / / __/
5+
/_/ /_/\___/\__,_/_/_/\___/
6+

ct/mealie.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://mealie.io
7+
8+
APP="Mealie"
9+
var_tags="${var_tags:-recipes}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-2048}"
12+
var_disk="${var_disk:-10}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d /opt/mealie ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
RELEASE=$(curl -fsSL https://api.github.com/repos/mealie-recipes/mealie/releases/latest | jq -r '.tag_name | sub("^v"; "")')
33+
if [[ "${RELEASE}" != "$(cat ~/.mealie 2>/dev/null)" ]] || [[ ! -f ~/.mealie ]]; then
34+
35+
PYTHON_VERSION="3.12" setup_uv
36+
NODE_MODULE="yarn" NODE_VERSION="20" setup_nodejs
37+
38+
msg_info "Stopping $APP"
39+
systemctl stop mealie
40+
msg_ok "Stopped $APP"
41+
42+
msg_info "Backing up .env and start.sh"
43+
cp -f /opt/mealie/mealie.env /opt/mealie/mealie.env.bak
44+
cp -f /opt/mealie/start.sh /opt/mealie/start.sh.bak
45+
msg_ok "Backup completed"
46+
47+
fetch_and_deploy_gh_release "mealie" "mealie-recipes/mealie" "tarball" "latest" "/opt/mealie"
48+
49+
msg_info "Rebuilding Frontend"
50+
export NUXT_TELEMETRY_DISABLED=1
51+
cd /opt/mealie/frontend
52+
$STD yarn install --prefer-offline --frozen-lockfile --non-interactive --production=false --network-timeout 1000000
53+
$STD yarn generate
54+
cp -r /opt/mealie/frontend/dist /opt/mealie/mealie/frontend
55+
msg_ok "Frontend rebuilt"
56+
57+
msg_info "Rebuilding Backend Environment"
58+
cd /opt/mealie
59+
$STD /opt/mealie/.venv/bin/poetry self add "poetry-plugin-export>=1.9"
60+
MEALIE_VERSION=$(/opt/mealie/.venv/bin/poetry version --short)
61+
$STD /opt/mealie/.venv/bin/poetry build --output dist
62+
$STD /opt/mealie/.venv/bin/poetry export --only=main --extras=pgsql --output=dist/requirements.txt
63+
echo "mealie[pgsql]==$MEALIE_VERSION \\" >>dist/requirements.txt
64+
/opt/mealie/.venv/bin/poetry run pip hash dist/mealie-$MEALIE_VERSION*.whl | tail -n1 | tr -d '\n' >>dist/requirements.txt
65+
echo " \\" >>dist/requirements.txt
66+
/opt/mealie/.venv/bin/poetry run pip hash dist/mealie-$MEALIE_VERSION*.tar.gz | tail -n1 >>dist/requirements.txt
67+
msg_ok "Backend prepared"
68+
69+
msg_info "Finalize Installation"
70+
$STD /opt/mealie/.venv/bin/uv pip install --require-hashes -r /opt/mealie/dist/requirements.txt --find-links dist
71+
msg_ok "Mealie installed"
72+
73+
msg_info "Restoring Configuration"
74+
mv -f /opt/mealie/mealie.env.bak /opt/mealie/mealie.env
75+
mv -f /opt/mealie/start.sh.bak /opt/mealie/start.sh
76+
chmod +x /opt/mealie/start.sh
77+
msg_ok "Configuration restored"
78+
79+
msg_info "Starting $APP"
80+
systemctl start mealie
81+
msg_ok "Started $APP"
82+
83+
msg_ok "Update to $RELEASE Successful"
84+
else
85+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
86+
fi
87+
exit
88+
}
89+
90+
start
91+
build_container
92+
description
93+
94+
msg_ok "Completed Successfully!\n"
95+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
96+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
97+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9000${CL}"

frontend/public/json/mealie.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/mealie-install.sh

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://mealie.io
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
build-essential \
19+
libpq-dev \
20+
libwebp-dev \
21+
libsasl2-dev \
22+
libldap2-dev \
23+
libssl-dev
24+
msg_ok "Installed Dependencies"
25+
26+
PYTHON_VERSION="3.12" setup_uv
27+
POSTGRES_VERSION="16" setup_postgresql
28+
NODE_MODULE="yarn" NODE_VERSION="20" setup_nodejs
29+
30+
fetch_and_deploy_gh_release "mealie" "mealie-recipes/mealie" "tarball" "latest" "/opt/mealie"
31+
32+
msg_info "Setup Database"
33+
DB_NAME=mealie_db
34+
DB_USER=mealie__user
35+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
36+
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
37+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
38+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
39+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
40+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
41+
$STD sudo -u postgres psql -c "ALTER USER $DB_USER WITH SUPERUSER;"
42+
{
43+
echo "Mealie-Credentials"
44+
echo "Mealie Database User: $DB_USER"
45+
echo "Mealie Database Password: $DB_PASS"
46+
echo "Mealie Database Name: $DB_NAME"
47+
} >>~/mealie.creds
48+
msg_ok "Set up Database"
49+
50+
msg_info "Building Frontend"
51+
export NUXT_TELEMETRY_DISABLED=1
52+
cd /opt/mealie/frontend
53+
$STD yarn install --prefer-offline --frozen-lockfile --non-interactive --production=false --network-timeout 1000000
54+
$STD yarn generate
55+
msg_ok "Built Frontend"
56+
57+
msg_info "Copying Built Frontend into Backend Package"
58+
cp -r /opt/mealie/frontend/dist /opt/mealie/mealie/frontend
59+
msg_ok "Copied Frontend"
60+
61+
msg_info "Preparing Backend (Poetry)"
62+
$STD uv venv /opt/mealie/.venv
63+
$STD /opt/mealie/.venv/bin/python -m ensurepip --upgrade
64+
$STD /opt/mealie/.venv/bin/python -m pip install --upgrade pip
65+
$STD /opt/mealie/.venv/bin/pip install uv
66+
cd /opt/mealie
67+
$STD /opt/mealie/.venv/bin/uv pip install poetry==2.0.1
68+
$STD /opt/mealie/.venv/bin/poetry self add "poetry-plugin-export>=1.9"
69+
msg_ok "Prepared Poetry"
70+
71+
msg_info "Writing Environment File"
72+
cat <<EOF >/opt/mealie/mealie.env
73+
HOST=0.0.0.0
74+
PORT=9000
75+
DB_ENGINE=postgres
76+
POSTGRES_SERVER=localhost
77+
POSTGRES_PORT=5432
78+
POSTGRES_USER=${DB_USER}
79+
POSTGRES_PASSWORD=${DB_PASS}
80+
POSTGRES_DB=${DB_NAME}
81+
NLTK_DATA=/nltk_data
82+
PRODUCTION=true
83+
STATIC_FILES=/opt/mealie/frontend/dist
84+
EOF
85+
msg_ok "Wrote Environment File"
86+
87+
msg_info "Creating Start Script"
88+
cat <<'EOF' >/opt/mealie/start.sh
89+
#!/bin/bash
90+
set -a
91+
source /opt/mealie/mealie.env
92+
set +a
93+
exec /opt/mealie/.venv/bin/mealie
94+
EOF
95+
chmod +x /opt/mealie/start.sh
96+
msg_ok "Created Start Script"
97+
98+
msg_info "Building Mealie Backend Wheel"
99+
cd /opt/mealie
100+
$STD /opt/mealie/.venv/bin/poetry build --output dist
101+
MEALIE_VERSION=$(/opt/mealie/.venv/bin/poetry version --short)
102+
$STD /opt/mealie/.venv/bin/poetry export --only=main --extras=pgsql --output=dist/requirements.txt
103+
echo "mealie[pgsql]==$MEALIE_VERSION \\" >>dist/requirements.txt
104+
/opt/mealie/.venv/bin/poetry run pip hash dist/mealie-$MEALIE_VERSION*.whl | tail -n1 | tr -d '\n' >>dist/requirements.txt
105+
echo " \\" >>dist/requirements.txt
106+
/opt/mealie/.venv/bin/poetry run pip hash dist/mealie-$MEALIE_VERSION*.tar.gz | tail -n1 >>dist/requirements.txt
107+
msg_ok "Built Wheel + Requirements"
108+
109+
msg_info "Installing Mealie via uv"
110+
cd /opt/mealie
111+
$STD /opt/mealie/.venv/bin/uv pip install --require-hashes -r /opt/mealie/dist/requirements.txt --find-links dist
112+
msg_ok "Installed Mealie"
113+
114+
msg_info "Downloading NLTK Data"
115+
mkdir -p /nltk_data/
116+
$STD /opt/mealie/.venv/bin/python -m nltk.downloader -d /nltk_data averaged_perceptron_tagger_eng
117+
msg_ok "Downloaded NLTK Data"
118+
119+
msg_info "Set Symbolic Links for Mealie"
120+
ln -sf /opt/mealie/.venv/bin/mealie /usr/local/bin/mealie
121+
ln -sf /opt/mealie/.venv/bin/poetry /usr/local/bin/poetry
122+
msg_ok "Set Symbolic Links"
123+
124+
msg_info "Creating Systemd Service"
125+
cat <<EOF >/etc/systemd/system/mealie.service
126+
[Unit]
127+
Description=Mealie Backend Server
128+
After=network.target postgresql.service
129+
130+
[Service]
131+
User=root
132+
WorkingDirectory=/opt/mealie
133+
ExecStart=/opt/mealie/start.sh
134+
Restart=always
135+
136+
[Install]
137+
WantedBy=multi-user.target
138+
EOF
139+
systemctl enable -q --now mealie
140+
msg_ok "Created Service"
141+
142+
motd_ssh
143+
customize
144+
145+
msg_info "Cleaning up"
146+
$STD apt-get -y autoremove
147+
$STD apt-get -y autoclean
148+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)