Skip to content

Commit

Permalink
Merge branch 'master' into update-h5p-packages-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
chrieinv authored Sep 14, 2023
2 parents f80c8bf + 1a8424e commit 75d20c8
Show file tree
Hide file tree
Showing 34 changed files with 12,544 additions and 13,137 deletions.
15 changes: 11 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ volumes:
edlib-resources_nodemodules:
elasticsearch:
maven_cache:
moodle_data:
mysql:
npm_cache:
npm-components-storybook_nodemodules:
Expand Down Expand Up @@ -45,12 +46,12 @@ services:
- 5432:5432

mysql:
image: mariadb:10.5.12
image: mariadb:11
environment:
MYSQL_ROOT_PASSWORD: mysqlpassword
MYSQL_INITDB_SKIP_TZINFO: 1
MARIADB_ROOT_PASSWORD: mysqlpassword
MARIADB_INITDB_SKIP_TZINFO: 1
healthcheck:
test: [CMD, mysql, -uroot, -pmysqlpassword, "-eSELECT 1"]
test: [CMD, mariadb, -uroot, -pmysqlpassword, "-eSELECT 1"]
command: --init-file /data/application/init.sql
volumes:
- ./localSetup/projects/mysql/init.sql:/data/application/init.sql
Expand Down Expand Up @@ -375,6 +376,12 @@ services:
redis:
condition: service_healthy

moodle:
build: ./localSetup/projects/moodle
volumes:
- moodle_data:/var/www/moodledata
- ./localSetup/projects/moodle/php.ini:/usr/local/etc/php/conf.d/zz-moodle.ini:ro

www:
build:
context: ./sourcecode/www
Expand Down
29 changes: 29 additions & 0 deletions localSetup/projects/moodle/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM php:8.1-apache

RUN set -eux; \
export DEBIAN_FRONTEND=noninteractive; \
apt-get update; \
apt-get install -y git; \
rm -rf /var/lib/apt/lists/*;

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

RUN set -eux; \
install-php-extensions \
gd \
intl \
mysqli \
opcache \
zip \
; \
cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \
a2enmod remoteip rewrite;

VOLUME /var/www/html
RUN git clone -b "MOODLE_402_STABLE" https://github.com/moodle/moodle.git /var/www/html

COPY httpd.conf /etc/apache2/conf-enabled/

COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["apachectl", "-D", "FOREGROUND"]
6 changes: 6 additions & 0 deletions localSetup/projects/moodle/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e

chown www-data:www-data /var/www/moodledata

exec "$@"
2 changes: 2 additions & 0 deletions localSetup/projects/moodle/httpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SetEnvIf X-Forwarded-Proto "https" HTTPS=on

1 change: 1 addition & 0 deletions localSetup/projects/moodle/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_input_vars = 5000
1 change: 1 addition & 0 deletions localSetup/projects/mysql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ CREATE DATABASE IF NOT EXISTS edlibresources;
CREATE DATABASE IF NOT EXISTS edlibid;
CREATE DATABASE IF NOT EXISTS edlibcontentauthor;
CREATE DATABASE IF NOT EXISTS edlibcommon;
CREATE DATABASE IF NOT EXISTS moodle;
22 changes: 22 additions & 0 deletions localSetup/projects/nginx/templates/moodle.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 80;

server_name moodle.${EDLIB_ROOT_DOMAIN};

return 301 https://$host$request_uri;
}

server {
listen 443 ssl;
server_name moodle.${EDLIB_ROOT_DOMAIN};

ssl_certificate /etc/ssl/private/cerpus.crt;
ssl_certificate_key /etc/ssl/private/cerpus.key;

location / {
proxy_pass http://moodle;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
1 change: 1 addition & 0 deletions scripts/update-host-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $ip\tapi.$root
$ip\tca.$root
$ip\tdocs.$root
$ip\tfacade.$root
$ip\tmoodle.$root
$ip\tnpm.components.$root
$ip\twww.$root
EOM
Expand Down
2 changes: 1 addition & 1 deletion sourcecode/apis/contentauthor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ WORKDIR /app
RUN npm i -g node-gyp

COPY package.json package-lock.json ./
RUN npm i --legacy-peer-deps
RUN npm i

COPY --from=composer_deps /app/vendor/ckeditor/ckeditor vendor/ckeditor/ckeditor
COPY --from=composer_deps /app/vendor/h5p vendor/h5p
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ private function buildSearchQuery($queryObject): ?array
if (empty($queryObject)) {
return null;
}
$queryObject = json_decode($queryObject, true);
if (empty($queryObject['query'])) {
unset($queryObject['query']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ private function buildSearchQuery($queryObject)
}

$query = [];
$queryObject = json_decode($queryObject);
if (!empty($queryObject->query)) {
$query['query'] = sprintf('text:%s', $queryObject->query);
if (!empty($queryObject['query'])) {
$query['query'] = sprintf('text:%s', $queryObject['query']);
}
if (!empty($queryObject->limit) && isset($queryObject->offset)) {
$query['limit'] = $queryObject->limit;
$query['offset'] = $queryObject->offset;
if (!empty($queryObject['limit']) && isset($queryObject['offset'])) {
$query['limit'] = $queryObject['limit'];
$query['offset'] = $queryObject['offset'];
}
return $query;
}
Expand Down
Loading

0 comments on commit 75d20c8

Please sign in to comment.