Commit c888fbcb authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Few infrastructure improvements.

parent 2e30eaa7
...@@ -36,6 +36,7 @@ services: ...@@ -36,6 +36,7 @@ services:
ports: ports:
- 80:80 - 80:80
- 443:443 - 443:443
- 9003:9003
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
......
...@@ -11,15 +11,13 @@ RUN python3 -m venv /opt/myenv ...@@ -11,15 +11,13 @@ RUN python3 -m venv /opt/myenv
ENV PATH="/opt/myenv/bin:$PATH" ENV PATH="/opt/myenv/bin:$PATH"
WORKDIR /app WORKDIR /app
RUN ls -la /app
COPY . /app COPY . /app
COPY ./asyst /app/asyst
# Installing dependencies # Installing dependencies
RUN /opt/myenv/bin/pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r /app/requirements.txt RUN /opt/myenv/bin/pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r /app/requirements.txt
#RUN /opt/myenv/bin/python3 -m pip install -r /app/requirements.txt
RUN /opt/myenv/bin/python3 -m pip install --upgrade setuptools wheel RUN /opt/myenv/bin/python3 -m pip install --upgrade setuptools wheel
COPY ./asyst /app/asyst
# Set permissions # Set permissions
RUN chown -R www-data:www-data /app/asyst RUN chown -R www-data:www-data /app/asyst
......
...@@ -54,10 +54,14 @@ docker-compose exec -u root moodle bash -c "apt-get update && apt-get install -y ...@@ -54,10 +54,14 @@ docker-compose exec -u root moodle bash -c "apt-get update && apt-get install -y
update-locale" update-locale"
# Composer installation to run phpunit tests # Composer installation to run phpunit tests
docker-compose exec moodle php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" docker-compose exec moodle bash -c "
docker-compose exec moodle php composer-setup.php --install-dir=/usr/local/bin --filename=composer php -r \"copy('https://getcomposer.org/installer', 'composer-setup.php');\" &&
docker-compose exec moodle php -r "unlink('composer-setup.php');" php composer-setup.php --install-dir=/usr/local/bin --filename=composer &&
docker-compose exec moodle bash -c "cd /app && /usr/local/bin/composer install --no-interaction --no-plugins --no-scripts --no-dev --prefer-dist && /usr/local/bin/composer dump-autoload" php -r \"unlink('composer-setup.php');\" &&
cd /app &&
/usr/local/bin/composer install --no-interaction --no-plugins --no-scripts --no-dev --prefer-dist &&
/usr/local/bin/composer dump-autoload
"
# Next, configure PHPUnit for Moodle: # Next, configure PHPUnit for Moodle:
docker-compose exec moodle php admin/tool/phpunit/cli/init.php docker-compose exec moodle php admin/tool/phpunit/cli/init.php
...@@ -80,7 +84,9 @@ cd /app/asyst/Source/Skript/german ...@@ -80,7 +84,9 @@ cd /app/asyst/Source/Skript/german
/opt/myenv/bin/python3 /app/api.py /opt/myenv/bin/python3 /app/api.py
EOF' EOF'
# Make the script executable & run it # Make the script executable & run it
docker-compose exec flask chmod +x /usr/local/bin/run_sag docker-compose exec flask chmod +x /usr/local/bin/run_sag
docker-compose exec flask /usr/local/bin/run_sag docker-compose exec flask /usr/local/bin/run_sag
# Adding cron-record at the Moodle container
docker-compose exec -u root moodle bash -c "echo '* * * * * /usr/bin/php ${MOODLE_BASE_DIR}/admin/cli/cron.php >/dev/null 2>&1' >> /etc/crontabs/root && crontab /etc/crontabs/root"
...@@ -29,8 +29,10 @@ RUN echo "max_input_vars = 5000" >> /etc/php/8.2/cli/php.ini ...@@ -29,8 +29,10 @@ RUN echo "max_input_vars = 5000" >> /etc/php/8.2/cli/php.ini
RUN echo "zend_extension=xdebug.so" >> /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.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.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_host=host.docker.internal" >> /etc/php/8.2/apache2/php.ini
RUN echo "xdebug.client_host=127.0.0.1" >> /etc/php/8.2/apache2/php.ini
RUN echo "xdebug.client_port=9003" >> /etc/php/8.2/apache2/php.ini RUN echo "xdebug.client_port=9003" >> /etc/php/8.2/apache2/php.ini
RUN echo "xdebug.log=/tmp/xdebug.log" >> /etc/php/8.2/apache2/php.ini
RUN chmod 1777 /tmp RUN chmod 1777 /tmp
...@@ -123,5 +125,5 @@ RUN a2enmod ssl ...@@ -123,5 +125,5 @@ RUN a2enmod ssl
#Opening ports #Opening ports
EXPOSE 80 443 EXPOSE 80 443
# Running supervisord # Launch Apache server in foreground
CMD ["apache2ctl", "-D", "FOREGROUND"] CMD ["apache2ctl", "-D", "FOREGROUND"]
\ No newline at end of file
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