diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-03-12 07:16:23 +0200 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-03-12 07:16:23 +0200 |
| commit | 7076343338ae3439f3c86f01144818abe8c31978 (patch) | |
| tree | 794abb1e6b8f821091fd095341885496b6dad51d /docker | |
| parent | 47cbb529f5723b246125ae083a193e11481b89ef (diff) | |
| download | classroom-7076343338ae3439f3c86f01144818abe8c31978.tar.gz classroom-7076343338ae3439f3c86f01144818abe8c31978.tar.bz2 classroom-7076343338ae3439f3c86f01144818abe8c31978.zip | |
add container helpers; constuct public directory-tree
Diffstat (limited to 'docker')
| -rw-r--r-- | docker/bin/docker-entrypoint.sh | 19 | ||||
| -rw-r--r-- | docker/bin/optimize.sh | 17 | ||||
| -rw-r--r-- | docker/config/composer-naked.json | 10 | ||||
| -rw-r--r-- | docker/config/composer-redis.json | 11 | ||||
| -rw-r--r-- | docker/config/info.md | 69 | ||||
| -rw-r--r-- | docker/config/opcache.ini | 9 | ||||
| -rw-r--r-- | docker/config/php-ext-xdebug.ini | 24 | ||||
| -rw-r--r-- | docker/config/php-overrides.ini | 3 |
8 files changed, 162 insertions, 0 deletions
diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh new file mode 100644 index 0000000..236c4fb --- /dev/null +++ b/docker/bin/docker-entrypoint.sh @@ -0,0 +1,19 @@ +#! /bin/sh + +# grand to 'cache' directory writable permissions +# set file-cache directory to apache's user ownership +chmod -R 755 /var/www/html/cache +chown -R www-data:www-data /var/www/html/cache + +# copy composer.json to 'www'; then prepare auutoloading +cp /var/www/docker/config/composer-naked.json /var/www/composer.json +(cd /var/www ; composer update) +(cd /var/www ; composer dump-autoload) + +### set -ex +### +### /cloud_sql_proxy -instances=pythia-251711:europe-west4:pythia-db-eu -dir=/cloudsql -credential_file=/cloudsqlproxy.json & +### sleep 3 + +# End with running the original command +exec /usr/sbin/apache2ctl -D FOREGROUND
\ No newline at end of file diff --git a/docker/bin/optimize.sh b/docker/bin/optimize.sh new file mode 100644 index 0000000..02be749 --- /dev/null +++ b/docker/bin/optimize.sh @@ -0,0 +1,17 @@ +!/bin/bash -x + +# optimize performance or development + +if test ["$1" == "PRODUCTION"] ; then + + docker-php-ext-install opcache + # copy OPcache parametres + # etc... + + # install and enable JIT + + # else + # maybe install some development tools + # like XDebug + +fi
\ No newline at end of file diff --git a/docker/config/composer-naked.json b/docker/config/composer-naked.json new file mode 100644 index 0000000..895e53d --- /dev/null +++ b/docker/config/composer-naked.json @@ -0,0 +1,10 @@ +{ + "require": { + }, + "autoload": { + "classmap": [ + "/var/www/core/classes", + "/var/www/html/app" + ] + } +}
\ No newline at end of file diff --git a/docker/config/composer-redis.json b/docker/config/composer-redis.json new file mode 100644 index 0000000..cd929ae --- /dev/null +++ b/docker/config/composer-redis.json @@ -0,0 +1,11 @@ +{ + "require": { + "predis/predis": "^2.0" + }, + "autoload": { + "classmap": [ + "/var/www/core/classes", + "/var/www/html/app" + ] + } +}
\ No newline at end of file diff --git a/docker/config/info.md b/docker/config/info.md new file mode 100644 index 0000000..3ca1c81 --- /dev/null +++ b/docker/config/info.md @@ -0,0 +1,69 @@ +## About cron jobs + +(on docker containers) + +Dockerfile #1 + + RUN apt-get update && apt-get install cron -y + RUN crontab / + crontab -l | { cat; echo "10 * * * * /usr/local/bin/php /var/www/core/cli/cache-categories.php"; } | crontab - + CMD cron + + + +--- + + +Dockerfile #2 + + RUN apt-get update && \ + apt-get -y install tzdata cron + + RUN cp /usr/share/zoneinfo/Europe/Rome /etc/localtime && \ + echo "Europe/Rome" > /etc/timezone + + #RUN apt-get -y remove tzdata + RUN rm -rf /var/cache/apk/* + + # Copy cron file to the cron.d directory + COPY cron /etc/cron.d/cron + + # Give execution rights on the cron job + RUN chmod 0644 /etc/cron.d/cron + + # Apply cron job + RUN crontab /etc/cron.d/cron + + # Create the log file to be able to run tail + RUN mkdir -p /var/log/cron + + # Add a command to base-image entrypont scritp + RUN sed -i 's/^exec /service cron start\n\nexec /' /usr/local/bin/apache2-foreground + + +--- + +handle cron status + + service cron status + service cron stop + service cron start + + + +--- + + +docker folder: organizing configuration files + + docker + |-- bin: docker-ettrypoint.sh, optimize.sh + | + `-- config: composer*.json opcache.ini php-overides.ini cron-jobs + + +--- + + +check: +* http://www.idein.it/joomla/14-docker-php-apache-with-crontab
\ No newline at end of file diff --git a/docker/config/opcache.ini b/docker/config/opcache.ini new file mode 100644 index 0000000..6eba8b2 --- /dev/null +++ b/docker/config/opcache.ini @@ -0,0 +1,9 @@ +[opcache] +opcache.enable=1 +opcache.revalidate_freq=0 +opcache.validate_timestamps=0 +opcache.max_accelerated_files=10000 +opcache.memory_consumption=192 +opcache.max_wasted_percentage=10 +opcache.interned_strings_buffer=16 +opcache.fast_shutdown=1
\ No newline at end of file diff --git a/docker/config/php-ext-xdebug.ini b/docker/config/php-ext-xdebug.ini new file mode 100644 index 0000000..4a6a2ed --- /dev/null +++ b/docker/config/php-ext-xdebug.ini @@ -0,0 +1,24 @@ +; [xdebug] + +; uncomment next line to enable xdebug +zend_extension=xdebug + +; modes where xdebug is enabled +xdebug.mode=develop,debug + +; common parametres +xdebug.start_with_request=yes +xdebug.client_port=9003 +; xdebug.remote_handler=dbgp +xdebug.idekey=VSCODE +xdebug.client_host=host.docker.internal +xdebug.log=/usr/local/etc/php/xdebug.log +;error_reporting=E_ALL + + +; Note: +; Remove the comment ; to enable debugging +;zend_extension=xdebug +xdebug.client_host=host.docker.internal +xdebug.start_with_request=yes +xdebug.mode=debug
\ No newline at end of file diff --git a/docker/config/php-overrides.ini b/docker/config/php-overrides.ini new file mode 100644 index 0000000..215db1a --- /dev/null +++ b/docker/config/php-overrides.ini @@ -0,0 +1,3 @@ +upload_max_filesize = 10M +post_max_size = 14M +memory_limit = 256M
\ No newline at end of file |
