diff --git a/production/build/docker/akeneo/ak6/.env.local b/production/build/docker/akeneo/ak6/.env.local new file mode 100644 index 0000000..6d49b4c --- /dev/null +++ b/production/build/docker/akeneo/ak6/.env.local @@ -0,0 +1,6 @@ +APP_ENV=prod +APP_DEBUG=0 +INDUXX_METRIC_ACCESS=pxXgfaPJaWaGdN8yMv9Lan8um4aUSMmK3zm3utgeFVqdThZHp2spSWevxsAVDcJn +INDUXX_METRIC_IP=94.143.189.245 +HOTFOLDER_PATH=var/hotfolder +INDUXX_LOG_PATH='/build/app/var/logs/*.log' \ No newline at end of file diff --git a/production/build/docker/akeneo/ak6/Dockerfile b/production/build/docker/akeneo/ak6/Dockerfile new file mode 100644 index 0000000..d53ded1 --- /dev/null +++ b/production/build/docker/akeneo/ak6/Dockerfile @@ -0,0 +1,99 @@ +FROM debian:stretch-slim + +ENV DEBIAN_FRONTEND="noninteractive" \ + OS_ARCH="amd64" \ + OS_FLAVOUR="debian-10" \ + OS_NAME="linux" \ + HOME="/build" \ + LANGUAGE="en_US.UTF-8" \ + LC_ALL="C.UTF-8" \ + LANG="en_US.UTF-8" \ + TERM="xterm" + +RUN apt-get update && \ + echo "**** install useful distro packages ****" && \ + apt-get --no-install-recommends --no-install-suggests --yes --quiet install \ + apt-transport-https \ + lsb-release \ + ca-certificates \ + bash-completion \ + gnupg \ + procps \ + wget \ + curl \ + less \ + make \ + ssh-client \ + vim \ + nano \ + aspell \ + ghostscript \ + unzip \ + cron \ + systemd-sysv \ + perceptualdiff && \ + apt-get clean && apt-get --yes --quiet autoremove --purge && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + /usr/share/doc/* /usr/share/groff/* /usr/share/info/* /usr/share/linda/* \ + /usr/share/lintian/* /usr/share/locale/* /usr/share/man/* + +# Add Sury PHP repository +RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg +COPY files/sury.list /etc/apt/sources.list.d/sury.list + +# for mysql-client to work properly we need to add the mysql-apt-config package + +# install app dependencies with extensions +RUN apt-get update && \ + apt-get --no-install-recommends --no-install-suggests --yes --quiet install \ + imagemagick \ + nginx \ + supervisor \ + mysql-client \ + php8.0-cli \ + php8.0-apcu \ + php8.0-mbstring \ + php8.0-curl \ + php8.0-gd \ + php8.0-imagick \ + php8.0-intl php8.0-bcmath \ + php8.0-mysql \ + php8.0-xml \ + php8.0-fpm \ + php8.0-zip \ + php8.0-ldap && \ + apt-get clean && apt-get --yes --quiet autoremove --purge && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + /usr/share/doc/* /usr/share/groff/* /usr/share/info/* /usr/share/linda/* \ + /usr/share/lintian/* /usr/share/locale/* /usr/share/man/* + +# create a build user and home-directory, setup a app directory +RUN useradd -u 911 -U -d /build -s /bin/bash build && \ + usermod -G users build && \ + mkdir -p \ + /build/app && \ + chown build:www-data /build -R + +COPY files/php/app.conf /etc/php/8.0/fpm/pool.d/ +COPY files/php/app.ini /etc/php/8.0/mods-available/app.ini +COPY files/php/cli-conf.ini /etc/php/8.0/cli/conf.d/99-pim.ini +COPY files/php/fpm-conf.ini /etc/php/8.0/fpm/conf.d/99-pim.ini +# RUN rm /etc/php/8.0/fpm/pool.d/www.conf && phpenmod app + +COPY --chown=build:www-data app /build/app + +# nginx configuration +COPY files/nginx /etc/nginx/sites-available/ +RUN rm /etc/nginx/sites-enabled/default; ln -s /etc/nginx/sites-available/prod.conf /etc/nginx/sites-enabled/prod.conf + +# supervisor configuration +RUN mkdir -p /var/log/supervisor \ + && chown -R build:www-data /var/log/supervisor \ + && chmod -R 775 /var/log/supervisor \ + && mkdir -p /var/run /run/php +COPY files/supervisord.conf /etc/supervisor/conf.d/ + +EXPOSE 80/tcp + +CMD ["/usr/bin/supervisord"] +#CMD service php7.4-fpm start && service nginx start && tail -f /dev/null diff --git a/production/build/docker/akeneo/ak6/Jenkins_build_image.sh b/production/build/docker/akeneo/ak6/Jenkins_build_image.sh new file mode 100755 index 0000000..54ab671 --- /dev/null +++ b/production/build/docker/akeneo/ak6/Jenkins_build_image.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# usage: ./Jenkins_build_image.sh +# example: bash ./production/build/docker/akeneo/ak5/Jenkins_build_image.sh ak5-ee-pdf induxx/akeneo-ee-pdf-demo + +CLOUD_NAME=${1:-ak6} +GIT_REPO=${2:-induxx/akeneo-ee} + +LOCAL=$(pwd) +LOCAL=$LOCAL"/$(dirname "$0")" + +cd $LOCAL + +init_project() +{ + rm -rf app && mkdir -p app + + git clone git@github.com:${GIT_REPO}.git app + + cp .env.local app/.env.local + + mkdir -p app/var/install app/var/file_storage/asset app/var/file_storage/catalog + tar -xvf ../../../fixtures/ak5/retail_store/asset.tar -C app/var/file_storage/ + tar -xvf ../../../fixtures/ak5/retail_store/catalog.tar -C app/var/file_storage/ + cp f ../../../fixtures/ak5/retail_store/akeneo_pim.sql.gz app/var/install/ + + cd app + + bash bin/init + rm -rf $( cat ../excluded_files.txt ) + + cd - +} + +init_project + +docker build -t induxx/cloud:${CLOUD_NAME} . + +# ansible setup some stuff here like the scripts, cron + +docker push induxx/cloud:${CLOUD_NAME} + +rm -rf app diff --git a/production/build/docker/akeneo/ak6/excluded_files.txt b/production/build/docker/akeneo/ak6/excluded_files.txt new file mode 100755 index 0000000..1b7c68d --- /dev/null +++ b/production/build/docker/akeneo/ak6/excluded_files.txt @@ -0,0 +1,27 @@ +.git +.gitignore +bin/init +bin/mysql +bin/docker +bin/init +bin/docker +build/* +var/logs/* +var/cache/* +var/data/* +docker-compose* +.docker/ +.data/ +docker +*.md +*.txt +composer.phar +composer.lock +yarn.lock +package.json +node_modules +Makefile +.env.local.dist +tsconfig.json +build/ +upgrades/ \ No newline at end of file diff --git a/production/build/docker/akeneo/ak6/files/nginx/fastcgi-php.conf b/production/build/docker/akeneo/ak6/files/nginx/fastcgi-php.conf new file mode 100644 index 0000000..e69de29 diff --git a/production/build/docker/akeneo/ak6/files/nginx/prod.conf b/production/build/docker/akeneo/ak6/files/nginx/prod.conf new file mode 100644 index 0000000..9a57ac3 --- /dev/null +++ b/production/build/docker/akeneo/ak6/files/nginx/prod.conf @@ -0,0 +1,58 @@ +server { + listen 80; ## listen for ipv4; this line is default and implied + listen [::]:80 default ipv6only=on; ## listen for ipv6 + + root /build/app/public; + + # Make site accessible from http://localhost/ + server_name akeneo.prod; + + sendfile off; + + # Add stdout logging +# error_log /dev/stdout info; +# access_log /dev/stdout; + + location / { + # try to serve file directly, fallback to app.php + try_files $uri /index.php$is_args$args; + } + + # PROD + location ~ ^/index\.php(/|$) { + + #include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php8.0-fpm.sock; + + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + + # When you are using symlinks to link the document root to the + # current version of your application, you should pass the real + # application path instead of the path to the symlink to PHP + # FPM. + # Otherwise, PHP's OPcache may not properly detect changes to + # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 + # for more information). + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + + # Prevents URIs that include the front controller. This will 404: + # http://domain.tld/app.php/some-path + # Remove the internal directive to allow URIs like this + internal; + } + + # return 404 for all other php files not matching the front controller + # this prevents access to other php files you don't want to be accessible. + location ~ \.php$ { + return 404; + } + + # deny access to . files, for security + # + location ~ /\. { + log_not_found off; + deny all; + } +} diff --git a/production/build/docker/akeneo/ak6/files/php/app.conf b/production/build/docker/akeneo/ak6/files/php/app.conf new file mode 100644 index 0000000..1085fea --- /dev/null +++ b/production/build/docker/akeneo/ak6/files/php/app.conf @@ -0,0 +1,26 @@ +[www] + +user = build +group = www-data + +listen = /run/php/php8.0-fpm.sock + +listen.owner = www-data +listen.group = www-data + +pm = dynamic + +; Note: Used only when pm is set to 'dynamic' +pm.start_servers = 1 +pm.min_spare_servers = 1 +pm.max_spare_servers = 1 + +; Note: Used only when pm is set to 'ondemand' +pm.process_idle_timeout = 10s; + +pm.max_requests = 1000 + +pm.max_children = 10 + +pm.status_path = /fpm-status +ping.path = /fpm-ping diff --git a/production/build/docker/akeneo/ak6/files/php/app.ini b/production/build/docker/akeneo/ak6/files/php/app.ini new file mode 100644 index 0000000..f425505 --- /dev/null +++ b/production/build/docker/akeneo/ak6/files/php/app.ini @@ -0,0 +1,19 @@ +display_errors = On +error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED + +date.timezone = UTC + +memory_limit = 2G +upload_max_filesize = 32M +post_max_size = 64M + +apc.enabled=1 +apc.enable_cli=1 + +opcache.memory_consumption = 512 +opcache.max_accelerated_files = 30000 +opcache.validate_timestamps = 0 +realpath_cache_size = 4096K +realpath_cache_ttl = 600 +opcache.interned_strings_buffer = 64 +opcache.save_comments = 1 diff --git a/production/build/docker/akeneo/ak6/files/php/cli-conf.ini b/production/build/docker/akeneo/ak6/files/php/cli-conf.ini new file mode 100644 index 0000000..c11cca5 --- /dev/null +++ b/production/build/docker/akeneo/ak6/files/php/cli-conf.ini @@ -0,0 +1,2 @@ +memory_limit = 1024M +date.timezone = UTC \ No newline at end of file diff --git a/production/build/docker/akeneo/ak6/files/php/fpm-conf.ini b/production/build/docker/akeneo/ak6/files/php/fpm-conf.ini new file mode 100644 index 0000000..04e4631 --- /dev/null +++ b/production/build/docker/akeneo/ak6/files/php/fpm-conf.ini @@ -0,0 +1,5 @@ +memory_limit = 1024M +date.timezone = UTC +post_max_size = 92M +upload_max_filesize = 64M +apc.enable_cli = 1 diff --git a/production/build/docker/akeneo/ak6/files/supervisord.conf b/production/build/docker/akeneo/ak6/files/supervisord.conf new file mode 100644 index 0000000..38fc138 --- /dev/null +++ b/production/build/docker/akeneo/ak6/files/supervisord.conf @@ -0,0 +1,29 @@ +[supervisord] +nodaemon=true +loglevel=warn +logfile_maxbytes=0 +logfile=/dev/stderr + +[program:nginx] +command = nginx -g 'daemon off;' +autostart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:php-fpm8.0] +command = /usr/sbin/php-fpm8.0 -F +autostart = true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:akeneo_queue_daemon] +command = /usr/sbin/php /build/app/bin/console akeneo:batch:job-queue-consumer-daemon --env=prod +autostart = false +autorestart=true +stderr_logfile=/var/log/akeneo_daemon.err.log +stdout_logfile=/var/log/akeneo_daemon.out.log +user=build diff --git a/production/build/docker/akeneo/ak6/files/sury.list b/production/build/docker/akeneo/ak6/files/sury.list new file mode 100644 index 0000000..a17f38e --- /dev/null +++ b/production/build/docker/akeneo/ak6/files/sury.list @@ -0,0 +1,2 @@ +deb https://packages.sury.org/php/ stretch main +