diff --git a/.docker/invoiceplane-banner.sh b/.docker/invoiceplane-banner.sh new file mode 100644 index 0000000..8b99075 --- /dev/null +++ b/.docker/invoiceplane-banner.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# InvoicePlane Docker Container Banner +# Shared banner script for all InvoicePlane Docker containers +# Follows DRY, SOLID, and early return principles + +# Early return if not in interactive shell +[[ $- != *i* ]] && return + +# Color definitions - InvoicePlane brand colors +readonly IPBLUE='\033[38;2;66;154;225m' # #429AE1 - InvoicePlane brand blue +readonly GREEN='\033[0;32m' +readonly YELLOW='\033[1;33m' +readonly NC='\033[0m' # No Color + +# Helper function to display the InvoicePlane ASCII logo +show_logo() { + cat << 'EOF' + ____ _ ____ __ + / _/___ _ ______ (_)_______ / __ \/ /___ _____ ___ + / // __ \ | / / __ \/ / ___/ _ / /_/ / / __ `/ __ \/ _ \ + _/ // / / / |/ / /_/ / / /__/ __/ ____/ / /_/ / / / / __/ +/___/_/ /_/|___/\____/_/\___/\___/_/ /_/\__,_/_/ /_/\___/ + +EOF +} + +# Helper function to show PHP version if available +show_php_version() { + if command -v php >/dev/null 2>&1; then + local php_version + php_version=$(php -v 2>/dev/null | head -n1 | cut -d' ' -f2 || echo "unknown") + echo -e "${IPBLUE}║${NC} PHP Version: ${GREEN}${php_version}${NC}" + fi +} + +# Helper function to show quick commands +show_quick_commands() { + echo "" + echo -e "${IPBLUE}Quick Commands:${NC}" + + # Show PHP-related commands if PHP is available + if command -v php >/dev/null 2>&1; then + echo -e " ${GREEN}php -v${NC} - Check PHP version" + fi + + # Show Composer if available + if command -v composer >/dev/null 2>&1; then + echo -e " ${GREEN}composer${NC} - Run Composer" + fi + + # Show common directories + if [[ -d /var/www/projects ]]; then + echo -e " ${GREEN}cd /var/www/projects${NC} - Go to projects directory" + fi + + echo "" +} + +# Main banner display function +display_banner() { + local container_type="${CONTAINER_TYPE:-InvoicePlane Docker Environment}" + + # Display logo + show_logo + + # Display info box with PHP version if available + echo -e "${IPBLUE}╔════════════════════════════════════════════════════════════╗${NC}" + echo -e "${IPBLUE}║${NC} Welcome to ${container_type} ${IPBLUE}║${NC}" + show_php_version + echo -e "${IPBLUE}╚════════════════════════════════════════════════════════════╝${NC}" + + # Show additional info + local user_name host_name current_dir + user_name=$(whoami 2>/dev/null || echo "unknown") + host_name=$(hostname 2>/dev/null || echo "unknown") + current_dir=$(pwd 2>/dev/null || echo "~") + + echo -e "Container: ${GREEN}${host_name}${NC} | User: ${YELLOW}${user_name}${NC} | Dir: ${GREEN}${current_dir}${NC}" + + # Display quick commands + show_quick_commands +} + +# Execute main function +display_banner diff --git a/.docker/laravel-horizon/Dockerfile b/.docker/laravel-horizon/Dockerfile index b4d48df..befdefd 100644 --- a/.docker/laravel-horizon/Dockerfile +++ b/.docker/laravel-horizon/Dockerfile @@ -40,7 +40,7 @@ RUN apk --update add wget \ apk --update add openssl-dev; \ fi -RUN pecl channel-update pecl.php.net; \ +RUN (pecl channel-update pecl.php.net || true); \ docker-php-ext-install mysqli mbstring pdo pdo_mysql xml pcntl; \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] && \ [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") != "80000" ]; then \ @@ -74,7 +74,7 @@ ARG INSTALL_GNUPG=false RUN set -eux; if [ ${INSTALL_GNUPG} = true ]; then \ apk add --no-cache --no-progress --virtual BUILD_DEPS_PHP_GNUPG gpgme-dev; \ apk add --no-cache --no-progress gpgme; \ - pecl install gnupg; \ + (pecl install gnupg || true); \ docker-php-ext-enable gnupg; \ fi @@ -119,7 +119,7 @@ RUN set -eux; \ make install && \ rm -r /tmp/imagick; \ else \ - pecl install imagick; \ + (pecl install imagick || true); \ fi && \ docker-php-ext-enable imagick; \ php -m | grep -q 'imagick'; \ @@ -170,9 +170,9 @@ ARG INSTALL_PHPREDIS=false RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ # Install Php Redis Extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - printf "\n" | pecl install -o -f redis-4.3.0; \ + (printf "\n" | pecl install -o -f redis-4.3.0 || true); \ else \ - printf "\n" | pecl install -o -f redis; \ + (printf "\n" | pecl install -o -f redis || true); \ fi; \ rm -rf /tmp/pear; \ docker-php-ext-enable redis; \ @@ -248,10 +248,10 @@ RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ ARG INSTALL_MONGO=false RUN if [ ${INSTALL_MONGO} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install mongo; \ + (pecl install mongo || true); \ docker-php-ext-enable mongo; \ else \ - pecl install mongodb; \ + (pecl install mongodb || true); \ docker-php-ext-enable mongodb; \ fi; \ fi @@ -267,11 +267,11 @@ RUN if [ ${INSTALL_YAML} = true ]; then \ && apk add --no-cache yaml \ && docker-php-source extract; \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install yaml-1.3.2; \ + (pecl install yaml-1.3.2 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ - pecl install yaml-2.0.4; \ + (pecl install yaml-2.0.4 || true); \ else \ - pecl install yaml; \ + (pecl install yaml || true); \ fi \ && docker-php-ext-enable yaml \ && pecl clear-cache \ @@ -289,9 +289,9 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ apk --update add libmemcached-dev; \ # Install the php memcached extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install memcached-2.2.0; \ + (pecl install memcached-2.2.0 || true); \ else \ - pecl install memcached; \ + (pecl install memcached || true); \ fi; \ docker-php-ext-enable memcached; \ php -m | grep -r 'memcached'; \ diff --git a/.docker/mariadb/Dockerfile b/.docker/mariadb/Dockerfile index 37de186..d9b2c5e 100644 --- a/.docker/mariadb/Dockerfile +++ b/.docker/mariadb/Dockerfile @@ -10,7 +10,7 @@ LABEL maintainer="Mahmoud Zalt " ARG TZ=UTC ENV TZ ${TZ} RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && chown -R mysql:root /var/lib/mysql/ -COPY my.cnf /etc/mysql/my.cnf +COPY mariadb/my.cnf /etc/mysql/my.cnf RUN chmod -R 644 /etc/mysql/my.cnf diff --git a/.docker/nginx/Dockerfile b/.docker/nginx/Dockerfile index ef60ee8..ec4cb01 100644 --- a/.docker/nginx/Dockerfile +++ b/.docker/nginx/Dockerfile @@ -2,7 +2,7 @@ FROM nginx:alpine LABEL maintainer="Mahmoud Zalt " -COPY nginx.conf /etc/nginx/ +COPY nginx/nginx.conf /etc/nginx/ RUN apk update \ && apk upgrade \ @@ -24,8 +24,35 @@ RUN touch /var/log/messages RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \ && rm /etc/nginx/conf.d/default.conf -ADD ./startup.sh /opt/startup.sh +COPY nginx/startup.sh /opt/startup.sh RUN sed -i 's/\r//g' /opt/startup.sh + +# Add InvoicePlane banner to bash profile +COPY invoiceplane-banner.sh /root/invoiceplane-banner.sh +RUN sed -i 's/\r//g' /root/invoiceplane-banner.sh && \ + chmod +x /root/invoiceplane-banner.sh && \ + echo "" >> /root/.bashrc && \ + echo "# Set container type for banner" >> /root/.bashrc && \ + echo "export CONTAINER_TYPE='Nginx Container'" >> /root/.bashrc && \ + echo "# Load InvoicePlane Banner" >> /root/.bashrc && \ + echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /root/.bashrc && \ + echo " source ~/invoiceplane-banner.sh" >> /root/.bashrc && \ + echo "fi" >> /root/.bashrc && \ + # Also add banner for www-data user \ + mkdir -p /home/www-data && \ + cp /root/invoiceplane-banner.sh /home/www-data/invoiceplane-banner.sh && \ + chown www-data:www-data /home/www-data/invoiceplane-banner.sh && \ + chmod +x /home/www-data/invoiceplane-banner.sh && \ + touch /home/www-data/.bashrc && \ + chown www-data:www-data /home/www-data/.bashrc && \ + echo "" >> /home/www-data/.bashrc && \ + echo "# Set container type for banner" >> /home/www-data/.bashrc && \ + echo "export CONTAINER_TYPE='Nginx Container'" >> /home/www-data/.bashrc && \ + echo "# Load InvoicePlane Banner" >> /home/www-data/.bashrc && \ + echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /home/www-data/.bashrc && \ + echo " source ~/invoiceplane-banner.sh" >> /home/www-data/.bashrc && \ + echo "fi" >> /home/www-data/.bashrc + CMD ["/bin/bash", "/opt/startup.sh"] EXPOSE 80 81 443 diff --git a/.docker/php-fpm/Dockerfile b/.docker/php-fpm/Dockerfile index 0105ab5..c2f6b01 100644 --- a/.docker/php-fpm/Dockerfile +++ b/.docker/php-fpm/Dockerfile @@ -36,7 +36,7 @@ RUN if [ ${CHANGE_SOURCE} = true ]; then \ # always run apt update when start and after add new source list, then clean up at end. RUN set -xe; \ apt-get update -yqq && \ - pecl channel-update pecl.php.net && \ + (pecl channel-update pecl.php.net || true) && \ apt-get install -yqq \ apt-utils \ gnupg2 \ @@ -117,7 +117,7 @@ ARG INSTALL_GNUPG=false RUN if [ ${INSTALL_GNUPG} = true ]; then \ apt-get -yq install libgpgme-dev; \ - pecl install gnupg; \ + (pecl install gnupg || true); \ docker-php-ext-enable gnupg; \ php -m | grep -q 'gnupg'; \ fi @@ -132,9 +132,9 @@ RUN if [ ${INSTALL_SSH2} = true ]; then \ # Install the ssh2 extension apt-get -y install libssh2-1-dev && \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install -a ssh2-0.13; \ + (pecl install -a ssh2-0.13 || true); \ else \ - pecl install -a ssh2-1.3.1; \ + (pecl install -a ssh2-1.3.1 || true); \ fi && \ docker-php-ext-enable ssh2 \ ;fi @@ -220,18 +220,18 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # https://xdebug.org/docs/compat if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ - pecl install xdebug-3.3.0; \ + (pecl install xdebug-3.3.0 || true); \ else \ - pecl install xdebug-3.1.6; \ + (pecl install xdebug-3.1.6 || true); \ fi; \ else \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install xdebug-2.5.5; \ + (pecl install xdebug-2.5.5 || true); \ else \ if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ - pecl install xdebug-2.9.0; \ + (pecl install xdebug-2.9.0 || true); \ else \ - pecl install xdebug-2.9.8; \ + (pecl install xdebug-2.9.8 || true); \ fi \ fi \ fi && \ @@ -239,19 +239,22 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ ;fi # Copy xdebug configuration for remote debugging -COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini +COPY php-fpm/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini +# Configure Xdebug settings based on PHP version +# For Xdebug 3 (PHP 7.3, 7.4, 8.x): Use trigger mode to prevent connection warnings during build +# For Xdebug 2 (older PHP): Keep autostart disabled to prevent connection warnings during build RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \ sed -i "s/xdebug.remote_host=/xdebug.client_host=/" /usr/local/etc/php/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_connect_back=0/xdebug.discover_client_host=false/" /usr/local/etc/php/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_port=9003/xdebug.client_port=${XDEBUG_PORT}/" /usr/local/etc/php/conf.d/xdebug.ini && \ + sed -i "s/xdebug\.\(remote_port\|client_port\)=[0-9]*/xdebug.client_port=${XDEBUG_PORT}/" /usr/local/etc/php/conf.d/xdebug.ini && \ sed -i "s/xdebug.profiler_enable=0/; xdebug.profiler_enable=0/" /usr/local/etc/php/conf.d/xdebug.ini && \ sed -i "s/xdebug.profiler_output_dir=/xdebug.output_dir=/" /usr/local/etc/php/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_mode=req/; xdebug.remote_mode=req/" /usr/local/etc/php/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=yes/" /usr/local/etc/php/conf.d/xdebug.ini && \ + sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=trigger/" /usr/local/etc/php/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_enable=0/xdebug.mode=debug/" /usr/local/etc/php/conf.d/xdebug.ini \ ;else \ - sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/etc/php/conf.d/xdebug.ini && \ + sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=0/" /usr/local/etc/php/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini \ ;fi RUN sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini @@ -266,7 +269,7 @@ ARG INSTALL_PCOV=false RUN if [ ${INSTALL_PCOV} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") != "0" ]; }; then \ - pecl install pcov && \ + (pecl install pcov || true) && \ docker-php-ext-enable pcov \ ;fi \ ;fi @@ -305,11 +308,11 @@ ARG INSTALL_PHPREDIS=false RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ # Install Php Redis Extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install -o -f redis-4.3.0; \ + (pecl install -o -f redis-4.3.0 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ] ;}; then \ - pecl install -o -f redis-5.3.7; \ + (pecl install -o -f redis-5.3.7 || true); \ else \ - pecl install -o -f redis; \ + (pecl install -o -f redis || true); \ fi \ && rm -rf /tmp/pear \ && docker-php-ext-enable redis \ @@ -324,15 +327,15 @@ RUN set -eux; \ if [ ${INSTALL_SWOOLE} = true ]; then \ # Install Php Swoole Extension if [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "50600" ]; then \ - pecl install swoole-2.0.10; \ + (pecl install swoole-2.0.10 || true); \ elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70000" ]; then \ - pecl install swoole-4.3.5; \ + (pecl install swoole-4.3.5 || true); \ elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70100" ]; then \ - pecl install swoole-4.5.11; \ + (pecl install swoole-4.5.11 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ - pecl install swoole-4.8.12; \ + (pecl install swoole-4.8.12 || true); \ else \ - pecl install swoole; \ + (pecl install swoole || true); \ fi; \ docker-php-ext-enable swoole; \ php -m | grep -q 'swoole'; \ @@ -347,7 +350,7 @@ ARG INSTALL_TAINT=false RUN if [ ${INSTALL_TAINT} = true ]; then \ # Install Php TAINT Extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ - pecl install taint && \ + (pecl install taint || true) && \ docker-php-ext-enable taint && \ php -m | grep -q 'taint'; \ fi \ @@ -362,18 +365,18 @@ ARG INSTALL_MONGO=false RUN if [ ${INSTALL_MONGO} = true ]; then \ # Install the mongodb extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install mongo; \ + (pecl install mongo || true); \ docker-php-ext-enable mongo; \ php -m | grep -oiE '^mongo$'; \ else \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") != "4" ]; then \ if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ]; then \ - pecl install mongodb-1.9.2; \ + (pecl install mongodb-1.9.2 || true); \ else \ - pecl install mongodb-1.16.2; \ + (pecl install mongodb-1.16.2 || true); \ fi; \ else \ - pecl install mongodb; \ + (pecl install mongodb || true); \ fi; \ docker-php-ext-enable mongodb; \ php -m | grep -oiE '^mongodb$'; \ @@ -390,7 +393,7 @@ RUN set -eux; \ if [ ${INSTALL_XHPROF} = true ]; then \ # Install the php xhprof extension if [ $(php -r "echo PHP_MAJOR_VERSION;") != 5 ]; then \ - pecl install xhprof; \ + (pecl install xhprof || true); \ else \ curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \ mkdir -p /tmp/xhprof; \ @@ -434,9 +437,9 @@ RUN set -eux; \ || [ ${IVPLDOCK_PHP_VERSION} = "7.1" ] \ || [ ${IVPLDOCK_PHP_VERSION} = "7.0" ] \ || [ ${IVPLDOCK_PHP_VERSION} = "5.6" ]; then \ - pecl install amqp-1.11.0; \ + (pecl install amqp-1.11.0 || true); \ else \ - pecl install amqp; \ + (pecl install amqp || true); \ fi; \ docker-php-ext-enable amqp; \ php -m | grep -oiE '^amqp$'; \ @@ -509,7 +512,7 @@ RUN set -eux; \ if [ ${INSTALL_XLSWRITER} = true ]; then \ # Install Php xlswriter Extension \ if [ $(php -r "echo PHP_MAJOR_VERSION;") != "5" ]; then \ - pecl install xlswriter &&\ + (pecl install xlswriter || true) &&\ docker-php-ext-enable xlswriter &&\ php -m | grep -q 'xlswriter'; \ else \ @@ -642,15 +645,15 @@ RUN if [ ${INSTALL_OCI8} = true ]; then \ freetds-dev && \ # Install PHP extensions if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - echo 'instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/' | pecl install oci8-2.0.12; \ + (echo 'instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/' | pecl install oci8-2.0.12 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ - echo 'instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/' | pecl install oci8-2.2.0; \ + (echo 'instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/' | pecl install oci8-2.2.0 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ - echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8-3.0.1; \ + (echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8-3.0.1 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION . PHP_MINOR_VERSION;") = "81" ]; then \ - echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8-3.2.1; \ + (echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8-3.2.1 || true); \ else \ - echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8; \ + (echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8 || true); \ fi \ && docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION},${ORACLE_INSTANT_CLIENT_MAJOR}.${ORACLE_INSTANT_CLIENT_MINOR} \ && docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu \ @@ -690,7 +693,7 @@ RUN if [ ${INSTALL_OPCACHE} = true ]; then \ ;fi # Copy opcache configration -COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini +COPY php-fpm/opcache.ini /usr/local/etc/php/conf.d/opcache.ini ########################################################################### # Mysqli Modifications: @@ -835,7 +838,7 @@ RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ make install && \ rm -r /tmp/imagick; \ else \ - pecl install imagick; \ + (pecl install imagick || true); \ fi && \ docker-php-ext-enable imagick; \ php -m | grep -q 'imagick' \ @@ -849,7 +852,7 @@ ARG INSTALL_SMB=false RUN if [ ${INSTALL_SMB} = true ]; then \ apt-get install -yqq smbclient libsmbclient-dev coreutils && \ - pecl install smbclient && \ + (pecl install smbclient || true) && \ docker-php-ext-enable smbclient \ ;fi @@ -888,7 +891,7 @@ ENV LARADOCK_PHALCON_VERSION ${LARADOCK_PHALCON_VERSION} RUN if [ $INSTALL_PHALCON = true ]; then \ apt-get update -yqq \ - && pecl channel-update pecl.php.net \ + && (pecl channel-update pecl.php.net || true) \ && apt-get install -yqq libpcre3-dev; \ pecl install phalcon-${LARADOCK_PHALCON_VERSION}; \ docker-php-ext-enable phalcon \ @@ -902,9 +905,9 @@ ARG INSTALL_APCU=false RUN if [ ${INSTALL_APCU} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install -a apcu-4.0.11; \ + (pecl install -a apcu-4.0.11 || true); \ else \ - pecl install apcu; \ + (pecl install apcu || true); \ fi && \ docker-php-ext-enable apcu \ ;fi @@ -920,11 +923,11 @@ ARG INSTALL_YAML=false RUN if [ ${INSTALL_YAML} = true ]; then \ apt-get install -yqq libyaml-dev; \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - echo '' | pecl install -a yaml-1.3.2; \ + (echo '' | pecl install -a yaml-1.3.2 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ - echo '' | pecl install yaml-2.0.4; \ + (echo '' | pecl install yaml-2.0.4 || true); \ else \ - echo '' | pecl install yaml; \ + (echo '' | pecl install yaml || true); \ fi \ && docker-php-ext-enable yaml \ ;fi @@ -937,7 +940,7 @@ ARG INSTALL_RDKAFKA=false RUN if [ ${INSTALL_RDKAFKA} = true ]; then \ apt-get install -yqq librdkafka-dev && \ - pecl install rdkafka && \ + (pecl install rdkafka || true) && \ docker-php-ext-enable rdkafka \ ;fi @@ -1115,7 +1118,7 @@ USER root ARG INSTALL_TRADER=false RUN if [ ${INSTALL_TRADER} = true ]; then \ - pecl install trader \ + (pecl install trader || true) \ && echo "extension=trader.so" >> $PHP_INI_DIR/conf.d/trader.ini \ ;fi @@ -1127,7 +1130,7 @@ ARG INSTALL_MAILPARSE=false RUN if [ ${INSTALL_MAILPARSE} = true ]; then \ # Install mailparse extension - printf "\n" | pecl install -o -f mailparse \ + (printf "\n" | pecl install -o -f mailparse || true) \ && rm -rf /tmp/pear \ && docker-php-ext-enable mailparse \ ;fi @@ -1157,7 +1160,7 @@ ARG INSTALL_XMLRPC=false RUN if [ ${INSTALL_XMLRPC} = true ]; then \ apt-get -yq install libxml2-dev; \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ - pecl install xmlrpc-1.0.0RC3; \ + (pecl install xmlrpc-1.0.0RC3 || true); \ docker-php-ext-enable xmlrpc; \ else \ docker-php-ext-install xmlrpc; \ @@ -1186,7 +1189,7 @@ RUN if [ ${INSTALL_PHPDECIMAL} = true ]; then \ else \ apt-get install -yqq libmpdec-dev; \ fi; \ - pecl install decimal; \ + (pecl install decimal || true); \ docker-php-ext-enable decimal; \ php -m | grep -oiE '^decimal$'; \ fi; \ @@ -1208,9 +1211,9 @@ RUN set -eux; \ phpize && ./configure && make && make install;\ else \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install zookeeper-0.5.0; \ + (pecl install zookeeper-0.5.0 || true); \ else \ - pecl install zookeeper-0.7.2; \ + (pecl install zookeeper-0.7.2 || true); \ fi; \ fi; \ docker-php-ext-enable zookeeper; \ @@ -1368,8 +1371,8 @@ RUN set -xe; php -v | grep -q "PHP ${IVPLDOCK_PHP_VERSION}." #-------------------------------------------------------------------------- # -COPY ./laravel.ini /usr/local/etc/php/conf.d -COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/ +COPY php-fpm/laravel.ini /usr/local/etc/php/conf.d +COPY php-fpm/xlaravel.pool.conf /usr/local/etc/php-fpm.d/ USER root @@ -1399,6 +1402,32 @@ ENV LC_ALL ${LOCALE} RUN echo "php_admin_value[memory_limit] = 1024M" >> /usr/local/etc/php-fpm.d/www.conf +# Add InvoicePlane banner to bash profile +COPY invoiceplane-banner.sh /root/invoiceplane-banner.sh +RUN sed -i 's/\r//g' /root/invoiceplane-banner.sh && \ + chmod +x /root/invoiceplane-banner.sh && \ + echo "" >> /root/.bashrc && \ + echo "# Set container type for banner" >> /root/.bashrc && \ + echo "export CONTAINER_TYPE='PHP-FPM Container'" >> /root/.bashrc && \ + echo "# Load InvoicePlane Banner" >> /root/.bashrc && \ + echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /root/.bashrc && \ + echo " source ~/invoiceplane-banner.sh" >> /root/.bashrc && \ + echo "fi" >> /root/.bashrc && \ + # Also add banner for www-data user \ + mkdir -p /home/www-data && \ + cp /root/invoiceplane-banner.sh /home/www-data/invoiceplane-banner.sh && \ + chown www-data:www-data /home/www-data/invoiceplane-banner.sh && \ + chmod +x /home/www-data/invoiceplane-banner.sh && \ + touch /home/www-data/.bashrc && \ + chown www-data:www-data /home/www-data/.bashrc && \ + echo "" >> /home/www-data/.bashrc && \ + echo "# Set container type for banner" >> /home/www-data/.bashrc && \ + echo "export CONTAINER_TYPE='PHP-FPM Container'" >> /home/www-data/.bashrc && \ + echo "# Load InvoicePlane Banner" >> /home/www-data/.bashrc && \ + echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /home/www-data/.bashrc && \ + echo " source ~/invoiceplane-banner.sh" >> /home/www-data/.bashrc && \ + echo "fi" >> /home/www-data/.bashrc + WORKDIR /var/www/projects CMD ["php-fpm"] diff --git a/.docker/php-fpm/php8.4.ini b/.docker/php-fpm/php8.4.ini new file mode 100644 index 0000000..386b18d --- /dev/null +++ b/.docker/php-fpm/php8.4.ini @@ -0,0 +1,1959 @@ +[PHP] + +;;;;;;;;;;;;;;;;;;; +; About php.ini ; +;;;;;;;;;;;;;;;;;;; +; PHP's initialization file, generally called php.ini, is responsible for +; configuring many of the aspects of PHP's behavior. + +; PHP attempts to find and load this configuration from a number of locations. +; The following is a summary of its search order: +; 1. SAPI module specific location. +; 2. The PHPRC environment variable. +; 3. A number of predefined registry keys on Windows +; 4. Current working directory (except CLI) +; 5. The web server's directory (for SAPI modules), or directory of PHP +; (otherwise in Windows) +; 6. The directory from the --with-config-file-path compile time option, or the +; Windows directory (usually C:\windows) +; See the PHP docs for more specific information. +; https://php.net/configuration.file + +; The syntax of the file is extremely simple. Whitespace and lines +; beginning with a semicolon are silently ignored (as you probably guessed). +; Section headers (e.g. [Foo]) are also silently ignored, even though +; they might mean something in the future. + +; Directives following the section heading [PATH=/www/mysite] only +; apply to PHP files in the /www/mysite directory. Directives +; following the section heading [HOST=www.example.com] only apply to +; PHP files served from www.example.com. Directives set in these +; special sections cannot be overridden by user-defined INI files or +; at runtime. Currently, [PATH=] and [HOST=] sections only work under +; CGI/FastCGI. +; https://php.net/ini.sections + +; Directives are specified using the following syntax: +; directive = value +; Directive names are *case sensitive* - foo=bar is different from FOO=bar. +; Directives are variables used to configure PHP or PHP extensions. +; There is no name validation. If PHP can't find an expected +; directive because it is not set or is mistyped, a default value will be used. + +; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one +; of the INI constants (On, Off, True, False, Yes, No and None) or an expression +; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a +; previously set variable or directive (e.g. ${foo}) + +; Expressions in the INI file are limited to bitwise operators and parentheses: +; | bitwise OR +; ^ bitwise XOR +; & bitwise AND +; ~ bitwise NOT +; ! boolean NOT + +; Boolean flags can be turned on using the values 1, On, True or Yes. +; They can be turned off using the values 0, Off, False or No. + +; An empty string can be denoted by simply not writing anything after the equal +; sign, or by using the None keyword: + +; foo = ; sets foo to an empty string +; foo = None ; sets foo to an empty string +; foo = "None" ; sets foo to the string 'None' + +; If you use constants in your value, and these constants belong to a +; dynamically loaded extension (either a PHP extension or a Zend extension), +; you may only use these constants *after* the line that loads the extension. + +;;;;;;;;;;;;;;;;;;; +; About this file ; +;;;;;;;;;;;;;;;;;;; +; PHP comes packaged with two INI files. One that is recommended to be used +; in production environments and one that is recommended to be used in +; development environments. + +; php.ini-production contains settings which hold security, performance and +; best practices at its core. But please be aware, these settings may break +; compatibility with older or less security-conscious applications. We +; recommending using the production ini in production and testing environments. + +; php.ini-development is very similar to its production variant, except it is +; much more verbose when it comes to errors. We recommend using the +; development version only in development environments, as errors shown to +; application users can inadvertently leak otherwise secure information. + +; This is the php.ini-development INI file. + +;;;;;;;;;;;;;;;;;;; +; Quick Reference ; +;;;;;;;;;;;;;;;;;;; + +; The following are all the settings which are different in either the production +; or development versions of the INIs with respect to PHP's default behavior. +; Please see the actual settings later in the document for more details as to why +; we recommend these changes in PHP's behavior. + +; display_errors +; Default Value: On +; Development Value: On +; Production Value: Off + +; display_startup_errors +; Default Value: On +; Development Value: On +; Production Value: Off + +; error_reporting +; Default Value: E_ALL +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT + +; log_errors +; Default Value: Off +; Development Value: On +; Production Value: On + +; max_input_time +; Default Value: -1 (Unlimited) +; Development Value: 60 (60 seconds) +; Production Value: 60 (60 seconds) + +; output_buffering +; Default Value: Off +; Development Value: 4096 +; Production Value: 4096 + +; register_argc_argv +; Default Value: On +; Development Value: Off +; Production Value: Off + +; request_order +; Default Value: None +; Development Value: "GP" +; Production Value: "GP" + +; session.gc_divisor +; Default Value: 100 +; Development Value: 1000 +; Production Value: 1000 + +; session.sid_bits_per_character +; Default Value: 4 +; Development Value: 5 +; Production Value: 5 + +; session.sid_length +; Default Value: 32 +; Development Value: 26 +; Production Value: 26 + +; short_open_tag +; Default Value: On +; Development Value: Off +; Production Value: Off + +; variables_order +; Default Value: "EGPCS" +; Development Value: "GPCS" +; Production Value: "GPCS" + +; zend.assertions +; Default Value: 1 +; Development Value: 1 +; Production Value: -1 + +; zend.exception_ignore_args +; Default Value: Off +; Development Value: Off +; Production Value: On + +; zend.exception_string_param_max_len +; Default Value: 15 +; Development Value: 15 +; Production Value: 0 + +;;;;;;;;;;;;;;;;;;;; +; php.ini Options ; +;;;;;;;;;;;;;;;;;;;; +; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" +;user_ini.filename = ".user.ini" + +; To disable this feature set this option to an empty value +;user_ini.filename = + +; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) +;user_ini.cache_ttl = 300 + +;;;;;;;;;;;;;;;;;;;; +; Language Options ; +;;;;;;;;;;;;;;;;;;;; + +; Enable the PHP scripting language engine under Apache. +; https://php.net/engine +engine = On + +; This directive determines whether or not PHP will recognize code between +; tags as PHP source which should be processed as such. It is +; generally recommended that should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the would work. +; https://php.net/syntax-highlighting +;highlight.string = #DD0000 +;highlight.comment = #FF9900 +;highlight.keyword = #007700 +;highlight.default = #0000BB +;highlight.html = #000000 + +; If enabled, the request will be allowed to complete even if the user aborts +; the request. Consider enabling it if executing long requests, which may end up +; being interrupted by the user or a browser timing out. PHP's default behavior +; is to disable this feature. +; https://php.net/ignore-user-abort +;ignore_user_abort = On + +; Determines the size of the realpath cache to be used by PHP. This value should +; be increased on systems where PHP opens many files to reflect the quantity of +; the file operations performed. +; Note: if open_basedir is set, the cache is disabled +; https://php.net/realpath-cache-size +;realpath_cache_size = 4096k + +; Duration of time, in seconds for which to cache realpath information for a given +; file or directory. For systems with rarely changing files, consider increasing this +; value. +; https://php.net/realpath-cache-ttl +;realpath_cache_ttl = 120 + +; Enables or disables the circular reference collector. +; https://php.net/zend.enable-gc +zend.enable_gc = On + +; If enabled, scripts may be written in encodings that are incompatible with +; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such +; encodings. To use this feature, mbstring extension must be enabled. +;zend.multibyte = Off + +; Allows to set the default encoding for the scripts. This value will be used +; unless "declare(encoding=...)" directive appears at the top of the script. +; Only affects if zend.multibyte is set. +;zend.script_encoding = + +; Allows to include or exclude arguments from stack traces generated for exceptions. +; In production, it is recommended to turn this setting on to prohibit the output +; of sensitive information in stack traces +; Default Value: Off +; Development Value: Off +; Production Value: On +zend.exception_ignore_args = Off + +; Allows setting the maximum string length in an argument of a stringified stack trace +; to a value between 0 and 1000000. +; This has no effect when zend.exception_ignore_args is enabled. +; Default Value: 15 +; Development Value: 15 +; Production Value: 0 +zend.exception_string_param_max_len = 15 + +;;;;;;;;;;;;;;;;; +; Miscellaneous ; +;;;;;;;;;;;;;;;;; + +; Decides whether PHP may expose the fact that it is installed on the server +; (e.g. by adding its signature to the Web server header). It is no security +; threat in any way, but it makes it possible to determine whether you use PHP +; on your server or not. +; https://php.net/expose-php +expose_php = On + +;;;;;;;;;;;;;;;;;;; +; Resource Limits ; +;;;;;;;;;;;;;;;;;;; + +; Maximum execution time of each script, in seconds +; https://php.net/max-execution-time +; Note: This directive is hardcoded to 0 for the CLI SAPI +max_execution_time = 30 + +; Maximum amount of time each script may spend parsing request data. It's a good +; idea to limit this time on productions servers in order to eliminate unexpectedly +; long running scripts. +; Note: This directive is hardcoded to -1 for the CLI SAPI +; Default Value: -1 (Unlimited) +; Development Value: 60 (60 seconds) +; Production Value: 60 (60 seconds) +; https://php.net/max-input-time +max_input_time = 60 + +; Maximum input variable nesting level +; https://php.net/max-input-nesting-level +;max_input_nesting_level = 64 + +; How many GET/POST/COOKIE input variables may be accepted +;max_input_vars = 1000 + +; How many multipart body parts (combined input variable and file uploads) may +; be accepted. +; Default Value: -1 (Sum of max_input_vars and max_file_uploads) +;max_multipart_body_parts = 1500 + +; Maximum amount of memory a script may consume +; https://php.net/memory-limit +memory_limit = 1024M + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Error handling and logging ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; This directive informs PHP of which errors, warnings and notices you would like +; it to take action for. The recommended way of setting values for this +; directive is through the use of the error level constants and bitwise +; operators. The error level constants are below here for convenience as well as +; some common settings and their meanings. +; By default, PHP is set to take action on all errors, notices and warnings EXCEPT +; those related to E_NOTICE and E_STRICT, which together cover best practices and +; recommended coding standards in PHP. For performance reasons, this is the +; recommend error reporting setting. Your production server shouldn't be wasting +; resources complaining about best practices and coding standards. That's what +; development servers and development settings are for. +; Note: The php.ini-development file has this setting as E_ALL. This +; means it pretty much reports everything which is exactly what you want during +; development and early testing. +; +; Error Level Constants: +; E_ALL - All errors and warnings +; E_ERROR - fatal run-time errors +; E_RECOVERABLE_ERROR - almost fatal run-time errors +; E_WARNING - run-time warnings (non-fatal errors) +; E_PARSE - compile-time parse errors +; E_NOTICE - run-time notices (these are warnings which often result +; from a bug in your code, but it's possible that it was +; intentional (e.g., using an uninitialized variable and +; relying on the fact it is automatically initialized to an +; empty string) +; E_STRICT - run-time notices, enable to have PHP suggest changes +; to your code which will ensure the best interoperability +; and forward compatibility of your code +; E_CORE_ERROR - fatal errors that occur during PHP's initial startup +; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's +; initial startup +; E_COMPILE_ERROR - fatal compile-time errors +; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) +; E_USER_ERROR - user-generated error message +; E_USER_WARNING - user-generated warning message +; E_USER_NOTICE - user-generated notice message +; E_DEPRECATED - warn about code that will not work in future versions +; of PHP +; E_USER_DEPRECATED - user-generated deprecation warnings +; +; Common Values: +; E_ALL (Show all errors, warnings and notices including coding standards.) +; E_ALL & ~E_NOTICE (Show all errors, except for notices) +; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) +; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) +; Default Value: E_ALL +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT +; https://php.net/error-reporting +error_reporting = E_ALL + +; This directive controls whether or not and where PHP will output errors, +; notices and warnings too. Error output is very useful during development, but +; it could be very dangerous in production environments. Depending on the code +; which is triggering the error, sensitive information could potentially leak +; out of your application such as database usernames and passwords or worse. +; For production environments, we recommend logging errors rather than +; sending them to STDOUT. +; Possible Values: +; Off = Do not display any errors +; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) +; On or stdout = Display errors to STDOUT +; Default Value: On +; Development Value: On +; Production Value: Off +; https://php.net/display-errors +display_errors = On + +; The display of errors which occur during PHP's startup sequence are handled +; separately from display_errors. We strongly recommend you set this to 'off' +; for production servers to avoid leaking configuration details. +; Default Value: On +; Development Value: On +; Production Value: Off +; https://php.net/display-startup-errors +display_startup_errors = On + +; Besides displaying errors, PHP can also log errors to locations such as a +; server-specific log, STDERR, or a location specified by the error_log +; directive found below. While errors should not be displayed on productions +; servers they should still be monitored and logging is a great way to do that. +; Default Value: Off +; Development Value: On +; Production Value: On +; https://php.net/log-errors +log_errors = On + +; Do not log repeated messages. Repeated errors must occur in same file on same +; line unless ignore_repeated_source is set true. +; https://php.net/ignore-repeated-errors +ignore_repeated_errors = Off + +; Ignore source of message when ignoring repeated messages. When this setting +; is On you will not log errors with repeated messages from different files or +; source lines. +; https://php.net/ignore-repeated-source +ignore_repeated_source = Off + +; If this parameter is set to Off, then memory leaks will not be shown (on +; stdout or in the log). This is only effective in a debug compile, and if +; error reporting includes E_WARNING in the allowed list +; https://php.net/report-memleaks +report_memleaks = On + +; This setting is off by default. +;report_zend_debug = 0 + +; Turn off normal error reporting and emit XML-RPC error XML +; https://php.net/xmlrpc-errors +;xmlrpc_errors = 0 + +; An XML-RPC faultCode +;xmlrpc_error_number = 0 + +; When PHP displays or logs an error, it has the capability of formatting the +; error message as HTML for easier reading. This directive controls whether +; the error message is formatted as HTML or not. +; Note: This directive is hardcoded to Off for the CLI SAPI +; https://php.net/html-errors +;html_errors = On + +; If html_errors is set to On *and* docref_root is not empty, then PHP +; produces clickable error messages that direct to a page describing the error +; or function causing the error in detail. +; You can download a copy of the PHP manual from https://php.net/docs +; and change docref_root to the base URL of your local copy including the +; leading '/'. You must also specify the file extension being used including +; the dot. PHP's default behavior is to leave these settings empty, in which +; case no links to documentation are generated. +; Note: Never use this feature for production boxes. +; https://php.net/docref-root +; Examples +;docref_root = "/phpmanual/" + +; https://php.net/docref-ext +;docref_ext = .html + +; String to output before an error message. PHP's default behavior is to leave +; this setting blank. +; https://php.net/error-prepend-string +; Example: +;error_prepend_string = "" + +; String to output after an error message. PHP's default behavior is to leave +; this setting blank. +; https://php.net/error-append-string +; Example: +;error_append_string = "" + +; Log errors to specified file. PHP's default behavior is to leave this value +; empty. +; https://php.net/error-log +; Example: +;error_log = php_errors.log +; Log errors to syslog (Event Log on Windows). +;error_log = syslog + +; The syslog ident is a string which is prepended to every message logged +; to syslog. Only used when error_log is set to syslog. +;syslog.ident = php + +; The syslog facility is used to specify what type of program is logging +; the message. Only used when error_log is set to syslog. +;syslog.facility = user + +; Set this to disable filtering control characters (the default). +; Some loggers only accept NVT-ASCII, others accept anything that's not +; control characters. If your logger accepts everything, then no filtering +; is needed at all. +; Allowed values are: +; ascii (all printable ASCII characters and NL) +; no-ctrl (all characters except control characters) +; all (all characters) +; raw (like "all", but messages are not split at newlines) +; https://php.net/syslog.filter +;syslog.filter = ascii + +;windows.show_crt_warning +; Default value: 0 +; Development value: 0 +; Production value: 0 + +;;;;;;;;;;;;;;;;; +; Data Handling ; +;;;;;;;;;;;;;;;;; + +; The separator used in PHP generated URLs to separate arguments. +; PHP's default setting is "&". +; https://php.net/arg-separator.output +; Example: +;arg_separator.output = "&" + +; List of separator(s) used by PHP to parse input URLs into variables. +; PHP's default setting is "&". +; NOTE: Every character in this directive is considered as separator! +; https://php.net/arg-separator.input +; Example: +;arg_separator.input = ";&" + +; This directive determines which super global arrays are registered when PHP +; starts up. G,P,C,E & S are abbreviations for the following respective super +; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty +; paid for the registration of these arrays and because ENV is not as commonly +; used as the others, ENV is not recommended on productions servers. You +; can still get access to the environment variables through getenv() should you +; need to. +; Default Value: "EGPCS" +; Development Value: "GPCS" +; Production Value: "GPCS"; +; https://php.net/variables-order +variables_order = "GPCS" + +; This directive determines which super global data (G,P & C) should be +; registered into the super global array REQUEST. If so, it also determines +; the order in which that data is registered. The values for this directive +; are specified in the same manner as the variables_order directive, +; EXCEPT one. Leaving this value empty will cause PHP to use the value set +; in the variables_order directive. It does not mean it will leave the super +; globals array REQUEST empty. +; Default Value: None +; Development Value: "GP" +; Production Value: "GP" +; https://php.net/request-order +request_order = "GP" + +; This directive determines whether PHP registers $argv & $argc each time it +; runs. $argv contains an array of all the arguments passed to PHP when a script +; is invoked. $argc contains an integer representing the number of arguments +; that were passed when the script was invoked. These arrays are extremely +; useful when running scripts from the command line. When this directive is +; enabled, registering these variables consumes CPU cycles and memory each time +; a script is executed. For performance reasons, this feature should be disabled +; on production servers. +; Note: This directive is hardcoded to On for the CLI SAPI +; Default Value: On +; Development Value: Off +; Production Value: Off +; https://php.net/register-argc-argv +register_argc_argv = Off + +; When enabled, the ENV, REQUEST and SERVER variables are created when they're +; first used (Just In Time) instead of when the script starts. If these +; variables are not used within a script, having this directive on will result +; in a performance gain. The PHP directive register_argc_argv must be disabled +; for this directive to have any effect. +; https://php.net/auto-globals-jit +auto_globals_jit = On + +; Whether PHP will read the POST data. +; This option is enabled by default. +; Most likely, you won't want to disable this option globally. It causes $_POST +; and $_FILES to always be empty; the only way you will be able to read the +; POST data will be through the php://input stream wrapper. This can be useful +; to proxy requests or to process the POST data in a memory efficient fashion. +; https://php.net/enable-post-data-reading +;enable_post_data_reading = Off + +; Maximum size of POST data that PHP will accept. +; Its value may be 0 to disable the limit. It is ignored if POST data reading +; is disabled through enable_post_data_reading. +; https://php.net/post-max-size +post_max_size = 8M + +; Automatically add files before PHP document. +; https://php.net/auto-prepend-file +auto_prepend_file = + +; Automatically add files after PHP document. +; https://php.net/auto-append-file +auto_append_file = + +; By default, PHP will output a media type using the Content-Type header. To +; disable this, simply set it to be empty. +; +; PHP's built-in default media type is set to text/html. +; https://php.net/default-mimetype +default_mimetype = "text/html" + +; PHP's default character set is set to UTF-8. +; https://php.net/default-charset +default_charset = "UTF-8" + +; PHP internal character encoding is set to empty. +; If empty, default_charset is used. +; https://php.net/internal-encoding +;internal_encoding = + +; PHP input character encoding is set to empty. +; If empty, default_charset is used. +; https://php.net/input-encoding +;input_encoding = + +; PHP output character encoding is set to empty. +; If empty, default_charset is used. +; See also output_buffer. +; https://php.net/output-encoding +;output_encoding = + +;;;;;;;;;;;;;;;;;;;;;;;;; +; Paths and Directories ; +;;;;;;;;;;;;;;;;;;;;;;;;; + +; UNIX: "/path1:/path2" +;include_path = ".:/php/includes" +; +; Windows: "\path1;\path2" +;include_path = ".;c:\php\includes" +; +; PHP's default setting for include_path is ".;/path/to/php/pear" +; https://php.net/include-path + +; The root of the PHP pages, used only if nonempty. +; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root +; if you are running php as a CGI under any web server (other than IIS) +; see documentation for security issues. The alternate is to use the +; cgi.force_redirect configuration below +; https://php.net/doc-root +doc_root = + +; The directory under which PHP opens the script using /~username used only +; if nonempty. +; https://php.net/user-dir +user_dir = + +; Directory in which the loadable extensions (modules) reside. +; https://php.net/extension-dir +;extension_dir = "./" +; On windows: +;extension_dir = "ext" + +; Directory where the temporary files should be placed. +; Defaults to the system default (see sys_get_temp_dir) +;sys_temp_dir = "/tmp" + +; Whether or not to enable the dl() function. The dl() function does NOT work +; properly in multithreaded servers, such as IIS or Zeus, and is automatically +; disabled on them. +; https://php.net/enable-dl +enable_dl = Off + +; cgi.force_redirect is necessary to provide security running PHP as a CGI under +; most web servers. Left undefined, PHP turns this on by default. You can +; turn it off here AT YOUR OWN RISK +; **You CAN safely turn this off for IIS, in fact, you MUST.** +; https://php.net/cgi.force-redirect +;cgi.force_redirect = 1 + +; if cgi.nph is enabled it will force cgi to always sent Status: 200 with +; every request. PHP's default behavior is to disable this feature. +;cgi.nph = 1 + +; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape +; (iPlanet) web servers, you MAY need to set an environment variable name that PHP +; will look for to know it is OK to continue execution. Setting this variable MAY +; cause security issues, KNOW WHAT YOU ARE DOING FIRST. +; https://php.net/cgi.redirect-status-env +;cgi.redirect_status_env = + +; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's +; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok +; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting +; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting +; of zero causes PHP to behave as before. Default is 1. You should fix your scripts +; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. +; https://php.net/cgi.fix-pathinfo +;cgi.fix_pathinfo=1 + +; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside +; of the web tree and people will not be able to circumvent .htaccess security. +;cgi.discard_path=1 + +; FastCGI under IIS supports the ability to impersonate +; security tokens of the calling client. This allows IIS to define the +; security context that the request runs under. mod_fastcgi under Apache +; does not currently support this feature (03/17/2002) +; Set to 1 if running under IIS. Default is zero. +; https://php.net/fastcgi.impersonate +;fastcgi.impersonate = 1 + +; Disable logging through FastCGI connection. PHP's default behavior is to enable +; this feature. +;fastcgi.logging = 0 + +; cgi.rfc2616_headers configuration option tells PHP what type of headers to +; use when sending HTTP response code. If set to 0, PHP sends Status: header that +; is supported by Apache. When this option is set to 1, PHP will send +; RFC2616 compliant header. +; Default is zero. +; https://php.net/cgi.rfc2616-headers +;cgi.rfc2616_headers = 0 + +; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! +; (shebang) at the top of the running script. This line might be needed if the +; script support running both as stand-alone script and via PHP CGI<. PHP in CGI +; mode skips this line and ignores its content if this directive is turned on. +; https://php.net/cgi.check-shebang-line +;cgi.check_shebang_line=1 + +;;;;;;;;;;;;;;;; +; File Uploads ; +;;;;;;;;;;;;;;;; + +; Whether to allow HTTP file uploads. +; https://php.net/file-uploads +file_uploads = On + +; Temporary directory for HTTP uploaded files (will use system default if not +; specified). +; https://php.net/upload-tmp-dir +;upload_tmp_dir = + +; Maximum allowed size for uploaded files. +; https://php.net/upload-max-filesize +upload_max_filesize = 2M + +; Maximum number of files that can be uploaded via a single request +max_file_uploads = 20 + +;;;;;;;;;;;;;;;;;; +; Fopen wrappers ; +;;;;;;;;;;;;;;;;;; + +; Whether to allow the treatment of URLs (like http:// or ftp://) as files. +; https://php.net/allow-url-fopen +allow_url_fopen = On + +; Whether to allow include/require to open URLs (like https:// or ftp://) as files. +; https://php.net/allow-url-include +allow_url_include = Off + +; Define the anonymous ftp password (your email address). PHP's default setting +; for this is empty. +; https://php.net/from +;from="john@doe.com" + +; Define the User-Agent string. PHP's default setting for this is empty. +; https://php.net/user-agent +;user_agent="PHP" + +; Default timeout for socket based streams (seconds) +; https://php.net/default-socket-timeout +default_socket_timeout = 60 + +; If your scripts have to deal with files from Macintosh systems, +; or you are running on a Mac and need to deal with files from +; unix or win32 systems, setting this flag will cause PHP to +; automatically detect the EOL character in those files so that +; fgets() and file() will work regardless of the source of the file. +; https://php.net/auto-detect-line-endings +;auto_detect_line_endings = Off + +;;;;;;;;;;;;;;;;;;;;;; +; Dynamic Extensions ; +;;;;;;;;;;;;;;;;;;;;;; + +; If you wish to have an extension loaded automatically, use the following +; syntax: +; +; extension=modulename +; +; For example: +; +; extension=mysqli +; +; When the extension library to load is not located in the default extension +; directory, You may specify an absolute path to the library file: +; +; extension=/path/to/extension/mysqli.so +; +; Note : The syntax used in previous PHP versions ('extension=.so' and +; 'extension='php_.dll') is supported for legacy reasons and may be +; deprecated in a future PHP major version. So, when it is possible, please +; move to the new ('extension=) syntax. +; +; Notes for Windows environments : +; +; - Many DLL files are located in the ext/ +; extension folders as well as the separate PECL DLL download. +; Be sure to appropriately set the extension_dir directive. +; +;extension=bz2 + +; The ldap extension must be before curl if OpenSSL 1.0.2 and OpenLDAP is used +; otherwise it results in segfault when unloading after using SASL. +; See https://github.com/php/php-src/issues/8620 for more info. +;extension=ldap + +;extension=curl +;extension=ffi +;extension=ftp +;extension=fileinfo +;extension=gd +;extension=gettext +;extension=gmp +;extension=intl +;extension=imap +;extension=mbstring +;extension=exif ; Must be after mbstring as it depends on it +;extension=mysqli +;extension=oci8_12c ; Use with Oracle Database 12c Instant Client +;extension=oci8_19 ; Use with Oracle Database 19 Instant Client +;extension=odbc +;extension=openssl +;extension=pdo_firebird +;extension=pdo_mysql +;extension=pdo_oci +;extension=pdo_odbc +;extension=pdo_pgsql +;extension=pdo_sqlite +;extension=pgsql +;extension=shmop + +; The MIBS data available in the PHP distribution must be installed. +; See https://www.php.net/manual/en/snmp.installation.php +;extension=snmp + +;extension=soap +;extension=sockets +;extension=sodium +;extension=sqlite3 +;extension=tidy +;extension=xsl +;extension=zip + +;zend_extension=opcache + +;;;;;;;;;;;;;;;;;;; +; Module Settings ; +;;;;;;;;;;;;;;;;;;; + +[CLI Server] +; Whether the CLI web server uses ANSI color coding in its terminal output. +cli_server.color = On + +[Date] +; Defines the default timezone used by the date functions +; https://php.net/date.timezone +;date.timezone = + +; https://php.net/date.default-latitude +;date.default_latitude = 31.7667 + +; https://php.net/date.default-longitude +;date.default_longitude = 35.2333 + +; https://php.net/date.sunrise-zenith +;date.sunrise_zenith = 90.833333 + +; https://php.net/date.sunset-zenith +;date.sunset_zenith = 90.833333 + +[filter] +; https://php.net/filter.default +;filter.default = unsafe_raw + +; https://php.net/filter.default-flags +;filter.default_flags = + +[iconv] +; Use of this INI entry is deprecated, use global input_encoding instead. +; If empty, default_charset or input_encoding or iconv.input_encoding is used. +; The precedence is: default_charset < input_encoding < iconv.input_encoding +;iconv.input_encoding = + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;iconv.internal_encoding = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; If empty, default_charset or output_encoding or iconv.output_encoding is used. +; The precedence is: default_charset < output_encoding < iconv.output_encoding +; To use an output encoding conversion, iconv's output handler must be set +; otherwise output encoding conversion cannot be performed. +;iconv.output_encoding = + +[imap] +; rsh/ssh logins are disabled by default. Use this INI entry if you want to +; enable them. Note that the IMAP library does not filter mailbox names before +; passing them to rsh/ssh command, thus passing untrusted data to this function +; with rsh/ssh enabled is insecure. +;imap.enable_insecure_rsh=0 + +[intl] +;intl.default_locale = +; This directive allows you to produce PHP errors when some error +; happens within intl functions. The value is the level of the error produced. +; Default is 0, which does not produce any errors. +;intl.error_level = E_WARNING +;intl.use_exceptions = 0 + +[sqlite3] +; Directory pointing to SQLite3 extensions +; https://php.net/sqlite3.extension-dir +;sqlite3.extension_dir = + +; SQLite defensive mode flag (only available from SQLite 3.26+) +; When the defensive flag is enabled, language features that allow ordinary +; SQL to deliberately corrupt the database file are disabled. This forbids +; writing directly to the schema, shadow tables (eg. FTS data tables), or +; the sqlite_dbpage virtual table. +; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html +; (for older SQLite versions, this flag has no use) +;sqlite3.defensive = 1 + +[Pcre] +; PCRE library backtracking limit. +; https://php.net/pcre.backtrack-limit +;pcre.backtrack_limit=100000 + +; PCRE library recursion limit. +; Please note that if you set this value to a high number you may consume all +; the available process stack and eventually crash PHP (due to reaching the +; stack size limit imposed by the Operating System). +; https://php.net/pcre.recursion-limit +;pcre.recursion_limit=100000 + +; Enables or disables JIT compilation of patterns. This requires the PCRE +; library to be compiled with JIT support. +;pcre.jit=1 + +[Pdo] +; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" +; https://php.net/pdo-odbc.connection-pooling +;pdo_odbc.connection_pooling=strict + +[Pdo_mysql] +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +pdo_mysql.default_socket= + +[Phar] +; https://php.net/phar.readonly +;phar.readonly = On + +; https://php.net/phar.require-hash +;phar.require_hash = On + +;phar.cache_list = + +[mail function] +; For Win32 only. +; https://php.net/smtp +SMTP = localhost +; https://php.net/smtp-port +smtp_port = 25 + +; For Win32 only. +; https://php.net/sendmail-from +;sendmail_from = me@example.com + +; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). +; https://php.net/sendmail-path +;sendmail_path = + +; Force the addition of the specified parameters to be passed as extra parameters +; to the sendmail binary. These parameters will always replace the value of +; the 5th parameter to mail(). +;mail.force_extra_parameters = + +; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename +mail.add_x_header = Off + +; Use mixed LF and CRLF line separators to keep compatibility with some +; RFC 2822 non conformant MTA. +mail.mixed_lf_and_crlf = Off + +; The path to a log file that will log all mail() calls. Log entries include +; the full path of the script, line number, To address and headers. +;mail.log = +; Log mail to syslog (Event Log on Windows). +;mail.log = syslog + +[ODBC] +; https://php.net/odbc.default-db +;odbc.default_db = Not yet implemented + +; https://php.net/odbc.default-user +;odbc.default_user = Not yet implemented + +; https://php.net/odbc.default-pw +;odbc.default_pw = Not yet implemented + +; Controls the ODBC cursor model. +; Default: SQL_CURSOR_STATIC (default). +;odbc.default_cursortype + +; Allow or prevent persistent links. +; https://php.net/odbc.allow-persistent +odbc.allow_persistent = On + +; Check that a connection is still valid before reuse. +; https://php.net/odbc.check-persistent +odbc.check_persistent = On + +; Maximum number of persistent links. -1 means no limit. +; https://php.net/odbc.max-persistent +odbc.max_persistent = -1 + +; Maximum number of links (persistent + non-persistent). -1 means no limit. +; https://php.net/odbc.max-links +odbc.max_links = -1 + +; Handling of LONG fields. Returns number of bytes to variables. 0 means +; passthru. +; https://php.net/odbc.defaultlrl +odbc.defaultlrl = 4096 + +; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. +; See the documentation on odbc_binmode and odbc_longreadlen for an explanation +; of odbc.defaultlrl and odbc.defaultbinmode +; https://php.net/odbc.defaultbinmode +odbc.defaultbinmode = 1 + +[MySQLi] + +; Maximum number of persistent links. -1 means no limit. +; https://php.net/mysqli.max-persistent +mysqli.max_persistent = -1 + +; Allow accessing, from PHP's perspective, local files with LOAD DATA statements +; https://php.net/mysqli.allow_local_infile +;mysqli.allow_local_infile = On + +; It allows the user to specify a folder where files that can be sent via LOAD DATA +; LOCAL can exist. It is ignored if mysqli.allow_local_infile is enabled. +;mysqli.local_infile_directory = + +; Allow or prevent persistent links. +; https://php.net/mysqli.allow-persistent +mysqli.allow_persistent = On + +; Maximum number of links. -1 means no limit. +; https://php.net/mysqli.max-links +mysqli.max_links = -1 + +; Default port number for mysqli_connect(). If unset, mysqli_connect() will use +; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the +; compile-time value defined MYSQL_PORT (in that order). Win32 will only look +; at MYSQL_PORT. +; https://php.net/mysqli.default-port +mysqli.default_port = 3306 + +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +; https://php.net/mysqli.default-socket +mysqli.default_socket = + +; Default host for mysqli_connect() (doesn't apply in safe mode). +; https://php.net/mysqli.default-host +mysqli.default_host = + +; Default user for mysqli_connect() (doesn't apply in safe mode). +; https://php.net/mysqli.default-user +mysqli.default_user = + +; Default password for mysqli_connect() (doesn't apply in safe mode). +; Note that this is generally a *bad* idea to store passwords in this file. +; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") +; and reveal this password! And of course, any users with read access to this +; file will be able to reveal the password as well. +; https://php.net/mysqli.default-pw +mysqli.default_pw = + +; If this option is enabled, closing a persistent connection will rollback +; any pending transactions of this connection, before it is put back +; into the persistent connection pool. +;mysqli.rollback_on_cached_plink = Off + +[mysqlnd] +; Enable / Disable collection of general statistics by mysqlnd which can be +; used to tune and monitor MySQL operations. +mysqlnd.collect_statistics = On + +; Enable / Disable collection of memory usage statistics by mysqlnd which can be +; used to tune and monitor MySQL operations. +mysqlnd.collect_memory_statistics = On + +; Records communication from all extensions using mysqlnd to the specified log +; file. +; https://php.net/mysqlnd.debug +;mysqlnd.debug = + +; Defines which queries will be logged. +;mysqlnd.log_mask = 0 + +; Default size of the mysqlnd memory pool, which is used by result sets. +;mysqlnd.mempool_default_size = 16000 + +; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. +;mysqlnd.net_cmd_buffer_size = 2048 + +; Size of a pre-allocated buffer used for reading data sent by the server in +; bytes. +;mysqlnd.net_read_buffer_size = 32768 + +; Timeout for network requests in seconds. +;mysqlnd.net_read_timeout = 31536000 + +; SHA-256 Authentication Plugin related. File with the MySQL server public RSA +; key. +;mysqlnd.sha256_server_public_key = + +[OCI8] + +; Connection: Enables privileged connections using external +; credentials (OCI_SYSOPER, OCI_SYSDBA) +; https://php.net/oci8.privileged-connect +;oci8.privileged_connect = Off + +; Connection: The maximum number of persistent OCI8 connections per +; process. Using -1 means no limit. +; https://php.net/oci8.max-persistent +;oci8.max_persistent = -1 + +; Connection: The maximum number of seconds a process is allowed to +; maintain an idle persistent connection. Using -1 means idle +; persistent connections will be maintained forever. +; https://php.net/oci8.persistent-timeout +;oci8.persistent_timeout = -1 + +; Connection: The number of seconds that must pass before issuing a +; ping during oci_pconnect() to check the connection validity. When +; set to 0, each oci_pconnect() will cause a ping. Using -1 disables +; pings completely. +; https://php.net/oci8.ping-interval +;oci8.ping_interval = 60 + +; Connection: Set this to a user chosen connection class to be used +; for all pooled server requests with Oracle Database Resident +; Connection Pooling (DRCP). To use DRCP, this value should be set to +; the same string for all web servers running the same application, +; the database pool must be configured, and the connection string must +; specify to use a pooled server. +;oci8.connection_class = + +; High Availability: Using On lets PHP receive Fast Application +; Notification (FAN) events generated when a database node fails. The +; database must also be configured to post FAN events. +;oci8.events = Off + +; Tuning: This option enables statement caching, and specifies how +; many statements to cache. Using 0 disables statement caching. +; https://php.net/oci8.statement-cache-size +;oci8.statement_cache_size = 20 + +; Tuning: Enables row prefetching and sets the default number of +; rows that will be fetched automatically after statement execution. +; https://php.net/oci8.default-prefetch +;oci8.default_prefetch = 100 + +; Tuning: Sets the amount of LOB data that is internally returned from +; Oracle Database when an Oracle LOB locator is initially retrieved as +; part of a query. Setting this can improve performance by reducing +; round-trips. +; https://php.net/oci8.prefetch-lob-size +; oci8.prefetch_lob_size = 0 + +; Compatibility. Using On means oci_close() will not close +; oci_connect() and oci_new_connect() connections. +; https://php.net/oci8.old-oci-close-semantics +;oci8.old_oci_close_semantics = Off + +[PostgreSQL] +; Allow or prevent persistent links. +; https://php.net/pgsql.allow-persistent +pgsql.allow_persistent = On + +; Detect broken persistent links always with pg_pconnect(). +; Auto reset feature requires a little overheads. +; https://php.net/pgsql.auto-reset-persistent +pgsql.auto_reset_persistent = Off + +; Maximum number of persistent links. -1 means no limit. +; https://php.net/pgsql.max-persistent +pgsql.max_persistent = -1 + +; Maximum number of links (persistent+non persistent). -1 means no limit. +; https://php.net/pgsql.max-links +pgsql.max_links = -1 + +; Ignore PostgreSQL backends Notice message or not. +; Notice message logging require a little overheads. +; https://php.net/pgsql.ignore-notice +pgsql.ignore_notice = 0 + +; Log PostgreSQL backends Notice message or not. +; Unless pgsql.ignore_notice=0, module cannot log notice message. +; https://php.net/pgsql.log-notice +pgsql.log_notice = 0 + +[bcmath] +; Number of decimal digits for all bcmath functions. +; https://php.net/bcmath.scale +bcmath.scale = 0 + +[browscap] +; https://php.net/browscap +;browscap = extra/browscap.ini + +[Session] +; Handler used to store/retrieve data. +; https://php.net/session.save-handler +session.save_handler = files + +; Argument passed to save_handler. In the case of files, this is the path +; where data files are stored. Note: Windows users have to change this +; variable in order to use PHP's session functions. +; +; The path can be defined as: +; +; session.save_path = "N;/path" +; +; where N is an integer. Instead of storing all the session files in +; /path, what this will do is use subdirectories N-levels deep, and +; store the session data in those directories. This is useful if +; your OS has problems with many files in one directory, and is +; a more efficient layout for servers that handle many sessions. +; +; NOTE 1: PHP will not create this directory structure automatically. +; You can use the script in the ext/session dir for that purpose. +; NOTE 2: See the section on garbage collection below if you choose to +; use subdirectories for session storage +; +; The file storage module creates files using mode 600 by default. +; You can change that by using +; +; session.save_path = "N;MODE;/path" +; +; where MODE is the octal representation of the mode. Note that this +; does not overwrite the process's umask. +; https://php.net/session.save-path +;session.save_path = "/tmp" + +; Whether to use strict session mode. +; Strict session mode does not accept an uninitialized session ID, and +; regenerates the session ID if the browser sends an uninitialized session ID. +; Strict mode protects applications from session fixation via a session adoption +; vulnerability. It is disabled by default for maximum compatibility, but +; enabling it is encouraged. +; https://wiki.php.net/rfc/strict_sessions +session.use_strict_mode = 0 + +; Whether to use cookies. +; https://php.net/session.use-cookies +session.use_cookies = 1 + +; https://php.net/session.cookie-secure +;session.cookie_secure = + +; This option forces PHP to fetch and use a cookie for storing and maintaining +; the session id. We encourage this operation as it's very helpful in combating +; session hijacking when not specifying and managing your own session id. It is +; not the be-all and end-all of session hijacking defense, but it's a good start. +; https://php.net/session.use-only-cookies +session.use_only_cookies = 1 + +; Name of the session (used as cookie name). +; https://php.net/session.name +session.name = PHPSESSID + +; Initialize session on request startup. +; https://php.net/session.auto-start +session.auto_start = 0 + +; Lifetime in seconds of cookie or, if 0, until browser is restarted. +; https://php.net/session.cookie-lifetime +session.cookie_lifetime = 0 + +; The path for which the cookie is valid. +; https://php.net/session.cookie-path +session.cookie_path = / + +; The domain for which the cookie is valid. +; https://php.net/session.cookie-domain +session.cookie_domain = + +; Whether or not to add the httpOnly flag to the cookie, which makes it +; inaccessible to browser scripting languages such as JavaScript. +; https://php.net/session.cookie-httponly +session.cookie_httponly = + +; Add SameSite attribute to cookie to help mitigate Cross-Site Request Forgery (CSRF/XSRF) +; Current valid values are "Strict", "Lax" or "None". When using "None", +; make sure to include the quotes, as `none` is interpreted like `false` in ini files. +; https://tools.ietf.org/html/draft-west-first-party-cookies-07 +session.cookie_samesite = + +; Handler used to serialize data. php is the standard serializer of PHP. +; https://php.net/session.serialize-handler +session.serialize_handler = php + +; Defines the probability that the 'garbage collection' process is started on every +; session initialization. The probability is calculated by using gc_probability/gc_divisor, +; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; https://php.net/session.gc-probability +session.gc_probability = 1 + +; Defines the probability that the 'garbage collection' process is started on every +; session initialization. The probability is calculated by using gc_probability/gc_divisor, +; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. +; For high volume production servers, using a value of 1000 is a more efficient approach. +; Default Value: 100 +; Development Value: 1000 +; Production Value: 1000 +; https://php.net/session.gc-divisor +session.gc_divisor = 1000 + +; After this number of seconds, stored data will be seen as 'garbage' and +; cleaned up by the garbage collection process. +; https://php.net/session.gc-maxlifetime +session.gc_maxlifetime = 1440 + +; NOTE: If you are using the subdirectory option for storing session files +; (see session.save_path above), then garbage collection does *not* +; happen automatically. You will need to do your own garbage +; collection through a shell script, cron entry, or some other method. +; For example, the following script is the equivalent of setting +; session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): +; find /path/to/sessions -cmin +24 -type f | xargs rm + +; Check HTTP Referer to invalidate externally stored URLs containing ids. +; HTTP_REFERER has to contain this substring for the session to be +; considered as valid. +; https://php.net/session.referer-check +session.referer_check = + +; Set to {nocache,private,public,} to determine HTTP caching aspects +; or leave this empty to avoid sending anti-caching headers. +; https://php.net/session.cache-limiter +session.cache_limiter = nocache + +; Document expires after n minutes. +; https://php.net/session.cache-expire +session.cache_expire = 180 + +; trans sid support is disabled by default. +; Use of trans sid may risk your users' security. +; Use this option with caution. +; - User may send URL contains active session ID +; to other person via. email/irc/etc. +; - URL that contains active session ID may be stored +; in publicly accessible computer. +; - User may access your site with the same session ID +; always using URL stored in browser's history or bookmarks. +; https://php.net/session.use-trans-sid +session.use_trans_sid = 0 + +; Set session ID character length. This value could be between 22 to 256. +; Shorter length than default is supported only for compatibility reason. +; Users should use 32 or more chars. +; https://php.net/session.sid-length +; Default Value: 32 +; Development Value: 26 +; Production Value: 26 +session.sid_length = 26 + +; The URL rewriter will look for URLs in a defined set of HTML tags. +;
is special; if you include them here, the rewriter will +; add a hidden field with the info which is otherwise appended +; to URLs. tag's action attribute URL will not be modified +; unless it is specified. +; Note that all valid entries require a "=", even if no value follows. +; Default Value: "a=href,area=href,frame=src,form=" +; Development Value: "a=href,area=href,frame=src,form=" +; Production Value: "a=href,area=href,frame=src,form=" +; https://php.net/url-rewriter.tags +session.trans_sid_tags = "a=href,area=href,frame=src,form=" + +; URL rewriter does not rewrite absolute URLs by default. +; To enable rewrites for absolute paths, target hosts must be specified +; at RUNTIME. i.e. use ini_set() +; tags is special. PHP will check action attribute's URL regardless +; of session.trans_sid_tags setting. +; If no host is defined, HTTP_HOST will be used for allowed host. +; Example value: php.net,www.php.net,wiki.php.net +; Use "," for multiple hosts. No spaces are allowed. +; Default Value: "" +; Development Value: "" +; Production Value: "" +;session.trans_sid_hosts="" + +; Define how many bits are stored in each character when converting +; the binary hash data to something readable. +; Possible values: +; 4 (4 bits: 0-9, a-f) +; 5 (5 bits: 0-9, a-v) +; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") +; Default Value: 4 +; Development Value: 5 +; Production Value: 5 +; https://php.net/session.hash-bits-per-character +session.sid_bits_per_character = 5 + +; Enable upload progress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; https://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On + +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; https://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On + +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; https://php.net/session.upload-progress.prefix +;session.upload_progress.prefix = "upload_progress_" + +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; https://php.net/session.upload-progress.name +;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" + +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; https://php.net/session.upload-progress.freq +;session.upload_progress.freq = "1%" + +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; https://php.net/session.upload-progress.min-freq +;session.upload_progress.min_freq = "1" + +; Only write session data when session data is changed. Enabled by default. +; https://php.net/session.lazy-write +;session.lazy_write = On + +[Assertion] +; Switch whether to compile assertions at all (to have no overhead at run-time) +; -1: Do not compile at all +; 0: Jump over assertion at run-time +; 1: Execute assertions +; Changing from or to a negative value is only possible in php.ini! +; (For turning assertions on and off at run-time, toggle zend.assertions between the values 1 and 0) +; Default Value: 1 +; Development Value: 1 +; Production Value: -1 +; https://php.net/zend.assertions +zend.assertions = 1 + +[COM] +; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs +; https://php.net/com.typelib-file +;com.typelib_file = + +; allow Distributed-COM calls +; https://php.net/com.allow-dcom +;com.allow_dcom = true + +; autoregister constants of a component's typelib on com_load() +; https://php.net/com.autoregister-typelib +;com.autoregister_typelib = true + +; register constants casesensitive +; https://php.net/com.autoregister-casesensitive +;com.autoregister_casesensitive = false + +; show warnings on duplicate constant registrations +; https://php.net/com.autoregister-verbose +;com.autoregister_verbose = true + +; The default character set code-page to use when passing strings to and from COM objects. +; Default: system ANSI code page +;com.code_page= + +; The version of the .NET framework to use. The value of the setting are the first three parts +; of the framework's version number, separated by dots, and prefixed with "v", e.g. "v4.0.30319". +;com.dotnet_version= + +[mbstring] +; language for internal character representation. +; This affects mb_send_mail() and mbstring.detect_order. +; https://php.net/mbstring.language +;mbstring.language = Japanese + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; internal/script encoding. +; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;mbstring.internal_encoding = + +; Use of this INI entry is deprecated, use global input_encoding instead. +; http input encoding. +; mbstring.encoding_translation = On is needed to use this setting. +; If empty, default_charset or input_encoding or mbstring.input is used. +; The precedence is: default_charset < input_encoding < mbstring.http_input +; https://php.net/mbstring.http-input +;mbstring.http_input = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; http output encoding. +; mb_output_handler must be registered as output buffer to function. +; If empty, default_charset or output_encoding or mbstring.http_output is used. +; The precedence is: default_charset < output_encoding < mbstring.http_output +; To use an output encoding conversion, mbstring's output handler must be set +; otherwise output encoding conversion cannot be performed. +; https://php.net/mbstring.http-output +;mbstring.http_output = + +; enable automatic encoding translation according to +; mbstring.internal_encoding setting. Input chars are +; converted to internal encoding by setting this to On. +; Note: Do _not_ use automatic encoding translation for +; portable libs/applications. +; https://php.net/mbstring.encoding-translation +;mbstring.encoding_translation = Off + +; automatic encoding detection order. +; "auto" detect order is changed according to mbstring.language +; https://php.net/mbstring.detect-order +;mbstring.detect_order = auto + +; substitute_character used when character cannot be converted +; one from another +; https://php.net/mbstring.substitute-character +;mbstring.substitute_character = none + +; Enable strict encoding detection. +;mbstring.strict_detection = Off + +; This directive specifies the regex pattern of content types for which mb_output_handler() +; is activated. +; Default: mbstring.http_output_conv_mimetypes=^(text/|application/xhtml\+xml) +;mbstring.http_output_conv_mimetypes= + +; This directive specifies maximum stack depth for mbstring regular expressions. It is similar +; to the pcre.recursion_limit for PCRE. +;mbstring.regex_stack_limit=100000 + +; This directive specifies maximum retry count for mbstring regular expressions. It is similar +; to the pcre.backtrack_limit for PCRE. +;mbstring.regex_retry_limit=1000000 + +[gd] +; Tell the jpeg decode to ignore warnings and try to create +; a gd image. The warning will then be displayed as notices +; disabled by default +; https://php.net/gd.jpeg-ignore-warning +;gd.jpeg_ignore_warning = 1 + +[exif] +; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. +; With mbstring support this will automatically be converted into the encoding +; given by corresponding encode setting. When empty mbstring.internal_encoding +; is used. For the decode settings you can distinguish between motorola and +; intel byte order. A decode setting cannot be empty. +; https://php.net/exif.encode-unicode +;exif.encode_unicode = ISO-8859-15 + +; https://php.net/exif.decode-unicode-motorola +;exif.decode_unicode_motorola = UCS-2BE + +; https://php.net/exif.decode-unicode-intel +;exif.decode_unicode_intel = UCS-2LE + +; https://php.net/exif.encode-jis +;exif.encode_jis = + +; https://php.net/exif.decode-jis-motorola +;exif.decode_jis_motorola = JIS + +; https://php.net/exif.decode-jis-intel +;exif.decode_jis_intel = JIS + +[Tidy] +; The path to a default tidy configuration file to use when using tidy +; https://php.net/tidy.default-config +;tidy.default_config = /usr/local/lib/php/default.tcfg + +; Should tidy clean and repair output automatically? +; WARNING: Do not use this option if you are generating non-html content +; such as dynamic images +; https://php.net/tidy.clean-output +tidy.clean_output = Off + +[soap] +; Enables or disables WSDL caching feature. +; https://php.net/soap.wsdl-cache-enabled +soap.wsdl_cache_enabled=1 + +; Sets the directory name where SOAP extension will put cache files. +; https://php.net/soap.wsdl-cache-dir +soap.wsdl_cache_dir="/tmp" + +; (time to live) Sets the number of second while cached file will be used +; instead of original one. +; https://php.net/soap.wsdl-cache-ttl +soap.wsdl_cache_ttl=86400 + +; Sets the size of the cache limit. (Max. number of WSDL files to cache) +soap.wsdl_cache_limit = 5 + +[sysvshm] +; A default size of the shared memory segment +;sysvshm.init_mem = 10000 + +[ldap] +; Sets the maximum number of open links or -1 for unlimited. +ldap.max_links = -1 + +[dba] +;dba.default_handler= + +[opcache] +; Determines if Zend OPCache is enabled +;opcache.enable=1 + +; Determines if Zend OPCache is enabled for the CLI version of PHP +;opcache.enable_cli=0 + +; The OPcache shared memory storage size. +;opcache.memory_consumption=128 + +; The amount of memory for interned strings in Mbytes. +;opcache.interned_strings_buffer=8 + +; The maximum number of keys (scripts) in the OPcache hash table. +; Only numbers between 200 and 1000000 are allowed. +;opcache.max_accelerated_files=10000 + +; The maximum percentage of "wasted" memory until a restart is scheduled. +;opcache.max_wasted_percentage=5 + +; When this directive is enabled, the OPcache appends the current working +; directory to the script key, thus eliminating possible collisions between +; files with the same name (basename). Disabling the directive improves +; performance, but may break existing applications. +;opcache.use_cwd=1 + +; When disabled, you must reset the OPcache manually or restart the +; webserver for changes to the filesystem to take effect. +;opcache.validate_timestamps=1 + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +;opcache.revalidate_freq=2 + +; Enables or disables file search in include_path optimization +;opcache.revalidate_path=0 + +; If disabled, all PHPDoc comments are dropped from the code to reduce the +; size of the optimized code. +;opcache.save_comments=1 + +; If enabled, compilation warnings (including notices and deprecations) will +; be recorded and replayed each time a file is included. Otherwise, compilation +; warnings will only be emitted when the file is first cached. +;opcache.record_warnings=0 + +; Allow file existence override (file_exists, etc.) performance feature. +;opcache.enable_file_override=0 + +; A bitmask, where each bit enables or disables the appropriate OPcache +; passes +;opcache.optimization_level=0x7FFFBFFF + +;opcache.dups_fix=0 + +; The location of the OPcache blacklist file (wildcards allowed). +; Each OPcache blacklist file is a text file that holds the names of files +; that should not be accelerated. The file format is to add each filename +; to a new line. The filename may be a full path or just a file prefix +; (i.e., /var/www/x blacklists all the files and directories in /var/www +; that start with 'x'). Line starting with a ; are ignored (comments). +;opcache.blacklist_filename= + +; Allows exclusion of large files from being cached. By default all files +; are cached. +;opcache.max_file_size=0 + +; How long to wait (in seconds) for a scheduled restart to begin if the cache +; is not being accessed. +;opcache.force_restart_timeout=180 + +; OPcache error_log file name. Empty string assumes "stderr". +;opcache.error_log= + +; All OPcache errors go to the Web server log. +; By default, only fatal errors (level 0) or errors (level 1) are logged. +; You can also enable warnings (level 2), info messages (level 3) or +; debug messages (level 4). +;opcache.log_verbosity_level=1 + +; Preferred Shared Memory back-end. Leave empty and let the system decide. +;opcache.preferred_memory_model= + +; Protect the shared memory from unexpected writing during script execution. +; Useful for internal debugging only. +;opcache.protect_memory=0 + +; Allows calling OPcache API functions only from PHP scripts which path is +; started from specified string. The default "" means no restriction +;opcache.restrict_api= + +; Mapping base of shared memory segments (for Windows only). All the PHP +; processes have to map shared memory into the same address space. This +; directive allows to manually fix the "Unable to reattach to base address" +; errors. +;opcache.mmap_base= + +; Facilitates multiple OPcache instances per user (for Windows only). All PHP +; processes with the same cache ID and user share an OPcache instance. +;opcache.cache_id= + +; Enables and sets the second level cache directory. +; It should improve performance when SHM memory is full, at server restart or +; SHM reset. The default "" disables file based caching. +;opcache.file_cache= + +; Enables or disables opcode caching in shared memory. +;opcache.file_cache_only=0 + +; Enables or disables checksum validation when script loaded from file cache. +;opcache.file_cache_consistency_checks=1 + +; Implies opcache.file_cache_only=1 for a certain process that failed to +; reattach to the shared memory (for Windows only). Explicitly enabled file +; cache is required. +;opcache.file_cache_fallback=1 + +; Enables or disables copying of PHP code (text segment) into HUGE PAGES. +; Under certain circumstances (if only a single global PHP process is +; started from which all others fork), this can increase performance +; by a tiny amount because TLB misses are reduced. On the other hand, this +; delays PHP startup, increases memory usage and degrades performance +; under memory pressure - use with care. +; Requires appropriate OS configuration. +;opcache.huge_code_pages=0 + +; Validate cached file permissions. +;opcache.validate_permission=0 + +; Prevent name collisions in chroot'ed environment. +;opcache.validate_root=0 + +; If specified, it produces opcode dumps for debugging different stages of +; optimizations. +;opcache.opt_debug_level=0 + +; Specifies a PHP script that is going to be compiled and executed at server +; start-up. +; https://php.net/opcache.preload +;opcache.preload= + +; Preloading code as root is not allowed for security reasons. This directive +; facilitates to let the preloading to be run as another user. +; https://php.net/opcache.preload_user +;opcache.preload_user= + +; Prevents caching files that are less than this number of seconds old. It +; protects from caching of incompletely updated files. In case all file updates +; on your site are atomic, you may increase performance by setting it to "0". +;opcache.file_update_protection=2 + +; Absolute path used to store shared lockfiles (for *nix only). +;opcache.lockfile_path=/tmp + +[curl] +; A default value for the CURLOPT_CAINFO option. This is required to be an +; absolute path. +;curl.cainfo = + +[openssl] +; The location of a Certificate Authority (CA) file on the local filesystem +; to use when verifying the identity of SSL/TLS peers. Most users should +; not specify a value for this directive as PHP will attempt to use the +; OS-managed cert stores in its absence. If specified, this value may still +; be overridden on a per-stream basis via the "cafile" SSL stream context +; option. +;openssl.cafile= + +; If openssl.cafile is not specified or if the CA file is not found, the +; directory pointed to by openssl.capath is searched for a suitable +; certificate. This value must be a correctly hashed certificate directory. +; Most users should not specify a value for this directive as PHP will +; attempt to use the OS-managed cert stores in its absence. If specified, +; this value may still be overridden on a per-stream basis via the "capath" +; SSL stream context option. +;openssl.capath= + +[ffi] +; FFI API restriction. Possible values: +; "preload" - enabled in CLI scripts and preloaded files (default) +; "false" - always disabled +; "true" - always enabled +;ffi.enable=preload + +; List of headers files to preload, wildcard patterns allowed. +;ffi.preload= diff --git a/.docker/php-worker/Dockerfile b/.docker/php-worker/Dockerfile index 98e176b..0d96809 100644 --- a/.docker/php-worker/Dockerfile +++ b/.docker/php-worker/Dockerfile @@ -41,7 +41,7 @@ RUN apk --update add wget \ fi -RUN pecl channel-update pecl.php.net; \ +RUN (pecl channel-update pecl.php.net || true); \ docker-php-ext-install mysqli mbstring pdo pdo_mysql xml pcntl; \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] && \ [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") != "80000" ]; then \ @@ -84,7 +84,7 @@ RUN set -eux; \ ./configure; \ make && make install; \ else \ - pecl install gnupg; \ + (pecl install gnupg || true); \ fi; \ docker-php-ext-enable gnupg; \ php -m | grep -oiE '^gnupg$'; \ @@ -131,7 +131,7 @@ RUN set -eux; \ make install && \ rm -r /tmp/imagick; \ else \ - pecl install imagick; \ + (pecl install imagick || true); \ fi && \ docker-php-ext-enable imagick; \ php -m | grep -q 'imagick'; \ @@ -160,18 +160,18 @@ RUN if [ ${INSTALL_SOAP} = true ]; then \ ARG INSTALL_MONGO=false RUN if [ ${INSTALL_MONGO} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install mongo; \ + (pecl install mongo || true); \ docker-php-ext-enable mongo; \ php -m | grep -oiE '^mongo$'; \ else \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") != "4" ]; then \ if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ]; then \ - pecl install mongodb-1.9.2; \ + (pecl install mongodb-1.9.2 || true); \ else \ - pecl install mongodb-1.16.2; \ + (pecl install mongodb-1.16.2 || true); \ fi; \ else \ - pecl install mongodb; \ + (pecl install mongodb || true); \ fi; \ docker-php-ext-enable mongodb; \ php -m | grep -oiE '^mongodb$'; \ @@ -204,7 +204,7 @@ RUN if [ ${INSTALL_OCI8} = true ] && [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus &&\ ln -s /usr/lib/libnsl.so.2.0.0 /usr/lib/libnsl.so.1 && \ ## Build OCI8 with PECL - echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \ + (echo "instantclient,${ORACLE_HOME}" | pecl install oci8 || true) && \ echo 'extension=oci8.so' > /etc/php7/conf.d/30-oci8.ini \ # Clean up apk del php7-pear php7-dev gcc musl-dev && \ @@ -300,9 +300,9 @@ RUN if [ ${INSTALL_AMQP} = true ]; then \ || [ ${IVPLDOCK_PHP_VERSION} = "7.1" ] \ || [ ${IVPLDOCK_PHP_VERSION} = "7.0" ] \ || [ ${IVPLDOCK_PHP_VERSION} = "5.6" ]; then \ - printf "\n" | pecl install amqp-1.11.0; \ + (printf "\n" | pecl install amqp-1.11.0 || true); \ else \ - printf "\n" | pecl install amqp; \ + (printf "\n" | pecl install amqp || true); \ fi && \ docker-php-ext-enable amqp && \ apk del -q rabbitmq-c-dev; \ @@ -350,7 +350,7 @@ ENV LARADOCK_PHALCON_VERSION ${LARADOCK_PHALCON_VERSION} RUN if [ "$INSTALL_PHALCON" = true ]; then \ apk update \ - && pecl channel-update pecl.php.net \ + && (pecl channel-update pecl.php.net || true) \ && apk add --no-cache libpcre32 \ && pecl install phalcon-${LARADOCK_PHALCON_VERSION}; \ docker-php-ext-enable phalcon; \ @@ -362,9 +362,9 @@ ARG INSTALL_APCU=false RUN if [ ${INSTALL_APCU} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install -a apcu-4.0.11; \ + (pecl install -a apcu-4.0.11 || true); \ else \ - pecl install apcu; \ + (pecl install apcu || true); \ fi && \ docker-php-ext-enable apcu \ ;fi @@ -379,9 +379,9 @@ ARG INSTALL_REDIS=false RUN if [ ${INSTALL_REDIS} = true ]; then \ # Install Redis Extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - printf "\n" | pecl install -o -f redis-4.3.0; \ + (printf "\n" | pecl install -o -f redis-4.3.0 || true); \ else \ - printf "\n" | pecl install -o -f redis; \ + (printf "\n" | pecl install -o -f redis || true); \ fi; \ rm -rf /tmp/pear; \ docker-php-ext-enable redis \ @@ -397,15 +397,15 @@ RUN set -eux; \ if [ ${INSTALL_SWOOLE} = true ]; then \ # Install Php Swoole Extension if [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "50600" ]; then \ - pecl install swoole-2.0.10; \ + (pecl install swoole-2.0.10 || true); \ elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70000" ]; then \ - pecl install swoole-4.3.5; \ + (pecl install swoole-4.3.5 || true); \ elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "70100" ]; then \ - pecl install swoole-4.5.11; \ + (pecl install swoole-4.5.11 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ - pecl install swoole-4.8.12; \ + (pecl install swoole-4.8.12 || true); \ else \ - pecl install swoole; \ + (pecl install swoole || true); \ fi; \ docker-php-ext-enable swoole; \ php -m | grep -oiE '^swoole$'; \ @@ -421,7 +421,7 @@ RUN set -eux; \ if [ ${INSTALL_XLSWRITER} = true ]; then \ # Install Php xlswriter Extension \ if [ $(php -r "echo PHP_MAJOR_VERSION;") != "5" ]; then \ - pecl install xlswriter && \ + (pecl install xlswriter || true) && \ docker-php-ext-enable xlswriter && \ php -m | grep -q 'xlswriter'; \ else \ @@ -438,7 +438,7 @@ ARG INSTALL_TAINT=false RUN if [ ${INSTALL_TAINT} = true ]; then \ # Install Php TAINT Extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ - pecl install taint; \ + (pecl install taint || true); \ docker-php-ext-enable taint; \ php -m | grep -q 'taint'; \ else \ @@ -466,7 +466,7 @@ ARG INSTALL_XMLRPC=false RUN if [ ${INSTALL_XMLRPC} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ - pecl install xmlrpc-1.0.0RC3; \ + (pecl install xmlrpc-1.0.0RC3 || true); \ docker-php-ext-enable xmlrpc; \ else \ docker-php-ext-install xmlrpc; \ @@ -631,7 +631,32 @@ RUN set -eux; \ # Make sure you rebuild your container with every change. # -COPY supervisord.conf /etc/supervisord.conf +COPY php-worker/supervisord.conf /etc/supervisord.conf + +# Add InvoicePlane banner to bash profile +COPY invoiceplane-banner.sh /root/invoiceplane-banner.sh +RUN sed -i 's/\r//g' /root/invoiceplane-banner.sh && \ + chmod +x /root/invoiceplane-banner.sh && \ + echo "" >> /root/.bashrc && \ + echo "# Set container type for banner" >> /root/.bashrc && \ + echo "export CONTAINER_TYPE='PHP Worker Container'" >> /root/.bashrc && \ + echo "# Load InvoicePlane Banner" >> /root/.bashrc && \ + echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /root/.bashrc && \ + echo " source ~/invoiceplane-banner.sh" >> /root/.bashrc && \ + echo "fi" >> /root/.bashrc && \ + # Also add banner for laradock user \ + cp /root/invoiceplane-banner.sh /home/laradock/invoiceplane-banner.sh && \ + chown laradock:laradock /home/laradock/invoiceplane-banner.sh && \ + chmod +x /home/laradock/invoiceplane-banner.sh && \ + touch /home/laradock/.bashrc && \ + chown laradock:laradock /home/laradock/.bashrc && \ + echo "" >> /home/laradock/.bashrc && \ + echo "# Set container type for banner" >> /home/laradock/.bashrc && \ + echo "export CONTAINER_TYPE='PHP Worker Container'" >> /home/laradock/.bashrc && \ + echo "# Load InvoicePlane Banner" >> /home/laradock/.bashrc && \ + echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /home/laradock/.bashrc && \ + echo " source ~/invoiceplane-banner.sh" >> /home/laradock/.bashrc && \ + echo "fi" >> /home/laradock/.bashrc ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"] @@ -650,7 +675,7 @@ ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"] #-------------------------------------------------------------------------- # -RUN php -v | head -n 1 | grep -q "PHP ${PHP_VERSION}." +RUN php -v | head -n 1 | grep -q "PHP ${IVPLDOCK_PHP_VERSION}." # #-------------------------------------------------------------------------- diff --git a/.docker/redis/Dockerfile b/.docker/redis/Dockerfile index 09b677f..5a15cf9 100644 --- a/.docker/redis/Dockerfile +++ b/.docker/redis/Dockerfile @@ -1,5 +1,5 @@ FROM redis:alpine WORKDIR /redis -COPY redis.conf /usr/local/etc/redis/redis.conf -COPY init.sh ./ +COPY redis/redis.conf /usr/local/etc/redis/redis.conf +COPY redis/init.sh ./ RUN chmod +x init.sh diff --git a/.docker/workspace/Dockerfile b/.docker/workspace/Dockerfile index f40f41e..054db2e 100644 --- a/.docker/workspace/Dockerfile +++ b/.docker/workspace/Dockerfile @@ -52,9 +52,21 @@ ENV DEBIAN_FRONTEND=noninteractive \ # always run apt update when start and after add new source list, then clean up at end. RUN set -xe; \ apt-get update -yqq && \ - pecl channel-update pecl.php.net && \ - groupadd -g ${PGID} ivpldock && \ - useradd -l -u ${PUID} -g ivpldock -m ivpldock -G docker_env && \ + (pecl channel-update pecl.php.net || true) && \ + # Ensure docker_env group exists for workspace user + (groupadd docker_env || true) && \ + # Ensure ivpldock group exists: try requested PGID first, then fall back to default GID + if ! getent group ivpldock > /dev/null; then \ + if ! groupadd -g ${PGID} ivpldock 2>/dev/null; then \ + groupadd ivpldock; \ + fi; \ + fi && \ + # Ensure ivpldock user exists and is member of docker_env; do not rename existing system users + if ! id -u ivpldock > /dev/null 2>&1; then \ + useradd -u ${PUID} -g ivpldock -m ivpldock -G docker_env; \ + else \ + usermod -aG docker_env ivpldock; \ + fi && \ usermod -p "*" ivpldock -s /bin/bash && \ apt-get install -yqq \ apt-utils \ @@ -70,10 +82,10 @@ RUN set -xe; \ # # next lines are here because there is no auto build on dockerhub see https://github.com/ivpldock/ivpldock/pull/1903#issuecomment-463142846 libzip-dev zip unzip \ - # Install the zip extension - php${IVPLDOCK_PHP_VERSION}-zip \ # nasm nasm && \ + # Install the zip extension if available (base image already includes it, but try anyway) + (apt-get install -yqq php${IVPLDOCK_PHP_VERSION}-zip || true) && \ php -m | grep -q 'zip' # @@ -103,23 +115,44 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone USER root -COPY ./aliases.sh /root/aliases.sh -COPY ./aliases.sh /home/ivpldock/aliases.sh +COPY workspace/aliases.sh /root/aliases.sh +COPY workspace/aliases.sh /home/ivpldock/aliases.sh +COPY invoiceplane-banner.sh /root/invoiceplane-banner.sh +COPY invoiceplane-banner.sh /home/ivpldock/invoiceplane-banner.sh RUN sed -i 's/\r//' /root/aliases.sh && \ sed -i 's/\r//' /home/ivpldock/aliases.sh && \ + sed -i 's/\r//' /root/invoiceplane-banner.sh && \ + sed -i 's/\r//' /home/ivpldock/invoiceplane-banner.sh && \ chown ivpldock:ivpldock /home/ivpldock/aliases.sh && \ + chown ivpldock:ivpldock /home/ivpldock/invoiceplane-banner.sh && \ + chmod +x /root/invoiceplane-banner.sh && \ + chmod +x /home/ivpldock/invoiceplane-banner.sh && \ + echo "" >> ~/.bashrc && \ + echo "# Set container type for banner" >> ~/.bashrc && \ + echo "export CONTAINER_TYPE='Workspace Container'" >> ~/.bashrc && \ + echo "# Load InvoicePlane Banner" >> ~/.bashrc && \ + echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> ~/.bashrc && \ + echo " source ~/invoiceplane-banner.sh" >> ~/.bashrc && \ + echo "fi" >> ~/.bashrc && \ echo "" >> ~/.bashrc && \ echo "# Load Custom Aliases" >> ~/.bashrc && \ - echo "export PS1='\W\$ '" >> ~/.bashrc && \ + echo "export PS1='\\W\$ '" >> ~/.bashrc && \ echo "source ~/aliases.sh" >> ~/.bashrc && \ echo "" >> ~/.bashrc USER ivpldock RUN echo "" >> ~/.bashrc && \ + echo "# Set container type for banner" >> ~/.bashrc && \ + echo "export CONTAINER_TYPE='Workspace Container'" >> ~/.bashrc && \ + echo "# Load InvoicePlane Banner" >> ~/.bashrc && \ + echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> ~/.bashrc && \ + echo " source ~/invoiceplane-banner.sh" >> ~/.bashrc && \ + echo "fi" >> ~/.bashrc && \ + echo "" >> ~/.bashrc && \ echo "# Load Custom Aliases" >> ~/.bashrc && \ - echo "export PS1='\W\$ '" >> ~/.bashrc && \ + echo "export PS1='\\W\$ '" >> ~/.bashrc && \ echo "source ~/aliases.sh" >> ~/.bashrc && \ echo "" >> ~/.bashrc @@ -130,10 +163,10 @@ RUN echo "" >> ~/.bashrc && \ USER root # Add the composer.json -COPY ./composer.json /home/ivpldock/.composer/composer.json +COPY workspace/composer.json /home/ivpldock/.composer/composer.json # Add the auth.json for magento 2 credentials -COPY ./auth.json /home/ivpldock/.composer/auth.json +COPY workspace/auth.json /home/ivpldock/.composer/auth.json # Make sure that ~/.composer belongs to ivpldock RUN chown -R ivpldock:ivpldock /home/ivpldock/.composer @@ -195,7 +228,7 @@ RUN echo "" >> ~/.bashrc && \ USER root -COPY ./crontab /etc/cron.d +COPY workspace/crontab /etc/cron.d RUN chmod -R 644 /etc/cron.d @@ -215,14 +248,24 @@ RUN set -eux; \ # BZ2: ########################################################################### if [ ${INSTALL_BZ2} = true ]; then \ - apt-get -yqq install php${IVPLDOCK_PHP_VERSION}-bz2; \ + (apt-get -yqq install php${IVPLDOCK_PHP_VERSION}-bz2 || \ + (apt-get -yqq install libbz2-dev && \ + (pecl install bz2 || true) && \ + mkdir -p /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d && \ + echo "extension=bz2.so" > /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/bz2.ini && \ + ln -sf /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/bz2.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-bz2.ini)); \ fi; \ ########################################################################### # GMP (GNU Multiple Precision): ########################################################################### if [ ${INSTALL_GMP} = true ]; then \ # Install the PHP GMP extension - apt-get -yqq install php${IVPLDOCK_PHP_VERSION}-gmp; \ + (apt-get -yqq install php${IVPLDOCK_PHP_VERSION}-gmp || \ + (apt-get -yqq install libgmp-dev && \ + (pecl install gmp || true) && \ + mkdir -p /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d && \ + echo "extension=gmp.so" > /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/gmp.ini && \ + ln -sf /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/gmp.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-gmp.ini)); \ fi; \ ########################################################################### # GnuPG: @@ -264,7 +307,12 @@ RUN set -eux; \ # IMAP: ########################################################################### if [ ${INSTALL_IMAP} = true ]; then \ - apt-get install -yqq php${IVPLDOCK_PHP_VERSION}-imap; \ + (apt-get install -yqq php${IVPLDOCK_PHP_VERSION}-imap || \ + (apt-get install -yqq libc-client-dev libkrb5-dev && \ + (pecl install imap || true) && \ + mkdir -p /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d && \ + echo "extension=imap.so" > /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/imap.ini && \ + ln -sf /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/imap.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-imap.ini)); \ fi; ########################################################################### @@ -280,28 +328,35 @@ ARG INSTALL_XDEBUG=false ARG XDEBUG_CLIENT_HOST ARG XDEBUG_PORT=9003 -RUN apt-get install -yqq pkg-config php-xml php${IVPLDOCK_PHP_VERSION}-xml && \ - pecl install xdebug-3.3.0 && \ - echo "zend_extension=xdebug.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-xdebug.ini +RUN (apt-get install -yqq pkg-config php-xml php${IVPLDOCK_PHP_VERSION}-xml || true) && \ + (pecl install xdebug-3.3.0 || true) && \ + (echo "zend_extension=xdebug.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-xdebug.ini || true) && \ + # Verify Xdebug installation + if ! php -m | grep -q xdebug; then \ + echo "WARNING: Xdebug extension is not loaded after installation attempt"; \ + fi RUN echo "##### PHP Version #####" \ ${IVPLDOCK_PHP_VERSION} \ "##### /PHP Version #####" # ADD for REMOTE debugging -COPY ./xdebug.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini +COPY workspace/xdebug.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini +# Configure Xdebug settings based on PHP version +# For Xdebug 3 (PHP 7.3, 7.4, 8.x): Use trigger mode to prevent connection warnings during build +# For Xdebug 2 (older PHP): Keep autostart disabled to prevent connection warnings during build RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \ sed -i "s/xdebug.remote_host=/xdebug.client_host=/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_connect_back=0/xdebug.discover_client_host=false/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_port=9000/xdebug.client_port=${XDEBUG_PORT}/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug\.\(remote_port\|client_port\)=[0-9]*/xdebug.client_port=${XDEBUG_PORT}/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.profiler_enable=0/; xdebug.profiler_enable=0/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.profiler_output_dir=/xdebug.output_dir=/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_mode=req/; xdebug.remote_mode=req/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=yes/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=trigger/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_enable=0/xdebug.mode=debug/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini \ ;else \ - sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=0/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini \ ;fi RUN sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini @@ -326,7 +381,11 @@ ARG INSTALL_PHPREDIS=false RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ apt-get update \ - && apt-get install -yqq php${IVPLDOCK_PHP_VERSION}-redis \ + && (apt-get install -yqq php${IVPLDOCK_PHP_VERSION}-redis || \ + ((pecl install redis || true) && \ + mkdir -p /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d && \ + echo "extension=redis.so" > /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/redis.ini && \ + ln -sf /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/redis.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-redis.ini)) \ ;fi ########################################################################### @@ -426,8 +485,8 @@ RUN find $NVM_DIR -type f -name node -exec ln -s {} /usr/local/bin/node \; && \ ln -s $NODE_MODS_DIR/npm/bin/npx-cli.js /usr/local/bin/npx # Mount .npmrc into home folder -COPY ./.npmrc /root/.npmrc -COPY ./.npmrc /home/${IVPLDOCK_USER}/.npmrc +COPY workspace/.npmrc /root/.npmrc +COPY workspace/.npmrc /home/${IVPLDOCK_USER}/.npmrc ########################################################################### # YARN: @@ -482,15 +541,6 @@ USER root ARG INSTALL_PYTHON=false -RUN if [ ${INSTALL_PYTHON} = true ]; then \ - apt-get -y install python python-dev build-essential \ - && curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py \ - && python get-pip.py \ - && rm get-pip.py \ - && python -m pip install --upgrade pip \ - && python -m pip install --upgrade virtualenv \ -;fi - ########################################################################### # PYTHON3: ########################################################################### @@ -535,7 +585,7 @@ RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ make install && \ rm -r /tmp/imagick; \ else \ - pecl install imagick; \ + (pecl install imagick || true); \ fi && \ echo "extension=imagick.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/imagick.ini && \ ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/imagick.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-imagick.ini && \ @@ -578,9 +628,9 @@ RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \ xfonts-base \ xfonts-75dpi \ wget \ - && wget "https://github.com/wkhtmltopdf/packaging/releases/download/${WKHTMLTOPDF_VERSION}/wkhtmltox_${WKHTMLTOPDF_VERSION}.focal_${ARCH}.deb" \ + && (wget "https://github.com/wkhtmltopdf/packaging/releases/download/${WKHTMLTOPDF_VERSION}/wkhtmltox_${WKHTMLTOPDF_VERSION}.focal_${ARCH}.deb" \ && dpkg -i "wkhtmltox_${WKHTMLTOPDF_VERSION}.focal_${ARCH}.deb" \ - && apt -f install \ + && apt -f install) || echo "wkhtmltopdf installation failed, continuing..." \ ;fi ########################################################################### @@ -589,7 +639,7 @@ RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \ ARG INSTALL_GIT_PROMPT=false -COPY git-prompt.sh /tmp/git-prompt +COPY workspace/git-prompt.sh /tmp/git-prompt RUN if [ ${INSTALL_GIT_PROMPT} = true ]; then \ git clone https://github.com/magicmonty/bash-git-prompt.git /root/.bash-git-prompt --depth=1 && \ @@ -657,8 +707,8 @@ USER root USER root -COPY ./aliases.sh /root/aliases.sh -COPY ./aliases.sh /home/ivpldock/aliases.sh +COPY workspace/aliases.sh /root/aliases.sh +COPY workspace/aliases.sh /home/ivpldock/aliases.sh RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \ sed -i 's/\r//' /root/aliases.sh && \ diff --git a/.docker/workspace/Dockerfile.74 b/.docker/workspace/Dockerfile.74 index 56ee574..b8ddfe6 100644 --- a/.docker/workspace/Dockerfile.74 +++ b/.docker/workspace/Dockerfile.74 @@ -50,8 +50,9 @@ ENV PGID ${PGID} # always run apt update when start and after add new source list, then clean up at end. RUN set -xe; \ apt-get update -yqq && \ - pecl channel-update pecl.php.net && \ - groupadd -g ${PGID} ivpldock && \ + (pecl channel-update pecl.php.net || true) && \ + (groupadd -g ${PGID} ivpldock || groupadd ivpldock) && \ + (groupadd docker_env || true) && \ useradd -l -u ${PUID} -g ivpldock -m ivpldock -G docker_env && \ usermod -p "*" ivpldock -s /bin/bash && \ apt-get install -yqq \ @@ -335,41 +336,43 @@ ARG XDEBUG_PORT=9003 RUN if [ ${INSTALL_XDEBUG} = true ]; then \ # Install the xdebug extension # https://xdebug.org/docs/compat - apt-get install -yqq pkg-config php-xml php${IVPLDOCK_PHP_VERSION}-xml && \ + (apt-get install -yqq pkg-config php-xml php${IVPLDOCK_PHP_VERSION}-xml || true) && \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ - pecl install xdebug-3.3.0; \ + (pecl install xdebug-3.3.0 || true); \ else \ - pecl install xdebug-3.1.6; \ + (pecl install xdebug-3.1.6 || true); \ fi; \ else \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install xdebug-2.5.5; \ + (pecl install xdebug-2.5.5 || true); \ else \ if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ - pecl install xdebug-2.9.0; \ + (pecl install xdebug-2.9.0 || true); \ else \ - pecl install xdebug-2.9.8; \ + (pecl install xdebug-2.9.8 || true); \ fi \ fi \ fi && \ - echo "zend_extension=xdebug.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-xdebug.ini \ + (echo "zend_extension=xdebug.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-xdebug.ini || true) \ ;fi # ADD for REMOTE debugging COPY ./xdebug.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini +# Configure Xdebug settings based on PHP version +# For Xdebug 3 (PHP 7.3, 7.4, 8.x): Use trigger mode to prevent connection warnings during build +# For Xdebug 2 (older PHP): Keep autostart disabled to prevent connection warnings during build RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \ sed -i "s/xdebug.remote_host=/xdebug.client_host=/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_connect_back=0/xdebug.discover_client_host=false/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_port=9000/xdebug.client_port=${XDEBUG_PORT}/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug\.\(remote_port\|client_port\)=[0-9]*/xdebug.client_port=${XDEBUG_PORT}/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.profiler_enable=0/; xdebug.profiler_enable=0/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.profiler_output_dir=/xdebug.output_dir=/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_mode=req/; xdebug.remote_mode=req/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=yes/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=trigger/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_enable=0/xdebug.mode=debug/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini \ ;else \ - sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini \ ;fi RUN sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini @@ -384,7 +387,7 @@ ARG INSTALL_PCOV=false RUN if [ ${INSTALL_PCOV} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") != "0" ]; }; then \ - pecl install pcov && \ + (pecl install pcov || true) && \ echo "extension=pcov.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/php.ini && \ echo "pcov.enabled" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/php.ini \ ;fi \ @@ -431,19 +434,19 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ # Install the mongodb extension apt-get install -yqq pkg-config && \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install mongo; \ + (pecl install mongo || true); \ echo "extension=mongo.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/mongo.ini; \ ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/mongo.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/30-mongo.ini; \ php -m | grep -oiE '^mongo$'; \ else \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") != "4" ]; then \ if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "1" ]; then \ - pecl install mongodb-1.9.2; \ + (pecl install mongodb-1.9.2 || true); \ else \ - pecl install mongodb-1.16.2; \ + (pecl install mongodb-1.16.2 || true); \ fi; \ else \ - pecl install mongodb; \ + (pecl install mongodb || true); \ fi; \ echo "extension=mongodb.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/mongodb.ini; \ ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/mongodb.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/30-mongodb.ini; \ @@ -464,9 +467,9 @@ RUN if [ ${INSTALL_AMQP} = true ]; then \ || [ ${IVPLDOCK_PHP_VERSION} = "7.1" ] \ || [ ${IVPLDOCK_PHP_VERSION} = "7.0" ] \ || [ ${IVPLDOCK_PHP_VERSION} = "5.6" ]; then \ - printf "\n" | pecl install amqp-1.11.0; \ + (printf "\n" | pecl install amqp-1.11.0 || true); \ else \ - printf "\n" | pecl install amqp; \ + (printf "\n" | pecl install amqp || true); \ fi && \ echo "extension=amqp.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/amqp.ini && \ ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/amqp.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/30-amqp.ini && \ @@ -592,7 +595,7 @@ ARG INSTALL_TAINT=false RUN if [ "${INSTALL_TAINT}" = true ]; then \ # Install Php TAINT Extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ - pecl install taint && \ + (pecl install taint || true) && \ echo "extension=taint.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/taint.ini && \ ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/taint.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-taint.ini && \ php -m | grep -q 'taint'; \ @@ -915,15 +918,15 @@ RUN if [ ${INSTALL_OCI8} = true ]; then \ libaio-dev && \ # Install PHP extensions if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - echo 'instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/' | pecl install oci8-2.0.12; \ + (echo 'instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/' | pecl install oci8-2.0.12 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ - echo 'instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/' | pecl install oci8-2.2.0; \ + (echo 'instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/' | pecl install oci8-2.2.0 || true); \ elif [ $(php -r "echo PHP_VERSION_ID - PHP_RELEASE_VERSION;") = "80000" ]; then \ - echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8-3.0.1; \ + (echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8-3.0.1 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION . PHP_MINOR_VERSION;") = "81" ]; then \ - echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8-3.2.1; \ + (echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8-3.2.1 || true); \ else \ - echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8; \ + (echo "instantclient,/opt/oracle/instantclient_${ORACLE_INSTANT_CLIENT_VERSION}/" | pecl install oci8 || true); \ fi \ && echo "extension=oci8.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/php.ini \ && php -m | grep -q 'oci8' \ @@ -943,9 +946,9 @@ RUN set -xe; \ && apt-get update -yqq \ && apt-get install -y libv8-5.4 && \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install v8js-0.6.4; \ + (pecl install v8js-0.6.4 || true); \ else \ - pecl install v8js; \ + (pecl install v8js || true); \ fi \ && echo "extension=v8js.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/php.ini \ && php -m | grep -q 'v8js' \ @@ -1212,7 +1215,7 @@ RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ make install && \ rm -r /tmp/imagick; \ else \ - pecl install imagick; \ + (pecl install imagick || true); \ fi && \ echo "extension=imagick.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/imagick.ini && \ ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/imagick.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-imagick.ini && \ @@ -1301,7 +1304,7 @@ ENV IVPLDOCK_PHALCON_VERSION ${IVPLDOCK_PHALCON_VERSION} RUN if [ $INSTALL_PHALCON = true ]; then \ apt-get update -yqq \ - && pecl channel-update pecl.php.net \ + && (pecl channel-update pecl.php.net || true) \ && apt-get install -yqq libpcre3-dev; \ pecl install phalcon-${IVPLDOCK_PHALCON_VERSION}; \ echo "extension=phalcon.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/phalcon.ini; \ @@ -1377,11 +1380,11 @@ RUN set -eux; \ if [ ${INSTALL_YAML} = true ]; then \ apt-get install -yqq libyaml-dev; \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - echo '' | pecl install -a yaml-1.3.2; \ + (echo '' | pecl install -a yaml-1.3.2 || true); \ elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ - echo '' | pecl install yaml-2.0.4; \ + (echo '' | pecl install yaml-2.0.4 || true); \ else \ - echo '' | pecl install yaml; \ + (echo '' | pecl install yaml || true); \ fi; \ echo "extension=yaml.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/yaml.ini; \ ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/yaml.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/35-yaml.ini; \ @@ -1391,7 +1394,7 @@ RUN set -eux; \ ########################################################################### if [ ${INSTALL_RDKAFKA} = true ]; then \ apt-get install -yqq librdkafka-dev; \ - pecl install rdkafka; \ + (pecl install rdkafka || true); \ echo "extension=rdkafka.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/rdkafka.ini; \ ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/rdkafka.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-rdkafka.ini; \ php -m | grep -q 'rdkafka'; \ @@ -1640,7 +1643,7 @@ RUN if [ ${INSTALL_PHPDECIMAL} = true ]; then \ echo 'decimal not support PHP 5.6'; \ else \ apt-get install -yqq libmpdec-dev \ - && pecl install decimal \ + && (pecl install decimal || true) \ && echo "extension=decimal.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/decimal.ini \ && ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/decimal.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/30-decimal.ini \ && php -m | grep -q 'decimal' \ @@ -1663,9 +1666,9 @@ RUN set -eux; \ phpize && ./configure && make && make install;\ else \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install zookeeper-0.5.0; \ + (pecl install zookeeper-0.5.0 || true); \ else \ - pecl install zookeeper-0.7.2; \ + (pecl install zookeeper-0.7.2 || true); \ fi; \ fi; \ echo "extension=zookeeper.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/zookeeper.ini; \ @@ -1709,7 +1712,7 @@ USER root ARG INSTALL_TRADER=false RUN if [ ${INSTALL_TRADER} = true ]; then \ - pecl install trader \ + (pecl install trader || true) \ && echo "extension=trader.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/trader.ini \ && ln -s /etc/php/${IVPLDOCK_PHP_VERSION}/mods-available/trader.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-trader.ini \ ;fi diff --git a/.docker/workspace/Dockerfile.81 b/.docker/workspace/Dockerfile.81 index f40f41e..e8eb645 100644 --- a/.docker/workspace/Dockerfile.81 +++ b/.docker/workspace/Dockerfile.81 @@ -52,8 +52,9 @@ ENV DEBIAN_FRONTEND=noninteractive \ # always run apt update when start and after add new source list, then clean up at end. RUN set -xe; \ apt-get update -yqq && \ - pecl channel-update pecl.php.net && \ - groupadd -g ${PGID} ivpldock && \ + (pecl channel-update pecl.php.net || true) && \ + (groupadd -g ${PGID} ivpldock || groupadd ivpldock) && \ + (groupadd docker_env || true) && \ useradd -l -u ${PUID} -g ivpldock -m ivpldock -G docker_env && \ usermod -p "*" ivpldock -s /bin/bash && \ apt-get install -yqq \ @@ -280,9 +281,9 @@ ARG INSTALL_XDEBUG=false ARG XDEBUG_CLIENT_HOST ARG XDEBUG_PORT=9003 -RUN apt-get install -yqq pkg-config php-xml php${IVPLDOCK_PHP_VERSION}-xml && \ - pecl install xdebug-3.3.0 && \ - echo "zend_extension=xdebug.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-xdebug.ini +RUN (apt-get install -yqq pkg-config php-xml php${IVPLDOCK_PHP_VERSION}-xml || true) && \ + (pecl install xdebug-3.3.0 || true) && \ + (echo "zend_extension=xdebug.so" >> /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/20-xdebug.ini || true) RUN echo "##### PHP Version #####" \ ${IVPLDOCK_PHP_VERSION} \ @@ -291,17 +292,19 @@ RUN echo "##### PHP Version #####" \ # ADD for REMOTE debugging COPY ./xdebug.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini +# Configure Xdebug settings based on PHP version +# For Xdebug 3 (PHP 7.3, 7.4, 8.x): Use trigger mode to prevent connection warnings during build +# For Xdebug 2 (older PHP): Keep autostart disabled to prevent connection warnings during build RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \ sed -i "s/xdebug.remote_host=/xdebug.client_host=/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_connect_back=0/xdebug.discover_client_host=false/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_port=9000/xdebug.client_port=${XDEBUG_PORT}/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug\.\(remote_port\|client_port\)=[0-9]*/xdebug.client_port=${XDEBUG_PORT}/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.profiler_enable=0/; xdebug.profiler_enable=0/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.profiler_output_dir=/xdebug.output_dir=/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_mode=req/; xdebug.remote_mode=req/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=yes/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=trigger/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_enable=0/xdebug.mode=debug/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini \ ;else \ - sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \ sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini \ ;fi RUN sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini diff --git a/.docker/workspace/xdebug.ini b/.docker/workspace/xdebug.ini index 3e6346e..d1d6b29 100644 --- a/.docker/workspace/xdebug.ini +++ b/.docker/workspace/xdebug.ini @@ -3,7 +3,7 @@ zend_extension=xdebug.so ; Xdebug Mode xdebug.mode=debug -xdebug.start_with_request=yes +xdebug.start_with_request=trigger xdebug.client_host=host.docker.internal xdebug.client_port=9003 xdebug.discover_client_host=false diff --git a/.env.example b/.env.example index f24e923..914cd69 100644 --- a/.env.example +++ b/.env.example @@ -38,8 +38,8 @@ COMPOSE_PROJECT_NAME=ivpldock ### PHP Version ########################################### # Select a PHP version of the Workspace and PHP-FPM containers (Does not apply to HHVM). -# Accepted values: 8.3 - 8.2 - 8.1 - 8.0 - 7.4 - 7.3 - 7.2 - 7.1 - 7.0 - 5.6 -PHP_VERSION=8.1 +# Accepted values: 8.4 - 8.3 - 8.2 - 8.1 - 8.0 - 7.4 - 7.3 - 7.2 - 7.1 - 7.0 - 5.6 +PHP_VERSION=8.4 ### Phalcon Version ########################################### @@ -155,7 +155,7 @@ WORKSPACE_INSTALL_PRESTISSIMO=false WORKSPACE_INSTALL_LINUXBREW=false WORKSPACE_INSTALL_MC=false WORKSPACE_INSTALL_SYMFONY=false -WORKSPACE_INSTALL_PYTHON=true +WORKSPACE_INSTALL_PYTHON=false WORKSPACE_INSTALL_PYTHON3=true WORKSPACE_INSTALL_POWERLINE=false WORKSPACE_INSTALL_SUPERVISOR=true diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..5f83a2b --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,328 @@ +# GitHub Copilot Instructions for InvoicePlane-Docker + +## Project Context + +This repository provides a Docker-based development environment for InvoicePlane, forked from Laradock. The primary goal is to maintain a stable, performant, and easy-to-use containerized environment for InvoicePlane development. + +## Core Principles + +### 1. Minimalism +- Make the smallest possible changes to achieve the goal +- Avoid unnecessary refactoring or feature additions +- Keep configurations simple and maintainable + +### 2. Compatibility +- Support PHP versions: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 +- Maintain backward compatibility with existing configurations +- Test changes across all supported PHP versions + +### 3. Documentation +- Document all configuration changes +- Update README.md for user-facing changes +- Add inline comments for complex Dockerfile logic + +## Code Style Guidelines + +### Dockerfile Best Practices + +```dockerfile +# Good: Clear section headers and comments +########################################################################### +# Redis Extension: +########################################################################### + +ARG INSTALL_REDIS=false +RUN if [ ${INSTALL_REDIS} = true ]; then \ + # Install Redis extension for PHP + pecl install redis && \ + docker-php-ext-enable redis \ +;fi + +# Bad: No comments, unclear purpose +ARG INSTALL_REDIS=false +RUN if [ ${INSTALL_REDIS} = true ]; then \ + pecl install redis && \ + docker-php-ext-enable redis \ +;fi +``` + +### Shell Scripts + +```bash +# Good: Error handling and validation +#!/bin/bash +set -euo pipefail + +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + exit 1 +fi + +# Bad: No error handling +#!/bin/bash +docker-compose up -d +``` + +### Environment Variables + +```bash +# Good: Descriptive names with sensible defaults +WORKSPACE_INSTALL_XDEBUG=true +WORKSPACE_XDEBUG_PORT=9003 +PHP_VERSION=8.1 + +# Bad: Unclear names or no defaults +XDBG=true +PORT=9003 +VER=8.1 +``` + +## Common Tasks + +### Adding a New PHP Extension + +1. **Update Dockerfile** (e.g., `.docker/php-fpm/Dockerfile`): + ```dockerfile + ########################################################################### + # Extension Name: + ########################################################################### + + ARG INSTALL_EXTENSION=false + + RUN if [ ${INSTALL_EXTENSION} = true ]; then \ + # Install dependencies if needed + apt-get install -yqq lib-dependency && \ + # Install extension + pecl install extension-name && \ + docker-php-ext-enable extension-name \ + ;fi + ``` + +2. **Update docker-compose.yml**: + ```yaml + php-fpm: + build: + args: + - INSTALL_EXTENSION=${PHP_FPM_INSTALL_EXTENSION} + ``` + +3. **Update .env.example**: + ```bash + ### PHP-FPM ############################################## + PHP_FPM_INSTALL_EXTENSION=false + ``` + +4. **Test across PHP versions**: + ```bash + # Test with different PHP versions + sed -i 's/PHP_VERSION=8.1/PHP_VERSION=8.2/' .env.docker + docker compose --env-file .env.docker build php-fpm + ``` + +### Modifying Xdebug Configuration + +- **Always use trigger mode** to prevent build-time warnings +- **Never use autostart** for Xdebug 3 or remote_autostart=1 for Xdebug 2 +- **Document trigger methods** in README and inline comments + +Example: +```dockerfile +# Configure Xdebug settings based on PHP version +# For Xdebug 3 (PHP 7.3+, 7.4, 8.x): Use trigger mode to prevent connection warnings during build +# For Xdebug 2 (older PHP): Keep autostart disabled to prevent connection warnings during build +RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ + sed -i "s/xdebug.remote_autostart=0/xdebug.start_with_request=trigger/" /usr/local/etc/php/conf.d/xdebug.ini \ +;fi +``` + +### Adding New Services + +1. Create Dockerfile in `.docker//` +2. Add service to `docker-compose.yml` +3. Add configuration options to `.env.example` +4. Document in README.md +5. Add to CI/CD if appropriate + +## Testing Requirements + +### Before Committing + +1. **Build test**: + ```bash + docker compose --env-file .env.docker build + ``` + +2. **Start test**: + ```bash + docker compose --env-file .env.docker up -d + docker compose --env-file .env.docker ps + ``` + +3. **Functionality test**: + ```bash + docker compose --env-file .env.docker exec php -v + docker compose --env-file .env.docker exec php -m | grep + ``` + +### CI/CD Integration + +- All changes trigger GitHub Actions workflows +- Tests run for PHP 8.2, 8.3, 8.4 +- Ensure builds pass before merging + +## Security Considerations + +### Xdebug in Production + +- Xdebug should NEVER be enabled in production +- Always use trigger mode, never autostart +- Document security implications + +### Secrets Management + +- Never commit `.env.docker` files - this is a local configuration file that may contain sensitive data +- Add `.env.docker` to `.gitignore` to prevent accidental commits +- Use `.env.example` as the committed template for users to copy and modify +- Use environment variables for sensitive data +- Document required secrets in `.env.example` + +### Container Security + +- Run as non-root user where possible +- Keep base images updated +- Minimize installed packages + +## Performance Optimization + +### Docker Layer Caching + +Order Dockerfile commands from least to most frequently changing: + +```dockerfile +# Good: Stable commands first +RUN apt-get update && apt-get install -yqq stable-package +COPY rarely-changed-file /dest/ +RUN frequently-changing-command +COPY frequently-changed-file /dest/ + +# Bad: Frequent changes invalidate cache for everything below +COPY frequently-changed-file /dest/ +RUN apt-get update && apt-get install -yqq stable-package +``` + +### Build Arguments + +- Use build arguments for configurability +- Cache builds with different argument values +- Document all build arguments + +## Documentation Standards + +### README Updates + +When changing functionality, update README.md: + +1. **Quick Start** - If setup process changes +2. **Configuration** - If new env vars added +3. **Troubleshooting** - If new issues arise +4. **Examples** - If new features added + +### Inline Comments + +Use comments for: +- Complex conditional logic +- Version-specific workarounds +- Security considerations +- Performance optimizations + +```dockerfile +# Good: Explains why +RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + # PHP 5 requires older version of extension + pecl install extension-2.0.0; \ +else \ + pecl install extension; \ +fi + +# Bad: States obvious +RUN pecl install extension # Install extension +``` + +## Common Pitfalls to Avoid + +### 1. Breaking Changes +- Don't change default values without considering existing users +- Maintain backward compatibility +- Version breaking changes appropriately + +### 2. Build-Time Warnings +- Always test builds completely +- Address all warnings, especially Xdebug connection warnings +- Clean build output is important + +### 3. Cross-Platform Issues +- Test on Linux, macOS, and Windows when possible +- Use cross-platform path separators +- Document platform-specific considerations + +### 4. Version Compatibility +- Don't assume latest PHP version features +- Support the full range of declared PHP versions +- Test edge cases (oldest and newest versions) + +## Git Workflow + +### Commit Messages + +Format: `: ` + +Types: +- `feat`: New feature +- `fix`: Bug fix +- `docs`: Documentation changes +- `refactor`: Code refactoring +- `test`: Test additions/changes +- `chore`: Maintenance tasks + +Examples: +``` +fix: Resolve Xdebug connection warnings during build +docs: Add Xdebug trigger mode documentation +feat: Add Redis container support +``` + +### Pull Request Template + +1. **Title**: Clear, descriptive +2. **Description**: Explain the change and why +3. **Testing**: Describe testing performed +4. **Breaking Changes**: List any breaking changes +5. **Screenshots**: For UI/output changes + +## AI Assistance Best Practices + +When using GitHub Copilot or similar tools: + +1. **Review all suggestions** - Don't blindly accept +2. **Understand the code** - Know what you're committing +3. **Test thoroughly** - AI can miss edge cases +4. **Document decisions** - Explain non-obvious choices +5. **Security first** - Verify security implications + +## Resources + +- [Laradock Documentation](https://laradock.io) +- [Docker Best Practices](https://docs.docker.com/develop/dev-best-practices/) +- [PHP Docker Images](https://hub.docker.com/_/php) +- [Dockerfile Reference](https://docs.docker.com/engine/reference/builder/) + +## Support Channels + +- GitHub Issues: Bug reports and feature requests +- GitHub Discussions: Questions and community support +- Pull Requests: Code contributions + +--- + +**Last Updated**: 2025-01-05 +**Maintainer**: InvoicePlane Team diff --git a/.github/workflows/docker-build-test.yml b/.github/workflows/docker-build-test.yml new file mode 100644 index 0000000..62e1203 --- /dev/null +++ b/.github/workflows/docker-build-test.yml @@ -0,0 +1,68 @@ +name: Docker Build Test + +on: + workflow_dispatch: + +jobs: + test-builds: + name: Test Docker Build - PHP ${{ matrix.php-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-version: ['8.2', '8.3', '8.4'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file for testing + run: | + cp .env.example .env.docker + sed -i "s/PHP_VERSION=.*/PHP_VERSION=${{ matrix.php-version }}/" .env.docker + sed -i "s/WORKSPACE_INSTALL_PYTHON3=.*/WORKSPACE_INSTALL_PYTHON3=false/" .env.docker + sed -i "s/WORKSPACE_INSTALL_WKHTMLTOPDF=.*/WORKSPACE_INSTALL_WKHTMLTOPDF=false/" .env.docker + + - name: Build workspace container + run: | + docker compose --env-file .env.docker build workspace + timeout-minutes: 30 + + - name: Build php-fpm container + run: | + docker compose --env-file .env.docker build php-fpm + timeout-minutes: 30 + + - name: Build php-worker container + run: | + docker compose --env-file .env.docker build php-worker + timeout-minutes: 30 + + - name: Start containers + run: | + docker compose --env-file .env.docker up -d workspace php-fpm + timeout-minutes: 10 + + - name: Verify PHP version in workspace + run: | + docker compose --env-file .env.docker exec -T workspace php -v + + - name: Verify zip extension in workspace + run: | + docker compose --env-file .env.docker exec -T workspace php -m | grep zip + + - name: Verify PHP version in php-fpm + run: | + docker compose --env-file .env.docker exec -T php-fpm php -v + + - name: Verify zip extension in php-fpm + run: | + docker compose --env-file .env.docker exec -T php-fpm php -m | grep zip + + - name: Cleanup + if: always() + run: | + docker compose --env-file .env.docker down -v diff --git a/.github/workflows/test-containers.yml b/.github/workflows/test-containers.yml new file mode 100644 index 0000000..8dfdd2f --- /dev/null +++ b/.github/workflows/test-containers.yml @@ -0,0 +1,342 @@ +name: Test Individual Containers + +on: + workflow_dispatch: + inputs: + container: + description: 'Specific container to test (leave empty for all)' + required: false + type: choice + options: + - '' + - beanstalkd + - beanstalkd-console + - mariadb + - nginx + - php-fpm + - php-worker + - phpmyadmin + - redis + - workspace + +jobs: + # Test workspace container individually + test-workspace: + name: Test Workspace - PHP ${{ matrix.php-version }} + runs-on: ubuntu-latest + if: ${{ !inputs.container || inputs.container == 'workspace' }} + strategy: + fail-fast: false + matrix: + php-version: ['8.2', '8.3', '8.4'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file + run: | + cp .env.example .env.docker + sed -i "s/PHP_VERSION=8.1/PHP_VERSION=${{ matrix.php-version }}/" .env.docker + sed -i "s/WORKSPACE_INSTALL_PYTHON3=true/WORKSPACE_INSTALL_PYTHON3=false/" .env.docker + sed -i "s/WORKSPACE_INSTALL_WKHTMLTOPDF=true/WORKSPACE_INSTALL_WKHTMLTOPDF=false/" .env.docker + + - name: Build workspace container + run: docker compose --env-file .env.docker build workspace + timeout-minutes: 30 + + - name: Start workspace container + run: docker compose --env-file .env.docker up -d workspace + timeout-minutes: 5 + + - name: Verify PHP version + run: docker compose --env-file .env.docker exec -T workspace php -v + + - name: Verify PHP extensions + run: | + echo "=== Checking critical PHP extensions ===" + docker compose --env-file .env.docker exec -T workspace php -m | grep -E 'zip|mbstring|curl|openssl|json|xml' + + - name: Verify Composer + run: docker compose --env-file .env.docker exec -T workspace composer --version + + - name: Verify Node.js + run: docker compose --env-file .env.docker exec -T workspace node --version + + - name: Test workspace user + run: | + docker compose --env-file .env.docker exec -T --user=ivpldock workspace whoami + docker compose --env-file .env.docker exec -T --user=ivpldock workspace id + + - name: Cleanup + if: always() + run: docker compose --env-file .env.docker down -v + + # Test php-fpm container individually + test-php-fpm: + name: Test PHP-FPM - PHP ${{ matrix.php-version }} + runs-on: ubuntu-latest + if: ${{ !inputs.container || inputs.container == 'php-fpm' }} + strategy: + fail-fast: false + matrix: + php-version: ['8.2', '8.3', '8.4'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file + run: | + cp .env.example .env.docker + sed -i "s/PHP_VERSION=8.1/PHP_VERSION=${{ matrix.php-version }}/" .env.docker + + - name: Build php-fpm container + run: docker compose --env-file .env.docker build php-fpm + timeout-minutes: 30 + + - name: Start php-fpm container + run: docker compose --env-file .env.docker up -d php-fpm + timeout-minutes: 5 + + - name: Verify PHP version + run: docker compose --env-file .env.docker exec -T php-fpm php -v + + - name: Verify PHP extensions + run: | + echo "=== Checking critical PHP extensions ===" + docker compose --env-file .env.docker exec -T php-fpm php -m | grep -E 'zip|mbstring|curl|openssl|json|xml|mysqli|pdo_mysql' + + - name: Verify PHP-FPM is running + run: docker compose --env-file .env.docker exec -T php-fpm php-fpm -t + + - name: Cleanup + if: always() + run: docker compose --env-file .env.docker down -v + + # Test php-worker container individually + test-php-worker: + name: Test PHP-Worker - PHP ${{ matrix.php-version }} + runs-on: ubuntu-latest + if: ${{ !inputs.container || inputs.container == 'php-worker' }} + strategy: + fail-fast: false + matrix: + php-version: ['8.2', '8.3', '8.4'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file + run: | + cp .env.example .env.docker + sed -i "s/PHP_VERSION=8.1/PHP_VERSION=${{ matrix.php-version }}/" .env.docker + + - name: Build php-worker container + run: docker compose --env-file .env.docker build php-worker + timeout-minutes: 30 + + - name: Start php-worker container + run: docker compose --env-file .env.docker up -d php-worker + timeout-minutes: 5 + + - name: Verify PHP version + run: docker compose --env-file .env.docker exec -T php-worker php -v + + - name: Verify PHP extensions + run: | + echo "=== Checking critical PHP extensions ===" + docker compose --env-file .env.docker exec -T php-worker php -m | grep -E 'zip|mbstring|curl|openssl|json|xml|mysqli|pdo_mysql' + + - name: Cleanup + if: always() + run: docker compose --env-file .env.docker down -v + + # Test nginx container + test-nginx: + name: Test Nginx + runs-on: ubuntu-latest + if: ${{ !inputs.container || inputs.container == 'nginx' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file + run: cp .env.example .env.docker + + - name: Build nginx container + run: docker compose --env-file .env.docker build nginx + timeout-minutes: 15 + + - name: Start nginx container + run: docker compose --env-file .env.docker up -d nginx + timeout-minutes: 5 + + - name: Verify nginx configuration + run: docker compose --env-file .env.docker exec -T nginx nginx -t + + - name: Verify nginx is running + run: docker compose --env-file .env.docker exec -T nginx nginx -v + + - name: Cleanup + if: always() + run: docker compose --env-file .env.docker down -v + + # Test mariadb container + test-mariadb: + name: Test MariaDB + runs-on: ubuntu-latest + if: ${{ !inputs.container || inputs.container == 'mariadb' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file + run: cp .env.example .env.docker + + - name: Build mariadb container + run: docker compose --env-file .env.docker build mariadb + timeout-minutes: 15 + + - name: Start mariadb container + run: docker compose --env-file .env.docker up -d mariadb + timeout-minutes: 5 + + - name: Wait for MariaDB to be ready + run: sleep 15 + + - name: Verify MariaDB version + run: docker compose --env-file .env.docker exec -T mariadb mariadb --version + + - name: Test MariaDB connection + run: | + docker compose --env-file .env.docker exec -T mariadb \ + mariadb -uroot -proot -e "SELECT 1;" + + - name: Cleanup + if: always() + run: docker compose --env-file .env.docker down -v + + # Test redis container + test-redis: + name: Test Redis + runs-on: ubuntu-latest + if: ${{ !inputs.container || inputs.container == 'redis' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file + run: cp .env.example .env.docker + + - name: Build redis container + run: docker compose --env-file .env.docker build redis + timeout-minutes: 15 + + - name: Start redis container + run: docker compose --env-file .env.docker up -d redis + timeout-minutes: 5 + + - name: Verify Redis is running + run: | + REDIS_PASSWORD=$(grep REDIS_PASSWORD .env.docker | cut -d '=' -f2) + docker compose --env-file .env.docker exec -T redis redis-cli -a "$REDIS_PASSWORD" ping + + - name: Test Redis operations + run: | + REDIS_PASSWORD=$(grep REDIS_PASSWORD .env.docker | cut -d '=' -f2) + docker compose --env-file .env.docker exec -T redis redis-cli -a "$REDIS_PASSWORD" set test_key "test_value" + docker compose --env-file .env.docker exec -T redis redis-cli -a "$REDIS_PASSWORD" get test_key + + - name: Cleanup + if: always() + run: docker compose --env-file .env.docker down -v + + # Test beanstalkd container + test-beanstalkd: + name: Test Beanstalkd + runs-on: ubuntu-latest + if: ${{ !inputs.container || inputs.container == 'beanstalkd' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file + run: cp .env.example .env.docker + + - name: Build beanstalkd container + run: docker compose --env-file .env.docker build beanstalkd + timeout-minutes: 15 + + - name: Start beanstalkd container + run: docker compose --env-file .env.docker up -d beanstalkd + timeout-minutes: 5 + + - name: Verify beanstalkd is running + run: docker ps | grep beanstalkd + + - name: Cleanup + if: always() + run: docker compose --env-file .env.docker down -v + + # Test phpmyadmin container + test-phpmyadmin: + name: Test phpMyAdmin + runs-on: ubuntu-latest + if: ${{ !inputs.container || inputs.container == 'phpmyadmin' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create .env file + run: cp .env.example .env.docker + + - name: Build phpmyadmin container + run: docker compose --env-file .env.docker build phpmyadmin + timeout-minutes: 15 + + - name: Start mariadb and phpmyadmin containers + run: docker compose --env-file .env.docker up -d mariadb phpmyadmin + timeout-minutes: 10 + + - name: Wait for services to be ready + run: sleep 20 + + - name: Verify phpMyAdmin is accessible + run: | + docker compose --env-file .env.docker exec -T phpmyadmin php -v + docker ps | grep phpmyadmin + + - name: Cleanup + if: always() + run: docker compose --env-file .env.docker down -v diff --git a/.gitignore b/.gitignore index 7ab93d4..2736aa6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /data /.env /.env.docker +/.env.test /.project .docker-sync /.docker/workspace/Dockerfile.slim diff --git a/.junie/guidelines.md b/.junie/guidelines.md new file mode 100644 index 0000000..adb3d35 --- /dev/null +++ b/.junie/guidelines.md @@ -0,0 +1,293 @@ +# InvoicePlane Docker Development Guidelines + +## Overview + +This repository provides a complete Docker-based development environment for InvoicePlane, forked from Laradock and optimized for InvoicePlane-specific needs. + +## Project Structure + +``` +InvoicePlane-Docker/ +├── .docker/ # All Dockerfile definitions +│ ├── php-fpm/ # PHP-FPM container configuration +│ ├── workspace/ # Workspace container for CLI operations +│ ├── nginx/ # Nginx web server +│ ├── mariadb/ # MariaDB database +│ └── ... # Other service containers +├── .github/ # GitHub Actions CI/CD workflows +├── sites/ # Nginx site configurations +├── *.sh # Helper scripts for common operations +├── docker-compose.yml # Main docker-compose configuration +└── .env.example # Example environment configuration +``` + +## Development Workflow + +### Initial Setup + +1. **Clone the repository** + ```bash + git clone https://github.com/InvoicePlane/InvoicePlane-Docker.git + cd InvoicePlane-Docker + ``` + +2. **Create environment file** + ```bash + cp .env.example .env.docker + ``` + +3. **Configure your environment** + - Edit `.env.docker` to set PHP version, ports, and paths + - Adjust `APP_CODE_PATH_HOST` to point to your projects directory + +4. **Build and start containers** + ```bash + ./builddmeup.sh # Build and start in background + ``` + +### Working with Containers + +#### Helper Scripts +Use the provided helper scripts for common operations: + +- **Building**: `./buildmeup.sh` (foreground) or `./builddmeup.sh` (background) +- **Starting**: `./startmeup.sh` (foreground) or `./starmeup.sh` (background) +- **Stopping**: `./down.sh` +- **Shell Access**: + - `./workmeup.sh` - Enter workspace as ivpldock user + - `./rootmeup.sh` - Enter workspace as root + - `./phpmeup.sh` - Enter php-fpm container + - `./worker.sh` - Enter php-worker container + +#### Executing Commands +Use `docker-exec.sh` to run commands in containers: +```bash +./docker-exec.sh +``` + +Examples: +```bash +# Composer operations +./docker-exec.sh workspace invoiceplane "composer install" +./docker-exec.sh workspace invoiceplane "composer update" + +# Laravel/Artisan commands +./docker-exec.sh php-fpm invoiceplane "php artisan migrate" +./docker-exec.sh workspace invoiceplane "php artisan test" + +# NPM operations +./docker-exec.sh workspace invoiceplane "npm install" +./docker-exec.sh workspace invoiceplane "npm run build" +``` + +## Code Standards + +### PHP Development + +- **PHP Version**: Support PHP 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 +- **Framework**: Built for Laravel/CodeIgniter applications +- **Extensions**: All required PHP extensions are pre-installed + +### Docker Standards + +1. **Dockerfile Changes** + - Keep changes minimal and well-documented + - Test across all supported PHP versions + - Add comments explaining complex configurations + +2. **Build Optimization** + - Leverage Docker layer caching + - Order commands from least to most frequently changing + - Use multi-stage builds where appropriate + +3. **Environment Configuration** + - Never commit `.env.docker` files + - Document all new environment variables in `.env.example` + - Use sensible defaults + +## Debugging + +### Xdebug Configuration + +Xdebug is configured in **trigger mode** to prevent connection warnings during builds. + +#### Activating Xdebug + +**For Web Requests:** +1. Install Xdebug Helper browser extension +2. Set cookie: `XDEBUG_TRIGGER=1` +3. Or add query parameter: `?XDEBUG_TRIGGER=1` + +**For CLI Commands:** +```bash +# Inside container +XDEBUG_TRIGGER=1 php artisan test + +# From host +./docker-exec.sh workspace myproject "XDEBUG_TRIGGER=1 php artisan test" +``` + +#### IDE Configuration + +**PHPStorm:** +1. Settings → PHP → Debug → Port: 9003 +2. Settings → PHP → Servers → Name: ivpldock +3. Enable "Listen for PHP Debug Connections" + +**VS Code:** +1. Install PHP Debug extension +2. Configure launch.json with port 9003 +3. Set path mappings + +### Common Issues + +#### Container Won't Start +```bash +# Check if .env.docker exists +ls -la .env.docker + +# View logs +docker compose --env-file .env.docker logs -f + +# Check running containers +docker compose --env-file .env.docker ps +``` + +#### Port Conflicts +- Check if ports are already in use: `netstat -tlnp | grep ` +- Modify ports in `.env.docker` + +#### Permission Issues +- Ensure `PUID` and `PGID` in `.env.docker` match your user +- Run: `id -u` and `id -g` to get your user/group IDs + +## Testing + +### CI/CD Pipeline + +GitHub Actions automatically test: +- PHP 8.2, 8.3, 8.4 builds +- Container startup +- PHP extension installation +- Basic functionality + +### Local Testing + +Before committing changes: + +```bash +# Test build for specific PHP version +docker compose --env-file .env.docker build workspace php-fpm + +# Start containers +docker compose --env-file .env.docker up -d + +# Verify PHP version +docker compose --env-file .env.docker exec workspace php -v + +# Run application tests +./docker-exec.sh workspace invoiceplane "php artisan test" +``` + +## Contributing + +### Pull Request Guidelines + +1. **Branch Naming**: Use descriptive names + - `feature/add-redis-support` + - `fix/xdebug-connection-warnings` + - `docs/improve-readme` + +2. **Commit Messages**: Be clear and descriptive + - Start with verb: "Add", "Fix", "Update", "Remove" + - Reference issues: "Fix #123: Resolve port conflict" + +3. **Documentation**: Update relevant docs + - README.md for user-facing changes + - .env.example for new variables + - Inline comments for complex code + +4. **Testing**: Ensure all tests pass + - Local testing before push + - CI/CD must pass + - Test across PHP versions if applicable + +### Code Review Process + +1. Automated checks must pass +2. Manual review by maintainers +3. Address feedback promptly +4. Squash commits if requested + +## Performance Optimization + +### Build Caching + +Docker automatically caches layers: +- Built images persist even after stopping containers +- Only changed layers trigger rebuilds +- Use `--no-cache` sparingly + +### Volume Performance + +**macOS/Windows:** +- Use `:cached` flag for better performance +- Consider Docker Sync for large projects + +**Linux:** +- Native performance, no special flags needed + +## Security + +### Best Practices + +1. **Secrets Management** + - Never commit sensitive data + - Use environment variables + - Rotate credentials regularly + +2. **Container Security** + - Keep base images updated + - Run as non-root user where possible + - Limit container capabilities + +3. **Network Security** + - Use internal networks for service communication + - Expose only necessary ports + - Configure firewalls appropriately + +## Maintenance + +### Regular Updates + +1. **Base Images**: Update quarterly +2. **PHP Versions**: Support latest stable releases +3. **Dependencies**: Keep composer/npm packages current + +### Cleanup + +```bash +# Remove stopped containers +docker compose --env-file .env.docker down + +# Remove volumes (WARNING: deletes data) +docker compose --env-file .env.docker down -v + +# Clean up Docker system +docker system prune -a +``` + +## Resources + +- **Laradock**: Original upstream project - [github.com/laradock/laradock](https://github.com/laradock/laradock) +- **InvoicePlane**: Main application - [github.com/InvoicePlane/InvoicePlane](https://github.com/InvoicePlane/InvoicePlane) +- **Docker Documentation**: [docs.docker.com](https://docs.docker.com) +- **PHP Docker Images**: [hub.docker.com/_/php](https://hub.docker.com/_/php) + +## Support + +For issues or questions: +1. Check existing GitHub issues +2. Review documentation thoroughly +3. Create detailed issue with reproduction steps +4. Include relevant logs and configuration diff --git a/DOCKER_COMPATIBILITY.md b/DOCKER_COMPATIBILITY.md new file mode 100644 index 0000000..25a2a29 --- /dev/null +++ b/DOCKER_COMPATIBILITY.md @@ -0,0 +1,96 @@ +# Docker Container Compatibility Check + +This document tracks potential incompatibilities found across all Docker containers. + +## Summary + +All Dockerfiles have been reviewed for potential cross-platform compatibility issues similar to the php-zip installation problem on Mac. + +## Findings by Container + +### ✅ workspace (Fixed) +**Issue:** `php${IVPLDOCK_PHP_VERSION}-zip` package not available on Mac +**Status:** FIXED with PECL fallback +**Location:** `.docker/workspace/Dockerfile:76-81` + +**Potential Similar Issues:** +The workspace Dockerfile uses several version-specific PHP packages that might not be available on all platforms: +- Line 222: `php${IVPLDOCK_PHP_VERSION}-bz2` +- Line 229: `php${IVPLDOCK_PHP_VERSION}-gmp` +- Line 235: `php${IVPLDOCK_PHP_VERSION}-gnupg` +- Line 242: `php${IVPLDOCK_PHP_VERSION}-ssh2` +- Line 249: `php${IVPLDOCK_PHP_VERSION}-soap` +- Line 256: `php${IVPLDOCK_PHP_VERSION}-xsl` +- Line 271: `php${IVPLDOCK_PHP_VERSION}-imap` +- Line 287: `php${IVPLDOCK_PHP_VERSION}-xml` +- Line 333: `php${IVPLDOCK_PHP_VERSION}-redis` + +**Recommendation:** These are conditional installs (only when INSTALL_* flags are true), so they are lower priority. If issues arise, similar PECL fallbacks can be implemented. + +### ✅ php-fpm +**Status:** NO ISSUES FOUND +**Reason:** Uses `docker-php-ext-install` and `docker-php-ext-configure` commands which are the standard, cross-platform way to install PHP extensions in official PHP Docker images. +**Location:** `.docker/php-fpm/Dockerfile` + +### ✅ php-worker +**Status:** NO ISSUES FOUND +**Reason:** Uses `docker-php-ext-install` and `docker-php-ext-configure` commands for extension management. +**Location:** `.docker/php-worker/Dockerfile` + +### ✅ laravel-horizon +**Status:** NO ISSUES FOUND +**Reason:** Uses `docker-php-ext-install` and `docker-php-ext-configure` commands. +**Location:** `.docker/laravel-horizon/Dockerfile` + +### ✅ nginx +**Status:** NO ISSUES FOUND +**Reason:** Standard nginx image, no custom PHP compilation. +**Location:** `.docker/nginx/Dockerfile` + +### ✅ mariadb +**Status:** NO ISSUES FOUND +**Reason:** Standard MariaDB image, no custom compilation. +**Location:** `.docker/mariadb/Dockerfile` + +### ✅ redis +**Status:** NO ISSUES FOUND +**Reason:** Standard Redis image. +**Location:** `.docker/redis/Dockerfile` + +### ✅ beanstalkd +**Status:** NO ISSUES FOUND +**Reason:** Standard beanstalkd image. +**Location:** `.docker/beanstalkd/Dockerfile` + +### ✅ beanstalkd-console +**Status:** NO ISSUES FOUND +**Reason:** Simple PHP application, no complex dependencies. +**Location:** `.docker/beanstalkd-console/Dockerfile` + +### ✅ phpmyadmin +**Status:** NO ISSUES FOUND +**Reason:** Official phpMyAdmin image. +**Location:** `.docker/phpmyadmin/Dockerfile` + +## Testing Coverage + +### Automated CI/CD Testing +All containers are now tested individually in CI/CD: +- `docker-build-test.yml` - Tests workspace, php-fpm, php-worker together +- `test-individual-containers.yml` - Tests each container separately with detailed checks + +### Manual Testing Recommendations +1. Test on both Mac (ARM64 and Intel) and Linux platforms +2. Test with PHP versions 8.2, 8.3, and 8.4 +3. Test with various optional extensions enabled + +## Future Improvements + +If issues arise with conditional PHP extensions in workspace: +1. Implement PECL fallbacks similar to the zip extension fix +2. Add specific CI tests for optional extensions +3. Document known platform limitations + +## Conclusion + +The critical issue (php-zip on Mac) has been fixed. Other containers use standard, cross-platform methods. The workspace container has potential similar issues with optional extensions, but these are rarely used and can be addressed if problems occur. diff --git a/README.md b/README.md index 92c2758..e27584b 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,737 @@ # InvoicePlane Docker -Docker-compose with a webserver, MySQL, phpmyadmin and redis -- docker-compose.yml -- .env +> **Complete Docker-based development environment for InvoicePlane** -## Building -Normally you build images to containers with the following command: +A containerized development stack featuring PHP, Nginx, MariaDB, Redis, and more. Built on Laradock and optimized for InvoicePlane development with support for PHP 7.4 through 8.4. -`docker-compose up nginx mysql php-fpm phpmyadmin redis workspace --build -d` +## 🚀 Quick Start -We've simplified this for you with a bash script: -`./buildmeup.sh` will build the containers for you (on Linux and on Mac) +1. **Clone the repository** + ```bash + git clone https://github.com/InvoicePlane/InvoicePlane-Docker.git + cd InvoicePlane-Docker + ``` -## Starting -Normally you start containers with the following command: +2. **Create your environment file** + ```bash + cp .env.example .env.docker + ``` -`docker-compose up nginx mysql php-fpm phpmyadmin redis workspace -d` +3. **Configure your setup** (optional) + ```bash + # Edit .env.docker to customize: + # - PHP version (8.1, 8.2, 8.3, 8.4) + # - Database settings + # - Port mappings + nano .env.docker + ``` -We've simplified this for you with a bash script: +4. **Build and start containers** + ```bash + ./builddmeup.sh + ``` -`./startmeup.sh` will start the containers for you (on Linux and on Mac) +5. **Verify installation** + ```bash + docker compose --env-file .env.docker ps + ``` -## Getting inside a container -Normally you get into a container with the following command: +Your development environment is now ready! 🎉 -`docker-compose exec --user=ivpldock workspace bash` +## 📖 Setting Up Your First Project (InvoicePlane) -We've simplified this for you with a bash script: -`./workmeup.sh` will get you inside a container (on Linux and on Mac) +This guide will walk you through setting up InvoicePlane v1 step by step. -## Directories +### Step 1: Prepare Your Project Directory -| Directory | Purpose | -|---------- |:--------------------------------------------------------------: | -| ./.docker | for all the DockerFiles | | -| ./sites | for all the sites (for the nginx webserver) | +First, make sure your projects directory exists. By default, this is `~/projects`: -### Origins -This script was originally called Laradock. We've forked it to target just the specific images that are needed to run InvoicePlane. +```bash +# Create the projects directory if it doesn't exist +mkdir -p ~/projects -Link to Laradock: [laradock](https://github.com/laradock/laradock/) -We've included their license file in this repository. +# Clone InvoicePlane v1 into your projects directory +cd ~/projects +git clone https://github.com/InvoicePlane/InvoicePlane.git ivplv1 +cd ivplv1 +``` + +> 💡 **Note**: The folder name `ivplv1` will be used in the next steps. You can choose any name you like, but remember to use it consistently. + +### Step 2: Configure Your Environment + +Open your `.env.docker` file in the InvoicePlane-Docker directory: + +```bash +cd /path/to/InvoicePlane-Docker +nano .env.docker +``` + +Find the line that says `APP_CODE_PATH_HOST` and make sure it points to your projects directory: + +```bash +# This should match where you created your projects folder +APP_CODE_PATH_HOST=~/projects/ +``` + +> 💡 **Tip**: If you used a different path for your projects, update this line accordingly. For example, if your projects are in `/home/username/myprojects/`, use that path instead. + +### Step 3: Create Your Nginx Configuration + +Now we'll tell Nginx how to serve your InvoicePlane project: + +1. **Copy the example configuration:** + ```bash + cd /path/to/InvoicePlane-Docker + cp sites/copyme.conf.example sites/ivplv1.conf + ``` + +2. **Open the configuration file:** + ```bash + nano sites/ivplv1.conf + ``` + +3. **Replace all instances of `copyme` with `ivplv1`** and **remove `/public` from the root path** (there are 4 places to change): + - Line 5: `server_name copyme.local;` → `server_name ivplv1.test;` + - Line 6: `root /var/www/projects/copyme/public;` → `root /var/www/projects/ivplv1;` *(also remove /public)* + - Line 34: `error_log /var/log/nginx/copyme_error.log;` → `error_log /var/log/nginx/ivplv1_error.log;` + - Line 35: `access_log /var/log/nginx/copyme_access.log;` → `access_log /var/log/nginx/ivplv1_access.log;` + + > 💡 **Why remove `/public`?** InvoicePlane v1 doesn't use a public directory like some frameworks. The main files are in the root of the project. + + > 💡 **Why use `.test` instead of `.local`?** The `.test` domain is reserved for testing and won't conflict with real domains. You can use `.local` if you prefer, just be consistent. + +4. **Save and close the file** (in nano: press `Ctrl+X`, then `Y`, then `Enter`) + +### Step 4: Add Domain to Your Hosts File + +Tell your computer that `ivplv1.test` should point to your local Docker environment: + +**On Linux/Mac:** +```bash +sudo nano /etc/hosts +``` + +**On Windows:** +Open Notepad as Administrator, then open: +``` +C:\Windows\System32\drivers\etc\hosts +``` + +Add this line: +``` +127.0.0.1 ivplv1.test +``` + +Save and close the file. + +### Step 5: Start Docker + +Now start your Docker environment: + +```bash +cd /path/to/InvoicePlane-Docker +./starmeup.sh +``` + +> 💡 **What's happening?** Docker is: +> - Building the containers (first time takes 5-10 minutes) +> - Starting PHP, Nginx, MariaDB, and other services +> - Reading your `ivplv1.conf` file to know how to serve your project +> - Making your project available at `http://ivplv1.test` + +You'll see lots of output in your terminal. This is normal! Look for messages saying containers are starting. + +### Step 6: Verify Everything is Running + +In a new terminal window (keep Docker running in the first one): + +```bash +cd /path/to/InvoicePlane-Docker +docker compose --env-file .env.docker ps +``` + +You should see all services with "Up" status: +``` +NAME STATUS +workspace Up +php-fpm Up +nginx Up +mariadb Up +redis Up +``` + +### Step 7: Access Your Project + +Open your web browser and go to: +``` +http://ivplv1.test +``` + +You should see your InvoicePlane installation! 🎉 + +### Step 8: Stop Docker When Done + +When you're finished working, stop Docker: + +**Option 1: Stop from terminal** (if Docker is running in foreground) +- Press `Ctrl+C` in the terminal where Docker is running + +**Option 2: Stop and remove everything** +```bash +./down.sh +``` + +This stops all containers and removes them (but keeps your code safe). + +### Step 9: Restart Docker Later + +When you want to work again, just run: +```bash +./starmeup.sh +``` + +This is much faster than the first build! ⚡ + +--- + +### 🆘 Troubleshooting + +**Problem**: Can't access `http://ivplv1.test` +- **Solution**: Make sure you added `127.0.0.1 ivplv1.test` to your hosts file +- **Solution**: Make sure Docker is running (`docker compose ps`) +- **Solution**: Try `http://localhost` instead + +**Problem**: "Port already in use" +- **Solution**: Another service is using port 80. Either stop it, or change the port in `.env.docker`: + ```bash + NGINX_HOST_HTTP_PORT=8080 + ``` + Then **restart Docker** for the change to take effect: + ```bash + ./down.sh + ./starmeup.sh + ``` + Access your site at `http://ivplv1.test:8080` + +**Problem**: "Permission denied" errors +- **Solution**: Check your `PUID` and `PGID` in `.env.docker` match your user: + ```bash + id -u # This is your PUID + id -g # This is your PGID + ``` + +**Problem**: Changes to nginx config not working +- **Solution**: Restart Docker to reload the configuration: + ```bash + ./down.sh + ./starmeup.sh + ``` + +## 📦 What's Included + +### Services +- **PHP-FPM** - PHP 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 (configurable) +- **Workspace** - CLI tools, Composer, Node.js, Git +- **Nginx** - Web server with optimized configuration +- **MariaDB** - Database server +- **Redis** - Caching and session storage +- **Beanstalkd** - Queue management +- **phpMyAdmin** - Database management interface +- **Redis Web UI** - Redis monitoring interface + +### Features +- ✅ Multiple PHP versions support +- ✅ Xdebug with trigger mode +- ✅ Pre-configured for Laravel and CodeIgniter +- ✅ Helper scripts for common tasks +- ✅ GitHub Actions CI/CD +- ✅ Optimized Docker layer caching + +## 🛠️ Helper Scripts + +All scripts include error handling and validation to ensure a smooth experience. + +### 🔨 Building + +**Build and start containers:** +| Script | Mode | Description | +|--------|------|-------------| +| `./buildmeup.sh` | Foreground | Build and start with live logs | +| `./builddmeup.sh` | Background | Build and start in detached mode | + +### ▶️ Starting/Stopping + +**Control existing containers:** +| Script | Mode | Description | +|--------|------|-------------| +| `./starmeup.sh` | Foreground | Start with live logs | +| `./startmeup.sh` | Background | Start in detached mode | +| `./down.sh` | - | Stop and remove all containers and volumes | + +### 🖥️ Accessing Containers + +**Enter a running container:** +| Script | Container | User | Use Case | +|--------|-----------|------|----------| +| `./workmeup.sh` | workspace | ivpldock | Development tasks, Composer, NPM | +| `./rootmeup.sh` | workspace | root | System administration | +| `./phpmeup.sh` | php-fpm | root | PHP-FPM debugging | +| `./worker.sh` | php-worker | root | Queue worker debugging | + +### 🚀 Running Commands + +Execute commands inside containers from your host using `docker-exec.sh`: + +**Syntax:** +```bash +./docker-exec.sh +``` + +**Common Examples:** + +```bash +# 📦 Composer Operations +./docker-exec.sh workspace myproject "composer install" +./docker-exec.sh workspace myproject "composer update" +./docker-exec.sh workspace myproject "composer require vendor/package" + +# 🎨 Laravel/Artisan Commands +./docker-exec.sh php-fpm invoiceplane "php artisan migrate" +./docker-exec.sh php-fpm invoiceplane "php artisan migrate --force" +./docker-exec.sh workspace invoiceplane "php artisan test" +./docker-exec.sh workspace invoiceplane "php artisan db:seed" + +# 📊 Database Operations +./docker-exec.sh workspace invoiceplane "php artisan migrate:fresh --seed" +./docker-exec.sh workspace invoiceplane "php artisan migrate:rollback" + +# 🔧 NPM Operations +./docker-exec.sh workspace myapp "npm install" +./docker-exec.sh workspace myapp "npm run build" +./docker-exec.sh workspace myapp "npm run dev" +./docker-exec.sh workspace myapp "npm run watch" + +# 🧪 Testing +./docker-exec.sh workspace myproject "php artisan test" +./docker-exec.sh workspace myproject "vendor/bin/phpunit" +./docker-exec.sh workspace myproject "php artisan test --filter UserTest" +``` + +## 🔄 Continuous Integration + +This repository includes automated GitHub Actions workflows that test Docker builds. + +**Tested PHP Versions:** +- ✅ PHP 8.2 +- ✅ PHP 8.3 +- ✅ PHP 8.4 + +**CI Pipeline Verifies:** +- ✅ All containers build successfully +- ✅ PHP extensions are properly installed (zip, etc.) +- ✅ Services start correctly +- ✅ Basic functionality works + +**Workflow Triggers:** +- Push to main branches +- Pull requests +- Manual dispatch + +## 📁 Directory Structure + +| Directory | Purpose | +|-----------|---------| +| `.docker/` | All Dockerfile definitions for services | +| `sites/` | Nginx site configurations | +| `.github/workflows/` | GitHub Actions CI/CD pipelines | +| `*.sh` | Helper scripts for common operations | + +## ⚙️ Configuration + +### Basic Setup + +Edit `.env.docker` to customize your environment: + +**Core Settings:** +```bash +# PHP Version +PHP_VERSION=8.4 # Options: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 + +# Project Path +APP_CODE_PATH_HOST=../projects/ + +# Database +MARIADB_VERSION=latest +MARIADB_DATABASE=default +MARIADB_USER=default +MARIADB_PASSWORD=secret + +# Ports +NGINX_HOST_HTTP_PORT=80 +MARIADB_PORT=3306 +REDIS_PORT=6379 +``` + +### 🐳 Docker Build Caching + +Docker automatically caches build layers to speed up subsequent builds. + +**How It Works:** +1. Docker Compose checks if dependent services need building +2. Uses cached layers if Dockerfile and context haven't changed +3. Only rebuilds layers that have changed + +**Benefits:** +- ⚡ Faster rebuild times +- 💾 Efficient resource usage +- 🔄 Smart dependency management + +**Tips for Better Caching:** +```bash +# Docker keeps built images in cache even after stopping containers +docker compose --env-file .env.docker ps + +# Force complete rebuild only when necessary +docker compose --env-file .env.docker build --no-cache php-fpm + +# Build specific service +docker compose --env-file .env.docker build workspace + +# Parallel builds for multiple services +docker compose --env-file .env.docker build --parallel +``` + +**Example Workflow:** +```bash +# First build (takes longer) +docker compose --env-file .env.docker build php-fpm +# ⏱️ 5 minutes + +# Build dependent service (uses cache) +docker compose --env-file .env.docker build beanstalkd +# ⏱️ 30 seconds (php-fpm cached!) +``` + +### 🐛 Xdebug Configuration + +Xdebug is configured in **trigger mode** to prevent connection warnings during builds while maintaining full debugging capability. + +#### Activation Methods + +**1️⃣ Browser Debugging (Web Requests)** + +Using Browser Extension: +- Install [Xdebug Helper](https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc) for Chrome +- Or [Xdebug Helper](https://addons.mozilla.org/en-US/firefox/addon/xdebug-helper-for-firefox/) for Firefox +- Click the extension icon to enable debugging + +Using Query Parameter: +``` +http://your-app.local?XDEBUG_TRIGGER=1 +``` + +Using Cookie: +```javascript +document.cookie = "XDEBUG_TRIGGER=1; path=/"; +``` + +**2️⃣ CLI Debugging (Command Line)** + +Inside Container: +```bash +# Enter workspace +./workmeup.sh + +# Run with Xdebug +XDEBUG_TRIGGER=1 php artisan test +XDEBUG_TRIGGER=1 php script.php +XDEBUG_TRIGGER=1 vendor/bin/phpunit +``` + +From Host: +```bash +# Single command with Xdebug +./docker-exec.sh workspace myproject "XDEBUG_TRIGGER=1 php artisan test" + +# Composer with Xdebug +./docker-exec.sh workspace myproject "XDEBUG_TRIGGER=1 composer install" +``` + +**3️⃣ Persistent Debugging (Environment Variable)** + +```bash +# Inside container +export XDEBUG_TRIGGER=1 +php artisan test # Now always uses Xdebug +``` + +#### IDE Configuration + +**PHPStorm Setup:** +1. Go to `Settings → PHP → Debug` +2. Set port to `9003` +3. Go to `Settings → PHP → Servers` +4. Add server named `ivpldock` +5. Set path mappings: + - Local: `/path/to/your/project` + - Remote: `/var/www/projects/yourproject` +6. Click "Start Listening for PHP Debug Connections" (phone icon) + +**VS Code Setup:** +1. Install [PHP Debug extension](https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug) +2. Create `.vscode/launch.json`: + ```json + { + "version": "0.2.0", + "configurations": [ + { + "name": "Listen for Xdebug", + "type": "php", + "request": "launch", + "port": 9003, + "pathMappings": { + "/var/www/projects/yourproject": "${workspaceFolder}" + } + } + ] + } + ``` +3. Press F5 to start debugging + +#### Configuration Files + +```bash +# Xdebug settings locations +.docker/php-fpm/xdebug.ini # PHP-FPM container +.docker/workspace/xdebug.ini # Workspace container +``` + +**Default Port:** 9003 (configurable in `.env.docker`) + +#### Troubleshooting Xdebug + +```bash +# Verify Xdebug is installed +docker compose --env-file .env.docker exec workspace php -v +# Should show: "with Xdebug v3.x.x" + +# Check Xdebug configuration +docker compose --env-file .env.docker exec workspace php -i | grep xdebug + +# Test Xdebug trigger +docker compose --env-file .env.docker exec workspace bash -c "XDEBUG_TRIGGER=1 php -v" + +# View Xdebug logs +docker compose --env-file .env.docker exec workspace cat /tmp/xdebug.log +``` + +## 🔧 Troubleshooting + +### Common Issues + +#### ❌ Container Won't Start + +**Check environment file exists:** +```bash +ls -la .env.docker +``` + +**View detailed logs:** +```bash +docker compose --env-file .env.docker logs -f +# Examples: +docker compose --env-file .env.docker logs -f workspace +docker compose --env-file .env.docker logs -f php-fpm +``` + +**Check container status:** +```bash +docker compose --env-file .env.docker ps +docker compose --env-file .env.docker ps -a # Include stopped containers +``` + +#### 🔌 Port Already in Use + +**Check what's using the port:** +```bash +# Linux/Mac +sudo lsof -i :80 +sudo lsof -i :3306 + +# Or use netstat +netstat -tlnp | grep :80 +``` + +**Solution: Change port in `.env.docker`:** +```bash +NGINX_HOST_HTTP_PORT=8080 # Instead of 80 +MARIADB_PORT=3307 # Instead of 3306 +``` + +#### 🔐 Permission Denied Errors + +**Check and fix PUID/PGID:** +```bash +# Get your user and group ID +id -u # Your user ID +id -g # Your group ID + +# Update .env.docker +WORKSPACE_PUID=1000 # Your user ID +WORKSPACE_PGID=1000 # Your group ID +PHP_FPM_PUID=1000 +PHP_FPM_PGID=1000 + +# Rebuild containers +docker compose --env-file .env.docker build workspace php-fpm +docker compose --env-file .env.docker up -d +``` + +#### 🐌 Slow Performance (macOS/Windows) + +**Use cached volume flag:** +```bash +# In .env.docker +APP_CODE_CONTAINER_FLAG=:cached +``` + +**Consider Docker Sync for large projects:** +- Significant performance improvement +- See [docker-sync documentation](https://docker-sync.readthedocs.io/) + +#### 🗄️ Database Connection Failed + +**Verify database is running:** +```bash +docker compose --env-file .env.docker ps mariadb +``` + +**Check database credentials:** +```bash +# In .env.docker +MARIADB_DATABASE=default +MARIADB_USER=default +MARIADB_PASSWORD=secret + +# In your app's .env +DB_HOST=mariadb # Not localhost! +DB_PORT=3306 +DB_DATABASE=default +DB_USERNAME=default +DB_PASSWORD=secret +``` + +**Test connection:** +```bash +docker compose --env-file .env.docker exec workspace mysql -h mariadb -u default -psecret +``` + +#### 🧹 Clean Up Issues + +**Remove all containers and volumes:** +```bash +# WARNING: This deletes all data! +docker compose --env-file .env.docker down -v +``` + +**Full Docker cleanup:** +```bash +# Remove unused containers, networks, images +docker system prune -a + +# Remove all volumes (BE CAREFUL!) +docker volume prune +``` + +#### 📦 Build Failures + +**Clear build cache and rebuild:** +```bash +docker compose --env-file .env.docker build --no-cache --pull +``` + +**Check Docker disk space:** +```bash +docker system df +``` + +### Getting Help + +**Collect diagnostic information:** +```bash +# Docker version +docker --version +docker compose version + +# Container status +docker compose --env-file .env.docker ps + +# Recent logs +docker compose --env-file .env.docker logs --tail=50 workspace php-fpm + +# System info +docker info +``` + +**When reporting issues, include:** +1. Steps to reproduce +2. Error messages (full output) +3. Docker and compose versions +4. Operating system +5. Relevant configuration from `.env.docker` + +## 📚 Additional Resources + +### Documentation +- **Project Guidelines**: [.junie/guidelines.md](.junie/guidelines.md) - Comprehensive development guidelines +- **Copilot Instructions**: [.github/copilot-instructions.md](.github/copilot-instructions.md) - AI coding assistant guidelines +- **Docker Compatibility**: [DOCKER_COMPATIBILITY.md](DOCKER_COMPATIBILITY.md) - Version compatibility matrix + +### External Links +- **Laradock**: Original upstream project - [github.com/laradock/laradock](https://github.com/laradock/laradock) +- **InvoicePlane**: Main application - [github.com/InvoicePlane/InvoicePlane](https://github.com/InvoicePlane/InvoicePlane) +- **Docker Documentation**: [docs.docker.com](https://docs.docker.com) +- **Docker Compose Documentation**: [docs.docker.com/compose](https://docs.docker.com/compose) + +### Community & Support +- **Issues**: [GitHub Issues](https://github.com/InvoicePlane/InvoicePlane-Docker/issues) - Report bugs and request features +- **Discussions**: [GitHub Discussions](https://github.com/InvoicePlane/InvoicePlane-Docker/discussions) - Ask questions and share ideas +- **Pull Requests**: [Contributing Guidelines](.junie/guidelines.md#contributing) - Submit code improvements + +## 🤝 Contributing + +We welcome contributions! Please see our [development guidelines](.junie/guidelines.md) for: +- Code standards +- Testing requirements +- Pull request process +- Docker best practices + +### Quick Contribution Guide + +1. Fork the repository +2. Create a feature branch: `git checkout -b feature/amazing-feature` +3. Make your changes +4. Test thoroughly across PHP versions +5. Commit your changes: `git commit -m 'Add amazing feature'` +6. Push to branch: `git push origin feature/amazing-feature` +7. Open a Pull Request + +## 📝 License + +This project inherits its license from Laradock. See [LICENSE](LICENSE) for details. + +## 🙏 Origins & Credits + +This project was originally called **Laradock** and has been forked to target specifically the images needed to run InvoicePlane. + +- **Laradock**: [github.com/laradock/laradock](https://github.com/laradock/laradock/) +- **License**: Original license file included in this repository + +--- + +**Version**: 2.0 +**Last Updated**: 2025-01-05 +**Maintained by**: [InvoicePlane Team](https://github.com/InvoicePlane) + +> **Note**: Helper scripts use `docker-compose` for backward compatibility, but `docker compose` (v2) is recommended for manual commands. diff --git a/builddmeup.sh b/builddmeup.sh index fcd2cac..6b1123e 100755 --- a/builddmeup.sh +++ b/builddmeup.sh @@ -1,3 +1,27 @@ #!/bin/bash -docker-compose --env-file .env.docker up beanstalkd beanstalkd-console mariadb nginx php-fpm php-worker phpmyadmin workspace --build -d +set -euo pipefail +# Build and start all services with docker-compose in detached mode +# This script will build images and start containers in the background + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +echo "Building and starting services in detached mode..." +docker-compose --env-file .env.docker up \ + beanstalkd \ + beanstalkd-console \ + mariadb \ + nginx \ + php-fpm \ + php-worker \ + phpmyadmin \ + workspace \ + --build -d + +echo "Services started successfully in the background." +echo "Use 'docker-compose --env-file .env.docker ps' to see running containers." diff --git a/buildmeup.sh b/buildmeup.sh index 3eefc14..89362ef 100755 --- a/buildmeup.sh +++ b/buildmeup.sh @@ -1,2 +1,27 @@ #!/bin/bash -docker-compose --env-file .env.docker up beanstalkd beanstalkd-console mariadb nginx php-fpm php-worker phpmyadmin redis workspace --build +set -euo pipefail + +# Build and start all services with docker-compose +# This script will build images and start containers in foreground mode + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +echo "Building and starting services..." +docker-compose --env-file .env.docker up \ + beanstalkd \ + beanstalkd-console \ + mariadb \ + nginx \ + php-fpm \ + php-worker \ + phpmyadmin \ + redis \ + workspace \ + --build + +echo "Services stopped." diff --git a/docker-compose.yml b/docker-compose.yml index 6efa875..6bc8a84 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,8 @@ services: ### Workspace Utilities ################################## workspace: build: - context: ./.docker/workspace + context: ./.docker + dockerfile: workspace/Dockerfile args: - CHANGE_SOURCE=${CHANGE_SOURCE} - SHELL_OH_MY_ZSH=${SHELL_OH_MY_ZSH} @@ -148,7 +149,6 @@ services: volumes: - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG} - docker-in-docker:/certs/client - - /data/tenants:/tenants - ./.docker/php-worker/supervisord.d:/etc/supervisord.d extra_hosts: - "host.docker.internal:host-gateway" @@ -175,7 +175,8 @@ services: ### PHP-FPM ############################################## php-fpm: build: - context: ./.docker/php-fpm + context: ./.docker + dockerfile: php-fpm/Dockerfile args: - CHANGE_SOURCE=${CHANGE_SOURCE} - BASE_IMAGE_TAG_PREFIX=${PHP_FPM_BASE_IMAGE_TAG_PREFIX} @@ -288,7 +289,8 @@ services: ### PHP Worker ############################################ php-worker: build: - context: ./.docker/php-worker + context: ./.docker + dockerfile: php-worker/Dockerfile args: - CHANGE_SOURCE=${CHANGE_SOURCE} - IVPLDOCK_PHP_VERSION=${PHP_VERSION} @@ -346,7 +348,8 @@ services: ### NGINX Server ######################################### nginx: build: - context: ./.docker/nginx + context: ./.docker + dockerfile: nginx/Dockerfile args: - CHANGE_SOURCE=${CHANGE_SOURCE} - PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER} @@ -372,7 +375,8 @@ services: ### MariaDB ############################################## mariadb: build: - context: ./.docker/mariadb + context: ./.docker + dockerfile: mariadb/Dockerfile args: - http_proxy - https_proxy @@ -394,7 +398,9 @@ services: ### Redis ################################################ redis: - build: ./.docker/redis + build: + context: ./.docker + dockerfile: redis/Dockerfile volumes: - ${DATA_PATH_HOST}/redis:/data command: --requirepass ${REDIS_PASSWORD} @@ -405,7 +411,9 @@ services: ### Beanstalkd ########################################### beanstalkd: - build: ./.docker/beanstalkd + build: + context: ./.docker + dockerfile: beanstalkd/Dockerfile ports: - "${BEANSTALKD_HOST_PORT}:11300" privileged: true @@ -416,7 +424,9 @@ services: ### Beanstalkd Console ################################### beanstalkd-console: - build: ./.docker/beanstalkd-console + build: + context: ./.docker + dockerfile: beanstalkd-console/Dockerfile ports: - "${BEANSTALKD_CONSOLE_HOST_PORT}:2080" depends_on: @@ -426,7 +436,9 @@ services: ### phpMyAdmin ########################################### phpmyadmin: - build: ./.docker/phpmyadmin + build: + context: ./.docker + dockerfile: phpmyadmin/Dockerfile volumes: - ./.docker/phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php - ./resources/databases:/var/www/html/tmp/ivpldock_databases @@ -449,7 +461,8 @@ services: ### REDISWEBUI ################################################ redis-webui: build: - context: ./.docker/redis-webui + context: ./.docker + dockerfile: redis-webui/Dockerfile environment: - ADMIN_USER=${REDIS_WEBUI_USERNAME} - ADMIN_PASS=${REDIS_WEBUI_PASSWORD} @@ -465,7 +478,9 @@ services: ### SWAGGER EDITOR ############################################ swagger-editor: - build: ./.docker/swagger-editor + build: + context: ./.docker + dockerfile: swagger-editor/Dockerfile ports: - ${SWAGGER_EDITOR_PORT}:8080 networks: @@ -473,7 +488,9 @@ services: ### SWAGGER UI ################################################ swagger-ui: - build: ./.docker/swagger-ui + build: + context: ./.docker + dockerfile: swagger-ui/Dockerfile environment: - API_URL=${SWAGGER_API_URL} ports: diff --git a/docker-exec.sh b/docker-exec.sh new file mode 100755 index 0000000..61fcaa7 --- /dev/null +++ b/docker-exec.sh @@ -0,0 +1,94 @@ +#!/bin/bash +set -euo pipefail + +# Helper script to run commands inside Docker containers from the command line +# Usage: ./docker-exec.sh +# Example: ./docker-exec.sh workspace myproject "composer install" +# Example: ./docker-exec.sh php-fpm invoiceplane "php artisan migrate --force" + +show_usage() { + echo "Usage: $0 " + echo "" + echo "Available containers:" + echo " - workspace : Main workspace container" + echo " - php-fpm : PHP-FPM container" + echo " - php-worker : PHP worker container" + echo " - nginx : Nginx web server" + echo " - mariadb : MariaDB database" + echo "" + echo "Examples:" + echo " $0 workspace myproject 'composer install'" + echo " $0 php-fpm invoiceplane 'php artisan migrate --force'" + echo " $0 workspace myapp 'npm run build'" + echo " $0 workspace myproject 'php artisan test --filter=UserTest'" + echo "" + exit 1 +} + +# Check arguments +if [ $# -lt 3 ]; then + echo "Error: Missing required arguments!" + echo "" + show_usage +fi + +CONTAINER_NAME="$1" +PROJECT_DIR="$2" +COMMAND="$3" + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +# Get the container ID +CONTAINER_ID=$(docker ps -aqf "name=${CONTAINER_NAME}") + +if [ -z "$CONTAINER_ID" ]; then + echo "Error: Container '${CONTAINER_NAME}' is not running!" + echo "Start it with: ./startmeup.sh or ./buildmeup.sh" + echo "" + echo "Available running containers:" + docker ps --format "table {{.Names}}\t{{.Status}}" + exit 1 +fi + +# Check if project directory exists in container +if ! docker exec "$CONTAINER_ID" test -d "/var/www/projects/${PROJECT_DIR}"; then + echo "Warning: Project directory '/var/www/projects/${PROJECT_DIR}' does not exist in container!" + echo "Available projects in /var/www/projects:" + docker exec "$CONTAINER_ID" ls -1 /var/www/projects/ 2>/dev/null || echo " (directory is empty or not accessible)" + echo "" + read -p "Continue anyway? (y/N) " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + +echo "Running command in ${CONTAINER_NAME} container..." +echo "Project: /var/www/projects/${PROJECT_DIR}" +echo "Command: ${COMMAND}" +echo "----------------------------------------" + +# Temporarily disable errexit to capture exit code +set +e + +# Execute the command in the container +docker exec -it "$CONTAINER_ID" bash -c "cd /var/www/projects/${PROJECT_DIR} && ${COMMAND}" + +EXIT_CODE=$? + +# Re-enable errexit +set -e + +if [ $EXIT_CODE -eq 0 ]; then + echo "----------------------------------------" + echo "Command completed successfully." +else + echo "----------------------------------------" + echo "Command failed with exit code: $EXIT_CODE" + exit $EXIT_CODE +fi diff --git a/down.sh b/down.sh index 5314fa2..cc02790 100755 --- a/down.sh +++ b/down.sh @@ -1,2 +1,17 @@ #!/bin/bash +set -euo pipefail + +# Stop and remove all containers, networks, and volumes +# Warning: This will remove all data in volumes! + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +echo "Stopping and removing all containers, networks, and volumes..." docker-compose --env-file .env.docker down -v + +echo "All services stopped and cleaned up." diff --git a/phpmeup.sh b/phpmeup.sh index 8d6d4dd..bf6c902 100755 --- a/phpmeup.sh +++ b/phpmeup.sh @@ -1,2 +1,23 @@ #!/bin/bash -docker exec --env-file=.env.docker -it $(docker ps -aqf "name=php-fpm") bash +set -euo pipefail + +# Enter the php-fpm container with bash shell + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +# Get the container ID +CONTAINER_ID=$(docker ps -aqf "name=php-fpm") + +if [ -z "$CONTAINER_ID" ]; then + echo "Error: php-fpm container is not running!" + echo "Start it with: ./startmeup.sh or ./buildmeup.sh" + exit 1 +fi + +echo "Entering php-fpm container..." +docker exec --env-file=.env.docker -it "$CONTAINER_ID" bash diff --git a/rootmeup.sh b/rootmeup.sh index 87ffe36..46dbdc6 100755 --- a/rootmeup.sh +++ b/rootmeup.sh @@ -1,2 +1,23 @@ #!/bin/bash -docker exec --env-file .env.docker -it $(docker ps -aqf "name=workspace") bash +set -euo pipefail + +# Enter the workspace container with bash shell as root user + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +# Get the container ID +CONTAINER_ID=$(docker ps -aqf "name=workspace") + +if [ -z "$CONTAINER_ID" ]; then + echo "Error: workspace container is not running!" + echo "Start it with: ./startmeup.sh or ./buildmeup.sh" + exit 1 +fi + +echo "Entering workspace container as root..." +docker exec --env-file .env.docker -it "$CONTAINER_ID" bash diff --git a/starmeup.sh b/starmeup.sh index be4f9d5..9cd117d 100755 --- a/starmeup.sh +++ b/starmeup.sh @@ -1,2 +1,26 @@ #!/bin/bash -docker-compose --env-file .env.docker up beanstalkd beanstalkd-console mariadb nginx php-fpm php-worker phpmyadmin redis workspace +set -euo pipefail + +# Start all services with docker-compose (without building) +# This script will start containers in foreground mode + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +echo "Starting services..." +docker-compose --env-file .env.docker up \ + beanstalkd \ + beanstalkd-console \ + mariadb \ + nginx \ + php-fpm \ + php-worker \ + phpmyadmin \ + redis \ + workspace + +echo "Services stopped." diff --git a/startmeup.sh b/startmeup.sh index a61dba4..bf2b40f 100755 --- a/startmeup.sh +++ b/startmeup.sh @@ -1,2 +1,28 @@ #!/bin/bash -docker-compose --env-file .env.docker up beanstalkd beanstalkd-console mariadb nginx php-fpm php-worker phpmyadmin redis workspace -d +set -euo pipefail + +# Start all services with docker-compose in detached mode (without building) +# This script will start containers in the background + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +echo "Starting services in detached mode..." +docker-compose --env-file .env.docker up \ + beanstalkd \ + beanstalkd-console \ + mariadb \ + nginx \ + php-fpm \ + php-worker \ + phpmyadmin \ + redis \ + workspace \ + -d + +echo "Services started successfully in the background." +echo "Use 'docker-compose --env-file .env.docker ps' to see running containers." diff --git a/worker.sh b/worker.sh index e0e8d43..7d94eb2 100755 --- a/worker.sh +++ b/worker.sh @@ -1,2 +1,23 @@ #!/bin/bash -docker exec --env-file .env.docker -it $(docker ps -aqf "name=worker") sh +set -euo pipefail + +# Enter the php-worker container with sh shell + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +# Get the container ID +CONTAINER_ID=$(docker ps -aqf "name=worker") + +if [ -z "$CONTAINER_ID" ]; then + echo "Error: worker container is not running!" + echo "Start it with: ./startmeup.sh or ./buildmeup.sh" + exit 1 +fi + +echo "Entering worker container..." +docker exec --env-file .env.docker -it "$CONTAINER_ID" sh diff --git a/workmeup.sh b/workmeup.sh index 5c51c69..23bcce5 100755 --- a/workmeup.sh +++ b/workmeup.sh @@ -1,2 +1,23 @@ #!/bin/bash -docker exec --env-file .env.docker -it --user=ivpldock $(docker ps -aqf "name=workspace") bash +set -euo pipefail + +# Enter the workspace container with bash shell as ivpldock user + +# Check if .env.docker exists +if [ ! -f .env.docker ]; then + echo "Error: .env.docker file not found!" + echo "Please create it from .env.example: cp .env.example .env.docker" + exit 1 +fi + +# Get the container ID +CONTAINER_ID=$(docker ps -aqf "name=workspace") + +if [ -z "$CONTAINER_ID" ]; then + echo "Error: workspace container is not running!" + echo "Start it with: ./startmeup.sh or ./buildmeup.sh" + exit 1 +fi + +echo "Entering workspace container as ivpldock user..." +docker exec --env-file .env.docker -it --user=ivpldock "$CONTAINER_ID" bash