erseco / alpine-moodle

Moodle docker image based on Alpine Linux
https://hub.docker.com/r/erseco/alpine-moodle
MIT License
44 stars 34 forks source link

Could not open input file: /var/www/html/admin/cli/install.php #17

Closed andrea-daru closed 2 years ago

andrea-daru commented 2 years ago

"Could not open input file: /var/www/html/admin/cli/install.php" error if i try to persist on the local filesystem the moodle folder. Someone experiencing the same error? Any help would be appreciated.

0b-ivan commented 2 years ago

Same problem here

erseco commented 2 years ago

Can you provide the commands you both are using to run the container? I'm using the provided docker-compose.yml and running a docker-compose pull && docker-compose up runs without problem for me. Best!

0b-ivan commented 2 years ago

I am using docker-compose up. I need to work with version 3.9 and need access to www/html/local/.../because I am developing a plugin. Do you have any idea how I can fix this error?

Here is the compose file:

version: '2'
services:

  postgres:
    image: postgres:alpine
    restart: unless-stopped
    environment:
      - POSTGRES_PASSWORD=moodle
      - POSTGRES_USER=moodle
      - POSTGRES_DB=moodle
    volumes:
      - postgres:/var/lib/postgresql/data

  moodle:
    image: moodle-39:latest
    build: .
    restart: unless-stopped
    environment:
      - LANG=de_DE.UTF-8
      - LANGUAGE=de_DE:de
      - SITE_URL=https://moodle.quercom.myds.me
      - DB_TYPE=pgsql
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_NAME=moodle
      - DB_USER=moodle
      - DB_PASS=moodle
      - DB_PREFIX=mdl_
      - SSLPROXY=true
      - MOODLE_EMAIL=user@example.com
      - MOODLE_LANGUAGE=de
      - MOODLE_SITENAME=quercom-Moodle
      - MOODLE_USERNAME=admin
      - MOODLE_PASSWORD=#x52&v2pqpyyrW4FCE@m69Tz&rv$gaLHtDBk&^Zg
      - SMTP_HOST=smtp.gmail.com
      - SMTP_PORT=587
      - SMTP_USER=voldemord.sycromoft@gmail.com
      - SMTP_PASSWORD=pbbejknuwhynmjmu \
      - SMTP_PROTOCOL=tls
      - MOODLE_MAIL_NOREPLY_ADDRESS=noreply@quercom.me
      - MOODLE_MAIL_PREFIX=[moodle]
    ports:
      - 8088:8080
    volumes:
      - moodledata:/var/www/moodledata
      - moodledata:/var/www/html
    depends_on:
      - postgres

volumes:
  postgres: null
  moodledata: null
  moodlehtml: null

and Dockerfile:

ARG ARCH=
FROM ${ARCH}erseco/alpine-php7-webserver

LABEL maintainer="Ernesto Serrano <info@ernesto.es>"

USER root
COPY --chown=nobody rootfs/ /

# crond needs root, so install dcron and cap package and set the capabilities
# on dcron binary https://github.com/inter169/systs/blob/master/alpine/crond/README.md
RUN apk add --no-cache dcron libcap && \
    chown nobody:nobody /usr/sbin/crond && \
    setcap cap_setgid=ep /usr/sbin/crond

USER nobody

# Change MOODLE_38_STABLE for new versions
ENV MOODLE_URL=https://github.com/moodle/moodle/archive/MOODLE_39_STABLE.tar.gz \
    LANG=de_DE.UTF-8 \
    LANGUAGE=de_DE:de \
    SITE_URL=https://moodle.quercom.myds.me \
    DB_TYPE=pgsql \
    DB_HOST=postgres \
    DB_PORT=5432 \
    DB_NAME=moodle \
    DB_USER=moodle \
    DB_PASS=moodle \
    DB_PREFIX=mdl_ \
    SSLPROXY=false \
    MOODLE_EMAIL=user@example.com \
    MOODLE_LANGUAGE=en \
    MOODLE_SITENAME=New-Site \
    MOODLE_USERNAME=moodleuser \
    MOODLE_PASSWORD=PLEASE_CHANGEME \
    SMTP_HOST=smtp.gmail.com \
    SMTP_PORT=587 \
    SMTP_USER=your_email@gmail.com \
    SMTP_PASSWORD=your_password \
    SMTP_PROTOCOL=tls \
    MOODLE_MAIL_NOREPLY_ADDRESS=noreply@localhost \
    MOODLE_MAIL_PREFIX=[moodle] \
    client_max_body_size=50M \
    post_max_size=50M \
    upload_max_filesize=50M \
    max_input_vars=1000

RUN curl --location $MOODLE_URL | tar xz --strip-components=1 -C /var/www/html/

Stacktrace:

alpine-moodle-old-moodle-1    | Starting startup scripts in /docker-entrypoint-init.d ...
alpine-moodle-old-moodle-1    | *** Running: /docker-entrypoint-init.d/01-uname.sh
alpine-moodle-old-moodle-1    | Linux 9f31f65b9748 5.15.32-v7l+ #1538 SMP Thu Mar 31 19:39:41 BST 2022 armv7l Linux
alpine-moodle-old-moodle-1    | *** Running: /docker-entrypoint-init.d/02-configure-moodle.sh
alpine-moodle-old-moodle-1    | Waiting for : to be ready
alpine-moodle-old-moodle-1    |  is ready
alpine-moodle-old-moodle-1    | Generating config.php file...
alpine-moodle-old-moodle-1    | Could not open input file: /var/www/html/admin/cli/install.php
alpine-moodle-old-moodle-1    | *** Failed with return value: 0
alpine-moodle-old-moodle-1 exited with code 1
alpine-moodle-old-moodle-1    | Generating config.php file...
alpine-moodle-old-moodle-1    | Could not open input file: /var/www/html/admin/cli/install.php
alpine-moodle-old-moodle-1    | *** Failed with return value: 0
alpine-moodle-old-moodle-1 exited with code 1
alpine-moodle-old-moodle-1    | Generating config.php file...
alpine-moodle-old-moodle-1    | Could not open input file: /var/www/html/admin/cli/install.php
alpine-moodle-old-moodle-1    | *** Failed with return value: 0
alpine-moodle-old-moodle-1 exited with code 1
0b-ivan commented 2 years ago

nvm. I found the problem...

--- - moodledata:/var/www/html +++ - moodlehtml:/var/www/html

erseco commented 2 years ago

Nice to know hat you found the problem! And yes, there are two different directories, and you should name the volumes with a different name

      - moodledata:/var/www/moodledata
      - moodlehtml:/var/www/html

I will close this issue :)