From db2727916df15663535254434e2d1d23ab82047b Mon Sep 17 00:00:00 2001 From: Mariusz Krzaczkowski Date: Sun, 4 Apr 2021 23:49:51 +0200 Subject: [PATCH] init --- 7.3/Dockerfile | 49 ++++++++++++++++++++++++++++++ 7.3/action.yml | 9 ++++++ 7.3/entrypoint.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++++ 7.4/Dockerfile | 49 ++++++++++++++++++++++++++++++ 7.4/action.yml | 16 ++++++++++ 7.4/entrypoint.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 277 insertions(+) create mode 100644 7.3/Dockerfile create mode 100644 7.3/action.yml create mode 100644 7.3/entrypoint.sh create mode 100644 7.4/Dockerfile create mode 100644 7.4/action.yml create mode 100644 7.4/entrypoint.sh diff --git a/7.3/Dockerfile b/7.3/Dockerfile new file mode 100644 index 0000000..c4fba4c --- /dev/null +++ b/7.3/Dockerfile @@ -0,0 +1,49 @@ +FROM debian:buster + +MAINTAINER m.krzaczkowski@yetiforce.com + +ARG DEBIAN_FRONTEND=noninteractive + +#INSTALL_MODE = PROD , DEV , TEST +ENV INSTALL_MODE TEST +ENV PHP_VER 7.3 +ENV GUI_MODE false + +ENV DB_USER_NAME yetiforce +ENV DB_USER_PASS Q4WK2yRUpliyjMRivDJE +ENV DB_PORT 3306 +ARG DB_ROOT_PASS=1r2VdePVnNxluabdGuqh + + +ENV PROVIDER tests + +RUN apt-get update && apt-get install -y --no-install-recommends apt-utils curl openssl wget ca-certificates apt-transport-https lsb-release gnupg && apt-get -y autoclean + +RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg +RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list + +RUN apt-get update +RUN apt-get install -y --no-install-recommends mariadb-server mariadb-client nginx nginx-extras "php${PHP_VER}"-fpm "php${PHP_VER}"-mysql "php${PHP_VER}"-curl "php${PHP_VER}"-intl "php${PHP_VER}"-gd "php${PHP_VER}"-fpm "php${PHP_VER}"-bcmath "php${PHP_VER}"-soap "php${PHP_VER}"-ldap "php${PHP_VER}"-imap "php${PHP_VER}"-xml "php${PHP_VER}"-cli "php${PHP_VER}"-zip "php${PHP_VER}"-json "php${PHP_VER}"-opcache "php${PHP_VER}"-mbstring php-apcu php-imagick php-sodium zip unzip cron && apt-get -y autoclean + +# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +# RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list +# RUN apt-get install -y --no-install-recommends nodejs npm yarn && apt-get -y autoclean + +# RUN apt-cache search php +RUN dpkg --get-selections | grep php + +RUN rm /var/www/html/index.nginx-debian.html +RUN echo "PROVIDER=tests" > /etc/environment + +RUN curl -sS https://getcomposer.org/installer | php +RUN mv composer.phar /usr/local/bin/composer +RUN chmod +x /usr/local/bin/composer + +COPY entrypoint.sh /entrypoint.sh +RUN chmod 777 /entrypoint.sh + +WORKDIR /var/www/html + +EXPOSE 80 + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.3/action.yml b/7.3/action.yml new file mode 100644 index 0000000..89f8086 --- /dev/null +++ b/7.3/action.yml @@ -0,0 +1,9 @@ +name: 'YetiForceCRM Tests Action - PHP 7.3' +description: 'GitHub Action for Tests YetiForceCRM - PHP 7.3' +branding: + icon: 'check-square' + color: 'blue' + +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/7.3/entrypoint.sh b/7.3/entrypoint.sh new file mode 100644 index 0000000..839ba19 --- /dev/null +++ b/7.3/entrypoint.sh @@ -0,0 +1,77 @@ +#!/bin/bash +echo " ----- Start -----" +printenv + +#https://github.com/actions/cache/blob/main/examples.md#php---composer + +cd /var/www/html/ + +echo " ----- Copy files -----" +cp -R $GITHUB_WORKSPACE/* /var/www/html + +cp /var/www/html/tests/setup/crons.conf /etc/cron.d/yetiforcecrm +cp /var/www/html/tests/setup/db/mysql.cnf /etc/mysql/mariadb.conf.d/50-server.cnf +cp /var/www/html/tests/setup/nginx/www.conf /etc/nginx/sites-available/default +cp /var/www/html/tests/setup/nginx/yetiforce.conf /etc/nginx/yetiforce.conf +cp /var/www/html/tests/setup/fpm/www.conf /etc/php/$PHP_VER/fpm/pool.d/www.conf +cp /var/www/html/tests/setup/php/prod.ini /etc/php/$PHP_VER/mods-available/yetiforce.ini + +ln -s /etc/php/$PHP_VER/mods-available/yetiforce.ini /etc/php/$PHP_VER/cli/conf.d/30-yetiforce.ini +ln -s /etc/php/$PHP_VER/mods-available/yetiforce.ini /etc/php/$PHP_VER/fpm/conf.d/30-yetiforce.ini + +crontab /etc/cron.d/yetiforcecrm + +echo " ----- chmod -----" +chmod -R +x /var/www/html/tests/setup + +echo " ----- tests/setup/dependency.sh -----" +/var/www/html/tests/setup/dependency.sh + +echo " ----- tests/setup/docker_post_install.php -----" +php /var/www/html/tests/setup/docker_post_install.php + +echo " ----- service mysql start -----" +service mysql start; +service mysql status +echo " ----- service cron start -----" +service cron start +echo " ----- nginx -----" +service nginx start +service nginx status +echo " ----- PHP-FPM -----" +/etc/init.d/php$PHP_VER-fpm start +service php$PHP_VER-fpm status + +echo " ----- chown -----" +chown -R www-data:www-data /var/www/ + +echo " ----- mysql -----" +mysql -uroot mysql; +mysqladmin password "$DB_ROOT_PASS"; +echo "UPDATE mysql.user SET Password=PASSWORD('$DB_ROOT_PASS') WHERE User='root';" | mysql --user=root; +echo "DELETE FROM mysql.user WHERE User='';" | mysql --user=root; +echo "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" | mysql --user=root; +echo "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';" | mysql --user=root; +echo "CREATE DATABASE yetiforce;" | mysql --user=root; +echo "CREATE USER 'yetiforce'@'localhost' IDENTIFIED BY '$DB_USER_PASS';" | mysql --user=root; +echo "GRANT ALL PRIVILEGES ON yetiforce.* TO 'yetiforce'@'localhost';" | mysql --user=root; +echo "FLUSH PRIVILEGES;" | mysql --user=root + + +cd /var/www/html/tests +/var/www/html/vendor/bin/phpunit --verbose --colors=always --testsuite Init,Settings,Base,Integrations,Apps + + +echo " ----- Logs: /var/log/fpm-php.www.log -----" +cat /var/log/fpm-php.www.log +echo " ----- Logs: /var/log/php_error.log -----" +cat /var/log/php_error.log +echo " ----- Logs: /var/log/mysql/error.log -----" +cat /var/log/mysql/error.log +echo " ----- Logs: /var/www/html/cache/logs/system.log -----" +cat /var/www/html/cache/logs/system.log + +echo " ----- LS /var/www/html/cache/logs -----" +ls -all /var/www/html/cache/logs +echo " ----- LS /var/log/ -----" +ls -all /var/log/ diff --git a/7.4/Dockerfile b/7.4/Dockerfile new file mode 100644 index 0000000..5b973a5 --- /dev/null +++ b/7.4/Dockerfile @@ -0,0 +1,49 @@ +FROM debian:buster + +MAINTAINER m.krzaczkowski@yetiforce.com + +ARG DEBIAN_FRONTEND=noninteractive + +#INSTALL_MODE = PROD , DEV , TEST +ENV INSTALL_MODE TEST +ENV PHP_VER 7.4 +ENV GUI_MODE false + +ENV DB_USER_NAME yetiforce +ENV DB_USER_PASS Q4WK2yRUpliyjMRivDJE +ENV DB_PORT 3306 +ARG DB_ROOT_PASS=1r2VdePVnNxluabdGuqh + + +ENV PROVIDER tests + +RUN apt-get update && apt-get install -y --no-install-recommends apt-utils curl openssl wget ca-certificates apt-transport-https lsb-release gnupg && apt-get -y autoclean + +RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg +RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list + +RUN apt-get update +RUN apt-get install -y --no-install-recommends mariadb-server mariadb-client nginx nginx-extras "php${PHP_VER}"-fpm "php${PHP_VER}"-mysql "php${PHP_VER}"-curl "php${PHP_VER}"-intl "php${PHP_VER}"-gd "php${PHP_VER}"-fpm "php${PHP_VER}"-bcmath "php${PHP_VER}"-soap "php${PHP_VER}"-ldap "php${PHP_VER}"-imap "php${PHP_VER}"-xml "php${PHP_VER}"-cli "php${PHP_VER}"-zip "php${PHP_VER}"-json "php${PHP_VER}"-opcache "php${PHP_VER}"-mbstring php-apcu php-imagick php-sodium zip unzip cron && apt-get -y autoclean + +# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +# RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list +# RUN apt-get install -y --no-install-recommends nodejs npm yarn && apt-get -y autoclean + +# RUN apt-cache search php +RUN dpkg --get-selections | grep php + +RUN rm /var/www/html/index.nginx-debian.html +RUN echo "PROVIDER=tests" > /etc/environment + +RUN curl -sS https://getcomposer.org/installer | php +RUN mv composer.phar /usr/local/bin/composer +RUN chmod +x /usr/local/bin/composer + +COPY entrypoint.sh /entrypoint.sh +RUN chmod 777 /entrypoint.sh + +WORKDIR /var/www/html + +EXPOSE 80 + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/7.4/action.yml b/7.4/action.yml new file mode 100644 index 0000000..0873927 --- /dev/null +++ b/7.4/action.yml @@ -0,0 +1,16 @@ +name: 'YetiForceCRM Tests Action - PHP 7.4' +description: 'GitHub Action for Tests YetiForceCRM - PHP 7.4' +branding: + icon: 'check-square' + color: 'blue' +inputs: + xxxx: + description: 'xxxx xxxx xxxx' + required: true + default: 'cccc' + +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.xxxx }} diff --git a/7.4/entrypoint.sh b/7.4/entrypoint.sh new file mode 100644 index 0000000..839ba19 --- /dev/null +++ b/7.4/entrypoint.sh @@ -0,0 +1,77 @@ +#!/bin/bash +echo " ----- Start -----" +printenv + +#https://github.com/actions/cache/blob/main/examples.md#php---composer + +cd /var/www/html/ + +echo " ----- Copy files -----" +cp -R $GITHUB_WORKSPACE/* /var/www/html + +cp /var/www/html/tests/setup/crons.conf /etc/cron.d/yetiforcecrm +cp /var/www/html/tests/setup/db/mysql.cnf /etc/mysql/mariadb.conf.d/50-server.cnf +cp /var/www/html/tests/setup/nginx/www.conf /etc/nginx/sites-available/default +cp /var/www/html/tests/setup/nginx/yetiforce.conf /etc/nginx/yetiforce.conf +cp /var/www/html/tests/setup/fpm/www.conf /etc/php/$PHP_VER/fpm/pool.d/www.conf +cp /var/www/html/tests/setup/php/prod.ini /etc/php/$PHP_VER/mods-available/yetiforce.ini + +ln -s /etc/php/$PHP_VER/mods-available/yetiforce.ini /etc/php/$PHP_VER/cli/conf.d/30-yetiforce.ini +ln -s /etc/php/$PHP_VER/mods-available/yetiforce.ini /etc/php/$PHP_VER/fpm/conf.d/30-yetiforce.ini + +crontab /etc/cron.d/yetiforcecrm + +echo " ----- chmod -----" +chmod -R +x /var/www/html/tests/setup + +echo " ----- tests/setup/dependency.sh -----" +/var/www/html/tests/setup/dependency.sh + +echo " ----- tests/setup/docker_post_install.php -----" +php /var/www/html/tests/setup/docker_post_install.php + +echo " ----- service mysql start -----" +service mysql start; +service mysql status +echo " ----- service cron start -----" +service cron start +echo " ----- nginx -----" +service nginx start +service nginx status +echo " ----- PHP-FPM -----" +/etc/init.d/php$PHP_VER-fpm start +service php$PHP_VER-fpm status + +echo " ----- chown -----" +chown -R www-data:www-data /var/www/ + +echo " ----- mysql -----" +mysql -uroot mysql; +mysqladmin password "$DB_ROOT_PASS"; +echo "UPDATE mysql.user SET Password=PASSWORD('$DB_ROOT_PASS') WHERE User='root';" | mysql --user=root; +echo "DELETE FROM mysql.user WHERE User='';" | mysql --user=root; +echo "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" | mysql --user=root; +echo "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';" | mysql --user=root; +echo "CREATE DATABASE yetiforce;" | mysql --user=root; +echo "CREATE USER 'yetiforce'@'localhost' IDENTIFIED BY '$DB_USER_PASS';" | mysql --user=root; +echo "GRANT ALL PRIVILEGES ON yetiforce.* TO 'yetiforce'@'localhost';" | mysql --user=root; +echo "FLUSH PRIVILEGES;" | mysql --user=root + + +cd /var/www/html/tests +/var/www/html/vendor/bin/phpunit --verbose --colors=always --testsuite Init,Settings,Base,Integrations,Apps + + +echo " ----- Logs: /var/log/fpm-php.www.log -----" +cat /var/log/fpm-php.www.log +echo " ----- Logs: /var/log/php_error.log -----" +cat /var/log/php_error.log +echo " ----- Logs: /var/log/mysql/error.log -----" +cat /var/log/mysql/error.log +echo " ----- Logs: /var/www/html/cache/logs/system.log -----" +cat /var/www/html/cache/logs/system.log + +echo " ----- LS /var/www/html/cache/logs -----" +ls -all /var/www/html/cache/logs +echo " ----- LS /var/log/ -----" +ls -all /var/log/