Project

General

Profile

Support #966

Updated by Daniel Curtis about 2 years ago

This is a guide for installing Mealie on Debian. Using the officially supported Docker image will likely be easier, this is just fun. 

 h2. Prepare the Environment 

 * Make sure the system is up to date: 
 <pre> 
 apt update && apt upgrade 
 </pre> 

 * Install some prerequisites: 
 <pre> 
 apt install nodejs npm python3 python3-dev python3-venv python3-pip python3-cryptography git curl build-essential libpq-dev libwebp-dev libsasl2-dev libldap2-dev libssl-dev gnupg gnupg2 gnupg1 debian-keyring debian-archive-keyring apt-transport-https libbluetooth-dev libbz2-dev libc6-dev libexpat1-dev libffi-dev libgdbm-dev liblzma-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev libxslt1-dev libxml2-dev libjpeg-dev make tk-dev uuid-dev wget xz-utils zlib1g-dev rustc 
 </pre> 

 * Create a user for mealie: 
 <pre> 
 useradd -u 911 -U -d /app -s /bin/bash abc 
 mkdir /app 
 mkdir /opt/poetry 
 mkdir /opt/pysetup 
 chown abc:abc /app 
 chown abc:abc /opt/pysetup 
 chown abc:abc /opt/poetry 
 su - abc 
 </pre> 

 * Set a few environment variables: 
 <pre> 
 echo 'export PYTHONUNBUFFERED=1 ' >> ~/.bashrc 
 echo 'export PYTHONDONTWRITEBYTECODE=1' >> ~/.bashrc 
 echo 'export PIP_NO_CACHE_DIR=off' >> ~/.bashrc 
 echo 'export PIP_DISABLE_PIP_VERSION_CHECK=on' >> ~/.bashrc 
 echo 'export PIP_DEFAULT_TIMEOUT=100' >> ~/.bashrc 
 echo 'export POETRY_HOME="/opt/poetry"' >> ~/.bashrc 
 echo 'export POETRY_VIRTUALENVS_IN_PROJECT=true' >> ~/.bashrc 
 echo 'export POETRY_NO_INTERACTION=1' >> ~/.bashrc 
 echo 'export PYSETUP_PATH="/opt/pysetup"' >> ~/.bashrc 
 echo 'export VENV_PATH="/opt/pysetup/.venv"' >> ~/.bashrc 
 source ~/.bashrc 
 </pre> 

 * Install python poetry: 
 <pre> 
 cd $PYSETUP_PATH 
 curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 - 
 </pre> 

 * Add local bin execution path: 
 <pre> 
 echo 'export PATH="/opt/poetry/bin:/opt/pysetup/.venv/bin:$PATH"' >> ~/.bashrc 
 source ~/.bashrc 
 </pre> 

 h2. Install Mealie 

 * Download mealie: 
 <pre> 
 mkdir -p /app/git && cd /app/git 
 git clone https://github.com/hay-kot/mealie.git 
 </pre> 

 h3. Frontend 

 * Setup the frontend directory: 
 <pre> 
 /app 
 cp git/mealie/frontend/package*.json . 
 npm install 
 cp -r git/mealie/frontend/* . 
 npm run build 
 </pre> 

 h3. Backend 

 * Create and prep a temporary build directory: 
 <pre> 
 cd $PYSETUP_PATH 
 cp /app/git/mealie/poetry.lock . 
 cp /app/git/mealie/pyproject.toml . 
 </pre> 

 * Build mealie venv: 
 <pre> 
 poetry install -E pgsql --no-dev 
 </pre> 

 * Build mealie backend: 
 <pre> 
 cd /app 
 cp -r git/mealie . 
 cp mealie/poetry.lock . 
 cp mealie/pyproject.toml . 
 sh /opt/pysetup/.venv/bin/activate 
 poetry install 
 </pre> 

 * Initialize the database: 
 <pre> 
 poetry run python /app/mealie/db/init_db.py 
 poetry run python /app/mealie/services/image/minify.py 
 </pre> 

 * Run the api server: 
 <pre> 
 cp /app/git/mealie/gunicorn_conf.py /app/ 
 uvicorn mealie.app:app --host 0.0.0.0 --port 9000 
 </pre> 

 h3. nxing proxy 

 * Install nginx; 
 <pre> 
 apt install nginx 
 </pre> 

 h3. systemd service 

 * Create the mealie systemd unit file: 
 <pre> 
 sudo nano /etc/systemd/system/mealie.service 
 </pre> 
 #* Add the following: 
 <pre> 
 [Service] 
 PermissionsStartOnly = true 
 User = abc 
 Group = abc 
 WorkingDirectory = /app 
 ExecStart = /usr/bin/sh -c 'cd /app && sh /opt/pysetup/.venv/bin/activate && /opt/pysetup/.venv/bin/uvicorn mealie.app:app --host 0.0.0.0 --port 9000' 
 PrivateTmp = true 

 [Install] 
 WantedBy = multi-user.target 
 </pre> 

 * Set the unit file permissions and reload systemd: 
 <pre> 
 chmod 755 /etc/systemd/system/mealie.service 
 systemctl daemon-reload 
 </pre> 

 * Start and enable mealie at boot: 
 <pre> 
 systemctl enable mealie 
 systemctl start mealie 
 </pre> 

 h2. Resources 
 * https://github.com/hay-kot/mealie 
 * https://hay-kot.github.io/mealie/contributors/developers-guide/starting-dev-server/ 
 * https://hay-kot.github.io/mealie/documentation/getting-started/install/

Back