Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Fatal error after container install #80

Closed
XZ02R opened this issue Oct 24, 2023 · 7 comments
Closed

Fatal error after container install #80

XZ02R opened this issue Oct 24, 2023 · 7 comments

Comments

@XZ02R
Copy link

XZ02R commented Oct 24, 2023

Description:

After following the steps to install the application via docker-compose.yml, the following error was displayed when connecting to the web application.

Screenshot_20231024_190706

To Reproduce:

  1. Build the image via 'podman-compose build'
  2. Create and start containers via 'podman-compose up -d'
  3. Connect to site via ip:port
  4. See error

Additional Screenshots:

'podman-compose build' output

output1

'podman-compose up -d' output

compose

Configuration files:

.env file
# Your personal settings for docker -- copy this file to .env
# See https://github.com/jzohrab/lute/wiki/Configuration for notes about this file.

# --------------------------------------------
# Backup db and user images.
BACKUP_HOST_DIR=~/Backup/LuteBackup/
BACKUP_ENABLED=false
BACKUP_AUTO=yes
BACKUP_WARN=yes
BACKUP_COUNT=5

# --------------------------------------------
# Security
# Ref https://github.com/jzohrab/lute/wiki/Security

LOGIN_USERNAME=yourusername
LOGIN_PASSWORD=yourpassword


# =============================================
# Don't change anything after this :-)
# The paths given below are set during the Dockerfile build,
# and in the docker-compose.yml.

# The db.  A host folder must be mounted to the container's /lute/data dir.
DB_FILENAME=/lute/data/lute.db

# The backup folder.  A host folder must be mounted to the container's /lute/backup dir.
BACKUP_DIR=/lute/backup

DATABASE_URL=sqlite:///${DB_FILENAME}
APP_SECRET=not_secret_at_all

# Environment.  In docker, this can only be prod, as the dev
# dependencies aren't loaded into the image.
APP_ENV=prod
Dockerfile
FROM php:8.2

# Install mecab for Japanese support
RUN apt-get update -y \
&& apt-get install -y mecab mecab-ipadic-utf8 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Other tools
RUN apt-get update && apt-get install -y \
  git \
  curl \
  zip \
  unzip

ENV APP_ENV=prod

# Install Composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
  && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
  && php -r "unlink('composer-setup.php');"

WORKDIR /lute

COPY ./composer.* ./

# Composer dependencies.
# --no-scripts was necessary because otherwise the build failed with:
#   Executing script cache:clear [KO]
#   Script cache:clear returned with error code 1
#   !!  Could not open input file: ./bin/console
RUN APP_ENV=prod composer install --no-dev --no-scripts

COPY . .
# COPY .env.example ./.env

WORKDIR public
CMD ["php", "-S", "0.0.0.0:8000"]
EXPOSE 8000
docker-compose.yml
version: "3.9"

# Note: Docker users should create an .env file
# using the .env.example.docker as a template.

services:
lute:
  build:
    context: ./
    dockerfile: Dockerfile
  restart: always
  env_file: .env
  ports:
    - 7000:8000
  volumes:
    # The host directories are mounted to the folders
    # specified in .env
    - ./data:/lute/data
    - ${BACKUP_HOST_DIR}:/lute/backup
  working_dir: /lute/public
  command: ["php", "-S", "0.0.0.0:8000"]

