Project

General

Profile

Support #966

Install Mealie on Debian

Added by Daniel Curtis almost 3 years ago. Updated almost 3 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
Web Server
Target version:
Start date:
01/29/2022
Due date:
% Done:

0%

Estimated time:
2.00 h

Description

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

Prepare the Environment

  • Make sure the system is up to date:
    apt update && apt upgrade
    
  • Install some prerequisites:
    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
    
  • Create a user for mealie:
    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
    
  • Set a few environment variables:
    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
    
  • Install python poetry:
    cd $PYSETUP_PATH
    curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 -
    
  • Add local bin execution path:
    echo 'export PATH="/opt/poetry/bin:/opt/pysetup/.venv/bin:$PATH"' >> ~/.bashrc
    source ~/.bashrc
    

Install Mealie

  • Download mealie:
    mkdir -p /app/git && cd /app/git
    git clone https://github.com/hay-kot/mealie.git
    

Frontend

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

Backend

  • Create and prep a temporary build directory:
    cd $PYSETUP_PATH
    cp /app/git/mealie/poetry.lock .
    cp /app/git/mealie/pyproject.toml .
    
  • Build mealie venv:
    poetry install -E pgsql --no-dev
    
  • Build mealie backend:
    cd /app
    cp -r git/mealie .
    cp mealie/poetry.lock .
    cp mealie/pyproject.toml .
    sh /opt/pysetup/.venv/bin/activate
    poetry install
    
  • Initialize the database:
    poetry run python /app/mealie/db/init_db.py
    poetry run python /app/mealie/services/image/minify.py
    
  • Run the api server:
    cp /app/git/mealie/gunicorn_conf.py /app/
    uvicorn mealie.app:app --host 0.0.0.0 --port 9000
    

nxing proxy

  • Install nginx;
    apt install nginx
    

systemd service

  • Create the mealie systemd unit file:
    sudo nano /etc/systemd/system/mealie.service
    
    • Add the following:
      [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
      
  • Set the unit file permissions and reload systemd:
    chmod 755 /etc/systemd/system/mealie.service
    systemctl daemon-reload
    
  • Start and enable mealie at boot:
    systemctl enable mealie
    systemctl start mealie
    

Resources

#1

Updated by Daniel Curtis almost 3 years ago

  • Description updated (diff)
#2

Updated by Daniel Curtis almost 3 years ago

  • Status changed from New to In Progress
  • Description updated (diff)
#3

Updated by Daniel Curtis almost 3 years ago

  • Description updated (diff)
#4

Updated by Daniel Curtis almost 3 years ago

  • Description updated (diff)
#5

Updated by Daniel Curtis almost 3 years ago

  • Description updated (diff)
#6

Updated by Daniel Curtis almost 3 years ago

  • Description updated (diff)
#7

Updated by Daniel Curtis almost 3 years ago

  • Description updated (diff)

Also available in: Atom PDF