d.jaeger
Goto Top

MaharaProject Docker container not working

Hey Everyone,

i have an mahara-docker-container

-rw-rw-r--  1 daniel   daniel     267 Okt 28 17:16 000-default.conf
-rw-rw-r--  1 daniel   daniel     278 Okt 23 16:42 apache.conf
-rw-rw-r--  1 daniel   daniel     464 Okt 23 15:42 composer.json
-rw-rw-r--  1 daniel   daniel   65349 Okt 23 15:42 composer.lock
drwxrwxrwx  2 daniel   daniel    4096 Okt 24 17:10 config/
drwxr-xr-x  9 www-data www-data  4096 Okt 22 16:38 data/
-rw-rw-r--  1 daniel   daniel     659 Okt 23 16:58 docker-compose.yml
-rw-rw-r--  1 daniel   daniel    2554 Okt 24 17:22 Dockerfile
-rw-rw-r--  1 daniel   daniel     213 Okt 23 20:14 readme.txt
drwxrwxr-x 12 daniel   daniel    4096 Okt 23 15:42 vendor/

The content of the separate files ist
000-default:

<VirtualHost *:80>
    DocumentRoot /var/www/html/mahara/htdocs
    <Directory /var/www/html/mahara/htdocs>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex index.php
    </Directory>
</VirtualHost>


<VirtualHost *:80>
    DocumentRoot /var/www/html/mahara/htdocs
    <Directory /var/www/html/mahara/htdocs>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex index.php index.html
    </Directory>
</VirtualHost>

{
    "name": "mahara/mahara",  
    "description": "Mahara is an open-source ePortfolio and social networking web application.",  
    "require": {  
        "php": ">=7.2",  
        "ext-gd": "*",  
        "ext-mysqli": "*",  
        "ext-intl": "*",  
        "cweagans/composer-patches": "^1.7"  
    },
    "require-dev": {  
        "phpunit/phpunit": "^9.0"  
    },
    "config": {  
        "allow-plugins": {  
            "cweagans/composer-patches": true  
        }
    }
}


version: '3.8'  
services:
  mahara:
    build: .
    ports:
      - "8080:80"  
    volumes:
      - ./data:/var/www/html/mahara/data
      - ./config/config.php:/var/www/html/mahara/htdocs/config.php
      - ./000-default.conf:/etc/apache2/sites-available/000-default.conf  # Füge diese Zeile hinzu
    environment:
      - MYSQL_HOST=db
      - MYSQL_DATABASE=mahara
      - MYSQL_USER=mahara
      - MYSQL_PASSWORD=secret
  db:
    image: mysql:5.7
    environment:
      - MYSQL_ROOT_PASSWORD=rootpassword
      - MYSQL_DATABASE=mahara
      - MYSQL_USER=mahara
      - MYSQL_PASSWORD=secret
    volumes:
      - db_data:/var/lib/mysql
volumes:
  db_data:


FROM php:7.4-apache

# Install necessary packages
RUN apt-get update && apt-get install -y \
    libpng-dev libjpeg-dev libfreetype6-dev libmcrypt-dev libicu-dev libxml2-dev \
    mariadb-client git zip unzip make curl \
    && docker-php-ext-install gd mysqli intl xmlrpc \
    && a2enmod rewrite

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install nvm and Node.js
ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION=16

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash && \
    . "$NVM_DIR/nvm.sh" && \  
    nvm install $NODE_VERSION && \
    nvm use $NODE_VERSION && \
    ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" /usr/bin/node && \  
    ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" /usr/bin/npm && \  
    npm install --global yarn gulp && \
    ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/yarn" /usr/bin/yarn && \  
    ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/gulp" /usr/bin/gulp && \  
    chmod +x "/usr/bin/node" "/usr/bin/npm" "/usr/bin/yarn" "/usr/bin/gulp"  

# Set the working directory
WORKDIR /var/www/html

# Clean the html directory and clone Mahara source code
RUN rm -rf /var/www/html/* && git clone https://git.mahara.org/mahara/mahara.git /var/www/html/mahara

# Mark the directory as safe for Git
RUN git config --global --add safe.directory /var/www/html/mahara

# Copy composer.json and composer.lock
COPY ./composer.json ./composer.lock /var/www/html/mahara/

# Kopiere die angepasste 000-default.conf in den Apache-Konfigurationsordner
COPY ./000-default.conf /etc/apache2/sites-available/000-default.conf

# Allow Composer plugin
RUN composer config --no-plugins allow-plugins.cweagans/composer-patches true

# Install Mahara dependencies via Composer
RUN composer install --no-dev

# Install Yarn dependencies and check available gulp tasks
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && yarn install && gulp --tasks"  

# Check if 'build' task exists before running it 
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && if gulp --tasks | grep -q 'build'; then gulp build; else echo 'No build task found'; fi"  

# Copy config.php into the container
COPY ./config/config.php /var/www/html/mahara/config.php

# Set permissions for www-data
RUN chown -R www-data:www-data /var/www/html && chmod -R 755 /var/www/html

# Set the DocumentRoot to the Mahara htdocs directory
RUN echo 'DocumentRoot /var/www/html/mahara/htdocs' > /etc/apache2/sites-available/000-default.conf  

# Expose the default port
EXPOSE 80


<?php
$cfg = new stdClass();

// Datenbankkonfiguration
$cfg->dbtype = 'mysql';  // Oder 'postgres', falls du PostgreSQL verwendest  
$cfg->dbhost = 'db'; // Der Name des DB-Services in der docker-compose.yml  
$cfg->dbname = 'mahara'; // Der Name der Datenbank  
$cfg->dbuser = 'mahara'; // Der Benutzername für die Datenbank  
$cfg->dbpass = 'secret'; // Das Passwort für die Datenbank  

// Datenverzeichnis
$cfg->dataroot = '/var/www/html/mahara/data'; // Das Verzeichnis für Daten (dies sollte auf das Volume verweisen)  

// URL der Anwendung
$cfg->wwwroot = 'http://localhost:8080'; // Die URL, unter der Mahara erreichbar ist  

// Weitere Einstellungen (optional)
$cfg->theme = 'default'; // Das Standard-Theme  
$cfg->debug = false; // Debugging deaktivieren
$cfg->enablelog = true; // Logging aktivieren

// Wichtige Einstellungen
$cfg->release = '23.04.0'; // Version von Mahara (aktualisieren, wenn notwendig)  

//Loging
$cfg->debug = true;
$cfg->perftofoot = true;
$cfg->log_dbg_targets = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;

When i open the website in a browser, i only see

# Index of /
|![[ICO]](http://localhost:8080/icons/blank.gif)|[Name](http://localhost:8080/?C=N;O=D)|[Last modified](http://localhost:8080/?C=M;O=A)|[Size](http://localhost:8080/?C=S;O=A)|[Description](http://localhost:8080/?C=D;O=A)|
| --- | --- | --- | --- | --- |
|---|
|![[ ]](http://localhost:8080/icons/unknown.gif)|[config.php](http://localhost:8080/config.php)|2024-10-23 12:22|1.0K||
|---|

Apache/2.4.54 (Debian) Server at localhost Port 8080

Can anyone help?

Thanks 4 all

Content-ID: 669081

Url: https://administrator.de/contentid/669081

Ausgedruckt am: 23.11.2024 um 08:11 Uhr

Pjordorf
Pjordorf 28.10.2024 um 17:50:54 Uhr
Goto Top
hI;

Quote from @d.jaeger:
Can anyone help?
You didn't read everything "This repository is not maintained any more and only made available for historical purposes" from here https://github.com/MaharaProject/mahara-scripts

Gruss,
Peter