Extra software/hardware info:

  • OS: Debian GNU/Linux 12 (bookworm) x86_64
  • Ram: 4gb (It's a headless thin client) + 4gb swap
  • Browser: Firefox 115.3.0esr (64-bit)
  • Container solution: podman (4.3.1+ds1-8)
  • Web server (e.g., regular apache/php, MAMP, XAMP...): Default used in application
  • Version: v2.1.3 release

Additional notes:

  • Podman is running the containers rootless.
  • I also have the original LWT installed and containerised with no issues.
@jzohrab
Copy link
Owner

jzohrab commented Oct 24, 2023

Everything looks good in the files you attached. How much memory does podman allocate for each running instance, is there a way to increase that?

Did you try with Docker? I've never used podman, and so can't comment on it. At first glance it looks good but I understand that it is more complicated.

Lute handles the data completely differently from LWT. At least you have LWT working so you can continue if Lute doesn't work out with your environment -- but it would be nice to sort out running in podman. With a future version of Lute I'm hoping to do away with Docker entirely because it adds yet another layer of complexity for new users.

Thanks for the detailed report, I appreciate you taking the time.

@XZ02R
Copy link
Author

XZ02R commented Oct 25, 2023

Everything looks good in the files you attached. How much memory does podman allocate for each running instance, is there a way to increase that?

It looks like containers get full access to the entire system ram.

Screenshot_20231025_160720

Did you try with Docker? I've never used podman, and so can't comment on it. At first glance it looks good but I understand that it is more complicated.

I just tested docker on a VM and it looks like Lute works fine with that. I also retested podman on another vm and still get the same issue. I mostly use podman to avoid odd docker quirks like it bypassing UFW (a firewall).

Lute handles the data completely differently from LWT. At least you have LWT working so you can continue if Lute doesn't work out with your environment

Looks like I might have to. It's a shame because the parent term feature of Lute is really good feature and helps with avoiding having to re-enter the same definitions for words with conjugations 食べる・食べた・食べている and etc.

With a future version of Lute I'm hoping to do away with Docker entirely because it adds yet another layer of complexity for new users.

New and non-technical users should definitely avoid Docker, but I think it provides value by allowing someone to have access to an application on all devices at any location.

@XZ02R
Copy link
Author

XZ02R commented Oct 25, 2023

Update: I've managed to get past the memory error and am seeing if I can slowly remove the other errors from the logs I am reading. If I manage to get this working I will post instructions for getting this app working with podman.

@XZ02R
Copy link
Author

XZ02R commented Oct 25, 2023

Alright, the fix was surprisingly simple. It turned out that podman-compose is still missing some features for docker-compose feature parity and doesn't work with .env files and the memory issue was probably(?) error log spamming. So the fix for podman users is to use this docker-compose.yml

docker-compose.yml
version: "3.9"

# Note: Docker users should create an .env file
# using the .env.example.docker as a template.

services:
lute:
  build:
    context: ./
    dockerfile: Dockerfile
  restart: always
  environment:
    - BACKUP_HOST_DIR=~/Backup/LuteBackup/
    - BACKUP_ENABLED=false
    - BACKUP_AUTO=yes
    - BACKUP_WARN=yes
    - BACKUP_COUNT=5
    - LOGIN_USERNAME=yourusername
    - LOGIN_PASSWORD=yourpassword
    - DB_FILENAME=/lute/data/lute.db
    - BACKUP_DIR=/lute/backup
    - DATABASE_URL=sqlite:///${DB_FILENAME}
    - APP_SECRET=not_secret_at_all
    - APP_ENV=prod
  env_file: .env
  ports:
    - 8000:8000
  volumes:
    # The host directories are mounted to the folders
    # specified in .env
    - ./data:/lute/data
    - ${BACKUP_HOST_DIR}:/lute/backup
  working_dir: /lute/public
  command: ["php", "-S", "0.0.0.0:8000"]

The issue should be solved now.

@jzohrab
Copy link
Owner

jzohrab commented Oct 25, 2023

Ah that's super, thank you for the new compose file. I'll add that to the wiki, I think, instead of the repo, as it will likely be for a very small set of users (possibly just you!).

I think it provides value by allowing someone to have access to an application on all devices at any location.

Yes, great point, Docker has its place. Currently I think some non-tech users use Docker because it's "simple" on the surface, but it has lots of snags, esp. for Windows users. So with a full python install with all dependencies baked in natively it should be simplified for the vast majority.

Thanks again for the input!

@jzohrab
Copy link
Owner

jzohrab commented Oct 25, 2023

Added https://github.com/jzohrab/lute/wiki/Getting-started-with-podman to wiki.

@XZ02R if that page looks good to you, please close this ticket, or LMK what's missing. Oh I should attribute the info to you :-) Thanks!

@XZ02R
Copy link
Author

XZ02R commented Oct 26, 2023

Cheers, thanks for the nice software.

@XZ02R XZ02R closed this as completed Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants