Project 'ulrike.pado/asyst-moodle-plugin' was moved to 'knight/asyst-moodle-plugin'. Please update any links and bookmarks that may still have the old path.
Commit 0089232d authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Moodle and Python services are separated to isolated services.

2 merge requests!3Fixed whole Docker infrastructure with dummy moodle plugin.,!2Draft: Resolve "can the post be sanitised before passing to the external service?"
Showing with 12 additions and 45 deletions
+12 -45
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
);
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="local/asystgrade/db" VERSION="2024032201" COMMENT="XMLDB file for mod asystgrade plugin"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="local_asystgrade" COMMENT="Table for storing asystgrade data">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true"/>
<FIELD NAME="question" TYPE="text" NOTNULL="true"/>
<FIELD NAME="referenceanswer" TYPE="text" NOTNULL="true"/>
<FIELD NAME="studentanswer" TYPE="text" NOTNULL="true"/>
<FIELD NAME="observed_grade" TYPE="int" LENGTH="3" NOTNULL="true"/>
<FIELD NAME="studentid" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="recordid" TYPE="int" LENGTH="10" NOTNULL="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
......@@ -23,7 +23,7 @@ services:
- ./.env
restart: always
build: # Building own Moodle container from Dockerfile.
context: . # The context of the build (where is Dockerfile)
context: ./moodle # The context of the build (where is Dockerfile)
dockerfile: Dockerfile
args:
- MOODLE_BASE_DIR=${MOODLE_BASE_DIR}
......@@ -50,7 +50,7 @@ services:
flask:
build:
context: ./flask # Папка с Dockerfile для Flask
context: ./flask # The context of the Flask build (where is Dockerfile)
dockerfile: Dockerfile
env_file:
- ./.env
......
......@@ -36,12 +36,12 @@ docker-compose exec moodle php ${MOODLE_BASE_DIR}/admin/cli/install.php \
--non-interactive
# Check if database backup exists and restore it if it does
BACKUP_FILE="moodle_backup.sql"
BACKUP_FILE="moodle/moodle_backup.sql"
if [ -f "$BACKUP_FILE" ]; then
# docker-compose exec mariadb apt-get update && apt-get install -y mysql-client && rm -rf /var/lib/apt/lists/*
docker-compose exec mariadb bash -c "apt-get update && apt-get install -y mysql-client && rm -rf /var/lib/apt/lists/*"
echo "Database backup found. Restoring..."
docker-compose exec -T mariadb mysql -u ${MOODLE_DATABASE_USER} -p${MOODLE_DATABASE_PASSWORD} ${MOODLE_DATABASE_NAME} < moodle_backup.sql
docker-compose exec -T mariadb mysql -u ${MOODLE_DATABASE_USER} -p${MOODLE_DATABASE_PASSWORD} ${MOODLE_DATABASE_NAME} < moodle/moodle_backup.sql
echo "Database restored from backup."
else
echo "No database backup found. Skipping restore."
......
......@@ -21,30 +21,24 @@ RUN apt-get update && apt-get upgrade -y && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Setting necessary php params
#RUN echo "mysql.default_socket=/run/mysqld/mysqld.sock" >> /etc/php/8.2/cli/php.ini
RUN echo "mysql.default_socket=/run/mysqld/mysqld.sock" >> /etc/php/8.2/apache2/php.ini
RUN echo "max_input_vars = 5000" >> /etc/php/8.2/apache2/php.ini
RUN echo "max_input_vars = 5000" >> /etc/php/8.2/cli/php.ini
# Setting Xdebug
#RUN echo "zend_extension=xdebug.so" >> /etc/php/8.2/apache2/php.ini
#RUN echo "xdebug.mode=debug" >> /etc/php/8.2/apache2/php.ini
#RUN echo "xdebug.start_with_request=yes" >> /etc/php/8.2/apache2/php.ini
#RUN echo "xdebug.client_host=host.docker.internal" >> /etc/php/8.2/apache2/php.ini
#RUN echo "xdebug.client_port=9003" >> /etc/php/8.2/apache2/php.ini
RUN echo "zend_extension=xdebug.so" >> /etc/php/8.2/apache2/php.ini
RUN echo "xdebug.mode=debug" >> /etc/php/8.2/apache2/php.ini
RUN echo "xdebug.start_with_request=yes" >> /etc/php/8.2/apache2/php.ini
RUN echo "xdebug.client_host=host.docker.internal" >> /etc/php/8.2/apache2/php.ini
RUN echo "xdebug.client_port=9003" >> /etc/php/8.2/apache2/php.ini
RUN chmod 1777 /tmp
# Installing Moodle Setting correct acces rules
#RUN cd /var/www/html && mkdir -p moodle
#RUN mkdir -p ${MOODLE_BASE_DIR}
RUN echo ${MOODLE_BASE_DIR}
RUN mkdir -p /var/www/html/moodle
WORKDIR ${MOODLE_BASE_DIR}
#RUN #mkdir -p ${MOODLE_BASE_DIR} && \
RUN wget -qO- https://packaging.moodle.org/stable403/moodle-4.3.4.tgz | tar xz -C ${MOODLE_BASE_DIR} --strip-components=1
#RUN wget -qO- https://packaging.moodle.org/stable403/moodle-4.3.4.tgz | tar xz --strip-components=1 -C /var/www/html/moodle
RUN chown -R www-data:www-data ${MOODLE_BASE_DIR} && \
......@@ -55,10 +49,10 @@ RUN chown -R www-data:www-data ${MOODLE_BASE_DIR} && \
chmod -R 755 ${MOODLE_BASE_DIR_DATA}
# Copying of beeing developed Plugin
COPY asystgrade ${MOODLE_BASE_DIR}/local/asystgrade
RUN echo ${MOODLE_BASE_DIR}
RUN mkdir ${MOODLE_BASE_DIR}/local/asystgrade
# Setting correct acces rules for Plugin
#RUN chown -R www-data:www-data ${MOODLE_BASE_DIR}/local/asystgrade && \
RUN chmod -R 755 ${MOODLE_BASE_DIR}/local/asystgrade
# Making Symlink for MariaDB Socket
......@@ -127,8 +121,7 @@ RUN a2enmod ssl
#RUN echo "127.0.0.1 ${MOODLE_WWWROOT##https://}" >> /etc/hosts
#Opening ports
#EXPOSE 80 443 5000
EXPOSE 80 443
# Running supervisord
CMD ["apache2ctl", "-D", "FOREGROUND"]
CMD ["apache2ctl", "-D", "FOREGROUND"]
\ No newline at end of file
File moved
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment