diff --git a/.github/workflows/sugar14.yml b/.github/workflows/sugar14.yml new file mode 100644 index 000000000..7526beaba --- /dev/null +++ b/.github/workflows/sugar14.yml @@ -0,0 +1,71 @@ +name: ci-v14 +on: + push: + tags: + - 'v*' +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + run: ['stacks/sugar14/php83-local-build.yml'] + steps: + - run: sudo sysctl -w vm.max_map_count=262144 + - run: echo '127.0.0.1 docker.local' | sudo tee -a /etc/hosts + - uses: actions/checkout@v1 + - run: cp -r ./tests/web_tests ./data/app/sugar/ + - run: ./tests/start.sh ${{ matrix.run }} + - run: ./tests/web_tests.sh ${{ matrix.run }} 14.0 8.3 + - run: ./tests/stop.sh ${{ matrix.run }} + + docker: + strategy: + fail-fast: false + matrix: + include: + - dockercontext: ./images/php/83/apache + image: sugarcrmdevelopers/sugardockerized + prefix: php8.3-apache- + - dockercontext: ./images/php/83/cron + image: sugarcrmdevelopers/sugardockerized + prefix: php8.3-cron- + - dockercontext: ./images/mysql/830 + image: sugarcrmdevelopers/sugardockerized + prefix: mysql8.3.0- + - dockercontext: ./images/permissions + image: sugarcrmdevelopers/sugardockerized + prefix: permissions- + - dockercontext: ./images/testsmtp + image: sugarcrmdevelopers/sugardockerized + prefix: testsmtp- + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ matrix.image }} + flavor: | + latest=true + prefix=${{ matrix.prefix }},onlatest=true + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: ${{ matrix.dockercontext }} + push: true + platforms: 'linux/amd64,linux/arm64' + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/data/app/sugar/.gitkeep b/data/app/sugar/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/images/mysql/830/Dockerfile b/images/mysql/830/Dockerfile new file mode 100755 index 000000000..bf4928e95 --- /dev/null +++ b/images/mysql/830/Dockerfile @@ -0,0 +1,4 @@ +FROM mysql:8.3.0 +MAINTAINER developers@sugarcrm.com + +COPY config/mysql/docker.cnf /etc/mysql/conf.d/docker.cnf diff --git a/images/mysql/830/config/mysql/docker.cnf b/images/mysql/830/config/mysql/docker.cnf new file mode 100644 index 000000000..d954b355b --- /dev/null +++ b/images/mysql/830/config/mysql/docker.cnf @@ -0,0 +1,13 @@ +[mysqld] +host-cache-size=0 +skip-name-resolve +default-storage-engine=InnoDB +innodb_file_per_table +innodb_buffer_pool_size=256M +character-set-server=utf8mb4 +collation-server=utf8mb4_general_ci +optimizer-switch=block_nested_loop=off +sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION" + +[mysqldump] +max-allowed-packet=128M diff --git a/images/permissions/Dockerfile b/images/permissions/Dockerfile index 6f2062dd6..197f54fee 100755 --- a/images/permissions/Dockerfile +++ b/images/permissions/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:8.8 +FROM debian:stable-slim MAINTAINER enrico.simonetti@gmail.com RUN adduser sugar --disabled-password --disabled-login --gecos "" diff --git a/images/php/83/apache/Dockerfile b/images/php/83/apache/Dockerfile new file mode 100644 index 000000000..163520fca --- /dev/null +++ b/images/php/83/apache/Dockerfile @@ -0,0 +1,78 @@ +FROM php:8.3.6-apache + +RUN apt-get update \ + && apt-get install -y \ + graphviz \ + libpng-dev \ + libgmp-dev \ + libzip-dev \ + libc-client-dev \ + libkrb5-dev \ + libldap2-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libxml2-dev \ + git \ + --no-install-recommends + +RUN apt-get clean \ + && apt-get -y autoremove \ + && rm -rf /var/lib/apt/lists/* + +RUN adduser sugar --disabled-password --disabled-login --gecos "" + +RUN echo " /usr/local/php/prepend.php + +COPY config/apache2/mods-available/deflate.conf /etc/apache2/mods-available/deflate.conf +COPY config/apache2/sites-available/sugar.conf /etc/apache2/sites-available/sugar.conf + +RUN set -ex \ + && . "/etc/apache2/envvars" \ + && ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \ + && ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \ + && ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" \ + && a2enmod headers expires deflate rewrite \ + && sed -i "s#Timeout .*#Timeout 600#" /etc/apache2/apache2.conf \ + && a2dissite 000-default \ + && a2ensite sugar + +RUN docker-php-ext-install mysqli \ + && docker-php-ext-install bcmath \ + && docker-php-ext-install gd \ + && docker-php-ext-install gmp \ + && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ + && docker-php-ext-install imap \ + && docker-php-ext-install zip \ + && docker-php-ext-install ldap \ + && pecl install xdebug-3.3.0 \ + && pecl install redis \ + && docker-php-ext-enable redis \ + && docker-php-ext-install soap + +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \ +&& docker-php-ext-install -j$(nproc) gd + +# enabled by default, it can be disabled locally +COPY config/php/mods-available/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini +COPY config/php/mods-available/opcache.ini /usr/local/etc/php/conf.d/opcache.ini +COPY config/php/opcache-blacklist /usr/local/etc/php/opcache-blacklist + +RUN git clone https://github.com/tideways/php-xhprof-extension.git tideways \ + && cd tideways \ + && /usr/local/bin/phpize \ + && ./configure --with-php-config=/usr/local/bin/php-config \ + && make \ + && make install + +COPY config/php/mods-available/tideways.ini /usr/local/etc/php/conf.d/tideways.ini + +RUN git clone https://github.com/longxinH/xhprof.git xhprof \ + && cd xhprof/extension/ \ + && /usr/local/bin/phpize \ + && ./configure --with-php-config=/usr/local/bin/php-config \ + && make \ + && make install + +COPY config/php/mods-available/xhprof.ini /usr/local/etc/php/conf.d/xhprof.ini + +WORKDIR "/var/www/html/sugar" diff --git a/images/php/83/apache/config/apache2/mods-available/deflate.conf b/images/php/83/apache/config/apache2/mods-available/deflate.conf new file mode 100644 index 000000000..7bb892d3e --- /dev/null +++ b/images/php/83/apache/config/apache2/mods-available/deflate.conf @@ -0,0 +1 @@ +AddOutputFilterByType DEFLATE application/json application/javascript text/css diff --git a/images/php/83/apache/config/apache2/sites-available/sugar.conf b/images/php/83/apache/config/apache2/sites-available/sugar.conf new file mode 100644 index 000000000..6411ef409 --- /dev/null +++ b/images/php/83/apache/config/apache2/sites-available/sugar.conf @@ -0,0 +1,14 @@ + + ServerAdmin webmaster@localhost + ServerName localhost + + DocumentRoot /var/www/html + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + + Options Indexes FollowSymLinks + AllowOverride All + + diff --git a/images/php/83/apache/config/php/docker.ini b/images/php/83/apache/config/php/docker.ini new file mode 100644 index 000000000..3c7421d39 --- /dev/null +++ b/images/php/83/apache/config/php/docker.ini @@ -0,0 +1,22 @@ +date.timezone = GMT +error_reporting = E_ALL \& ~E_NOTICE \& ~E_STRICT \& ~E_DEPRECATED +error_log = /var/log/apache2/error.log +log_errors = On +display_errors = Off +memory_limit = 1024M +post_max_size = 100M +upload_max_filesize = 100M +max_execution_time = 600 +max_input_time = 600 +realpath_cache_size = 512k +realpath_cache_ttl = 600 +mbstring.func_overload = 0 +session.use_cookies = 1 +session.cookie_httponly = 1 +session.use_trans_sid = 0 +session.save_handler = redis +session.save_path = "tcp://sugar-redis:6379" +short_open_tag = Off +enable_dl = Off +allow_url_fopen = On +allow_url_include = Off diff --git a/images/php/83/apache/config/php/mods-available/opcache.ini b/images/php/83/apache/config/php/mods-available/opcache.ini new file mode 100644 index 000000000..b0e4ac566 --- /dev/null +++ b/images/php/83/apache/config/php/mods-available/opcache.ini @@ -0,0 +1,30 @@ +; configuration for php ZendOpcache module +; priority=10 +zend_extension=opcache.so +opcache.blacklist_filename="/usr/local/etc/php/opcache-blacklist" +opcache.consistency_checks=0 +opcache.dups_fix=0 +opcache.enable=1 +opcache.enable_cli=0 +opcache.enable_file_override=0 +opcache.error_log="" +opcache.fast_shutdown=1 +opcache.file_update_protection=2 +opcache.force_restart_timeout=180 +opcache.inherited_hack=1 +opcache.interned_strings_buffer=8 +opcache.load_comments=1 +opcache.log_verbosity_level=1 +opcache.max_accelerated_files=4000 +opcache.max_file_size=0 +opcache.max_wasted_percentage=5 +opcache.memory_consumption=256 +opcache.optimization_level=0x7FFFBFFF +opcache.preferred_memory_model="" +opcache.protect_memory=0 +opcache.restrict_api="" +opcache.revalidate_freq=2 +opcache.revalidate_path=0 +opcache.save_comments=1 +opcache.use_cwd=1 +opcache.validate_timestamps=1 diff --git a/images/php/83/apache/config/php/mods-available/redis.ini b/images/php/83/apache/config/php/mods-available/redis.ini new file mode 100644 index 000000000..6aecae489 --- /dev/null +++ b/images/php/83/apache/config/php/mods-available/redis.ini @@ -0,0 +1 @@ +extension=redis.so diff --git a/images/php/83/apache/config/php/mods-available/tideways.ini b/images/php/83/apache/config/php/mods-available/tideways.ini new file mode 100644 index 000000000..de7c8f9f0 --- /dev/null +++ b/images/php/83/apache/config/php/mods-available/tideways.ini @@ -0,0 +1,2 @@ +extension=tideways_xhprof.so +tideways_xhprof.auto_prepend_library=0 diff --git a/images/php/83/apache/config/php/mods-available/xdebug.ini b/images/php/83/apache/config/php/mods-available/xdebug.ini new file mode 100644 index 000000000..03228693e --- /dev/null +++ b/images/php/83/apache/config/php/mods-available/xdebug.ini @@ -0,0 +1,10 @@ +;zend_extension=xdebug.so +xdebug.max_nesting_level=500 +xdebug.profiler_enable=0 + +; enable remote debug +xdebug.client_host=host.docker.internal +xdebug.client_port=9003 +xdebug.idekey=XDEBUG_SESSION +xdebug.start_with_request=yes +xdebug.mode=debug \ No newline at end of file diff --git a/images/php/83/apache/config/php/mods-available/xhprof.ini b/images/php/83/apache/config/php/mods-available/xhprof.ini new file mode 100644 index 000000000..dd7fd32c6 --- /dev/null +++ b/images/php/83/apache/config/php/mods-available/xhprof.ini @@ -0,0 +1,2 @@ +extension = xhprof.so +xhprof.output_dir = /tmp/xhprof diff --git a/images/php/83/apache/config/php/opcache-blacklist b/images/php/83/apache/config/php/opcache-blacklist new file mode 100644 index 000000000..5edb9d104 --- /dev/null +++ b/images/php/83/apache/config/php/opcache-blacklist @@ -0,0 +1,7 @@ +/var/www/html/sugar/config_override.php +/var/www/html/sugar/cache/modules/Teams/TeamSetCache.php +/var/www/html/sugar/cache/modules/Teams/TeamSetMD5Cache.php +/var/www/html/sugar/cache/class_map.php +/var/www/html/sugar/cache/smarty/templates_c/* +/var/www/html/sugar/custom/modules/unified_search_modules_display.php +/var/www/html/sugar/custom/modulebuilder/* diff --git a/images/php/83/cron/Dockerfile b/images/php/83/cron/Dockerfile new file mode 100644 index 000000000..91928df94 --- /dev/null +++ b/images/php/83/cron/Dockerfile @@ -0,0 +1,78 @@ +FROM php:8.3.6-cli + +RUN apt-get update \ + && apt-get install -y \ + sudo \ + vim \ + unzip \ + libpng-dev \ + libgmp-dev \ + libzip-dev \ + libc-client-dev \ + libkrb5-dev \ + libldap2-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libxml2-dev \ + git \ + --no-install-recommends + +RUN apt-get clean \ + && apt-get -y autoremove \ + && rm -rf /var/lib/apt/lists/* + +RUN adduser sugar --disabled-password --disabled-login --gecos "" \ + && echo "sugar ALL=NOPASSWD: ALL" > /etc/sudoers.d/sugar + +RUN echo " /usr/local/php/prepend.php + +RUN docker-php-ext-install mysqli \ + && docker-php-ext-install bcmath \ + && docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg \ + && docker-php-ext-install gd \ + && docker-php-ext-install gmp \ + && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ + && docker-php-ext-install imap \ + && docker-php-ext-install zip \ + && docker-php-ext-install ldap \ + && docker-php-ext-install ldap \ + && pecl install xdebug-3.3.0 \ + && pecl install redis \ + && docker-php-ext-enable redis \ + && docker-php-ext-install soap + +RUN docker-php-ext-install -j$(nproc) gd + +# disable by default, it can be enabled locally +#COPY config/php/mods-available/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini +COPY config/php/mods-available/opcache.ini /usr/local/etc/php/conf.d/opcache.ini +COPY config/php/opcache-blacklist /usr/local/etc/php/opcache-blacklist + +RUN git clone https://github.com/tideways/php-xhprof-extension.git tideways \ + && cd tideways \ + && /usr/local/bin/phpize \ + && ./configure --with-php-config=/usr/local/bin/php-config \ + && make \ + && make install + +COPY config/php/mods-available/tideways.ini /usr/local/etc/php/conf.d/tideways.ini + +RUN git clone https://github.com/longxinH/xhprof.git xhprof \ + && cd xhprof/extension/ \ + && /usr/local/bin/phpize \ + && ./configure --with-php-config=/usr/local/bin/php-config \ + && make \ + && make install + +COPY config/php/mods-available/xhprof.ini /usr/local/etc/php/conf.d/xhprof.ini + +RUN curl -sS http://getcomposer.org/installer | php \ + && mv composer.phar /usr/local/bin/composer + +COPY apps/sugarcron /usr/local/bin/sugarcron +RUN chmod +x /usr/local/bin/sugarcron + +WORKDIR "/var/www/html/sugar" +USER sugar + +CMD ["/usr/local/bin/sugarcron"] diff --git a/images/php/83/cron/apps/sugarcron b/images/php/83/cron/apps/sugarcron new file mode 100644 index 000000000..ce24473ac --- /dev/null +++ b/images/php/83/cron/apps/sugarcron @@ -0,0 +1,25 @@ +#!/usr/local/bin/php +connect('sugar-redis', 6379); +$redis->set($ok, $ok); + +if ($redis->get($ok) == $ok) { + echo $ok; +} diff --git a/tests/web_tests/8.3/test_4.php b/tests/web_tests/8.3/test_4.php new file mode 100644 index 000000000..9ac401e21 --- /dev/null +++ b/tests/web_tests/8.3/test_4.php @@ -0,0 +1,20 @@ +connect_error) { + die('Connection failed: ' . $conn->connect_error); +} + +$sql = 'CREATE DATABASE dockertest'; +if ($conn->query($sql) === TRUE) { + $conn->select_db('dockertest'); + $sql = 'CREATE TABLE test ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL )'; + if ($conn->query($sql) === TRUE) { + echo $ok; + } + $sql = 'DROP DATABASE dockertest'; + $conn->query($sql); +} + +$conn->close(); diff --git a/tests/web_tests/8.3/test_5.php b/tests/web_tests/8.3/test_5.php new file mode 100644 index 000000000..7f73a81d2 --- /dev/null +++ b/tests/web_tests/8.3/test_5.php @@ -0,0 +1,59 @@ + 4.0, + 'headers' => array( + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', + ) + ) +); + +$error = true; + +$response = $client->get($url . '_stats'); +if ($response->getStatusCode() == 200) { + + $response = $client->put($url . 'testbucket'); + if ($response->getStatusCode() == 200) { + $response = $client->put( + $url . 'testbucket/_doc/enrico?refresh=true', + array ( + //'debug' => TRUE, + 'json' => array( + 'name' => 'Enrico Simonetti' + ) + ) + ); + if ($response->getStatusCode() == 201) { + $response = $client->get( + $url . 'testbucket/_search', + array( + //'debug' => TRUE, + 'query' => array( + 'q' => 'simonetti' + ) + ) + ); + $decoded = json_decode($response->getBody(), true); + if (!empty($decoded['hits']) + && $decoded['hits']['total']['value'] === 1 + && $decoded['hits']['hits']['0']['_id'] === 'enrico') { + // expected result found + $error = false; + } + } + + $response = $client->delete($url . 'testbucket'); + } +} + +if (!$error) { + echo $ok; +} diff --git a/utilities/configs/config_override_dockerized.php b/utilities/configs/config_override_dockerized.php index 518e46728..0012e9a6d 100644 --- a/utilities/configs/config_override_dockerized.php +++ b/utilities/configs/config_override_dockerized.php @@ -10,7 +10,8 @@ $sugar_config['db_manager'] = 'MysqliManager'; $sugar_config['db'] = array(); $sugar_config['external_cache']['redis']['host'] = 'sugar-redis'; -$sugar_config['external_cache_disabled'] = 'false'; -$sugar_config['external_cache_disabled_redis'] = 'false'; +$sugar_config['external_cache']['redis']['port'] = '6379'; +$sugar_config['external_cache_disabled'] = 0; +$sugar_config['external_cache_disabled_redis'] = 0; $sugar_config['host_name'] = 'docker.local'; $sugar_config['site_url'] = 'http://docker.local/sugar'; diff --git a/utilities/stack.sh b/utilities/stack.sh index 9ab34708a..d34e7b218 100755 --- a/utilities/stack.sh +++ b/utilities/stack.sh @@ -13,7 +13,7 @@ cd $REPO if [ -z $1 ] || [ -z $2 ] then - echo Provide two parameters. The sugar stack version keyword for \(eg: 13, 12\) and the action \(up, down\). The stacks keywords available can be found below: + echo Provide two parameters. The sugar stack version keyword for \(eg: 14, 13\) and the action \(up, down\). The stacks keywords available can be found below: for index in "${stacks[@]}" ; do KEY="${index%%::*}" echo $KEY diff --git a/utilities/stacks.conf b/utilities/stacks.conf index 48e56dec5..a38ba963c 100644 --- a/utilities/stacks.conf +++ b/utilities/stacks.conf @@ -21,4 +21,6 @@ stacks=( '12-local::stacks/sugar12/php80-local-build.yml' '13::stacks/sugar13/php82.yml' '13-local::stacks/sugar13/php82-local-build.yml' + '14::stacks/sugar14/php83.yml' + '14-local::stacks/sugar14/php83-local-build.yml' ) diff --git a/utilities/sugardockerized/checkversion.sh b/utilities/sugardockerized/checkversion.sh index c5f90a074..6aa1311be 100755 --- a/utilities/sugardockerized/checkversion.sh +++ b/utilities/sugardockerized/checkversion.sh @@ -8,8 +8,7 @@ REPO="$( dirname ${BASH_SOURCE[0]} )/../../" cd $REPO VERSIONFILE=version -#VERSIONFILEURL=https://raw.githubusercontent.com/esimonetti/SugarDockerized/dev/version -VERSIONFILEURL=https://raw.githubusercontent.com/esimonetti/SugarDockerized/master/version +VERSIONFILEURL=https://raw.githubusercontent.com/sugarcrm-developers/SugarDockerized/master/version # if it is our repo if [ -f '.gitignore' ] && [ -d 'data' ] diff --git a/utilities/sugardockerized/install.sh b/utilities/sugardockerized/install.sh index b4e86f7a4..51d233467 100755 --- a/utilities/sugardockerized/install.sh +++ b/utilities/sugardockerized/install.sh @@ -3,7 +3,7 @@ # Enrico Simonetti # enricosimonetti.com -REPOURL=https://github.com/esimonetti/SugarDockerized.git +REPOURL=https://github.com/sugarcrm-developers/SugarDockerized.git INSTALLDIR='sugardocker' diff --git a/utilities/sugardockerized/selfupgrade.sh b/utilities/sugardockerized/selfupgrade.sh index 4ee11865a..92768e6cf 100755 --- a/utilities/sugardockerized/selfupgrade.sh +++ b/utilities/sugardockerized/selfupgrade.sh @@ -3,7 +3,7 @@ # Enrico Simonetti # enricosimonetti.com -REPOURL=https://github.com/esimonetti/SugarDockerized.git +REPOURL=https://github.com/sugarcrm-developers/SugarDockerized.git # enter the repo's root directory REPO="$( dirname ${BASH_SOURCE[0]} )/../../" diff --git a/version b/version index 08369aae5..cd5ac039d 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.51 +2.0