jzohrab / lute

DEPRECATED: LUTE (Learning Using Texts) is a self-hosted web app for learning language through reading, based on Learning with Texts (LWT)
The Unlicense
118 stars 10 forks source link

Fatal error after container install #80

Closed XZ02R closed 1 year ago

XZ02R commented 1 year ago

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](https://github.com/jzohrab/lute/assets/11796293/b7eef5dd-49ad-4184-82e8-135aceb01acb)
'podman-compose up -d' output ![compose](https://github.com/jzohrab/lute/assets/11796293/5a23c57f-3ef8-4dac-88f4-4b7f17339267)

Configuration files:

.env file ```javascript # 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 ```javascript 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 ```javascript 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:

Additional notes:

jzohrab commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 ```javascript 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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Cheers, thanks for the nice software.