From 8eaa2a1143469661f67ec2be5c31401dbd9e8ecb Mon Sep 17 00:00:00 2001 From: bach Date: Mon, 25 Apr 2022 10:12:27 +0200 Subject: [PATCH] first docker draft --- .env | 13 + .gitignore | 4 + .gitmodules | 3 + Docker/mysql/bashrc | 3 + Docker/mysql/inputrc | 2 + Docker/mysql/mysql.cnf | 12 + Docker/nginx/Dockerfile | 5 + Docker/nginx/bashrc | 3 + Docker/nginx/default.conf | 61 ++++ Docker/nginx/inputrc | 2 + Docker/nginx_static/Dockerfile | 5 + Docker/nginx_static/bashrc | 3 + Docker/nginx_static/default.conf | 16 + Docker/nginx_static/inputrc | 2 + Docker/npm/Dockerfile | 30 ++ Docker/npm/bashrc | 3 + Docker/npm/client-entrypoint.sh | 19 ++ Docker/npm/inputrc | 2 + Docker/php/Dockerfile | 74 +++++ Docker/php/bashrc | 6 + Docker/php/inputrc | 2 + Docker/php/php-custom.ini | 9 + Docker/php/rsyslog-drupal.conf | 1 + Docker/redis/Dockerfile | 3 + Docker/redis/redis.conf | 2 + LICENSE.txt | 339 ++++++++++++++++++++++ Makefile | 69 +++++ README.md | 184 ++++++++++++ docker-compose.yml | 93 ++++++ ressources/default/settings.php | 483 +++++++++++++++++++++++++++++++ ressources/xdebug.ini | 18 ++ static/build_static.sh | 21 ++ static/posthttrack.sh | 5 + 33 files changed, 1497 insertions(+) create mode 100644 .env create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 Docker/mysql/bashrc create mode 100644 Docker/mysql/inputrc create mode 100644 Docker/mysql/mysql.cnf create mode 100644 Docker/nginx/Dockerfile create mode 100644 Docker/nginx/bashrc create mode 100644 Docker/nginx/default.conf create mode 100644 Docker/nginx/inputrc create mode 100644 Docker/nginx_static/Dockerfile create mode 100644 Docker/nginx_static/bashrc create mode 100644 Docker/nginx_static/default.conf create mode 100644 Docker/nginx_static/inputrc create mode 100644 Docker/npm/Dockerfile create mode 100644 Docker/npm/bashrc create mode 100644 Docker/npm/client-entrypoint.sh create mode 100644 Docker/npm/inputrc create mode 100644 Docker/php/Dockerfile create mode 100644 Docker/php/bashrc create mode 100644 Docker/php/inputrc create mode 100644 Docker/php/php-custom.ini create mode 100644 Docker/php/rsyslog-drupal.conf create mode 100644 Docker/redis/Dockerfile create mode 100644 Docker/redis/redis.conf create mode 100644 LICENSE.txt create mode 100644 Makefile create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 ressources/default/settings.php create mode 100644 ressources/xdebug.ini create mode 100755 static/build_static.sh create mode 100644 static/posthttrack.sh diff --git a/.env b/.env new file mode 100644 index 0000000..1802e56 --- /dev/null +++ b/.env @@ -0,0 +1,13 @@ +COMPOSE_PROJECT_NAME=clameurs + +D7_ROOT=./d7 +D7_THEME_ROOT=./d7/sites/all/themes/gui/???? +LOG_ROOT=./log +STATIC_ROOT=./static/web/dev.clameurs-lawebserie.fr + +DB_ROOT_PASSWORD=clameurs +DB_NAME=clameurs +DB_USERNAME=root +DB_PASSWORD=clameurs + +XDEBUG_INI=./ressources/xdebug.ini \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6564e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +d7/* +d7.hacked/* +log/* +*.sql diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..253379e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "d7"] + path = d7 + url = https://figureslibres.io/gogs/bachir/performance-art.fr.git diff --git a/Docker/mysql/bashrc b/Docker/mysql/bashrc new file mode 100644 index 0000000..58d8728 --- /dev/null +++ b/Docker/mysql/bashrc @@ -0,0 +1,3 @@ +PS1='\e[36m\e[1mMYSQL\e[0m:\e[90m\w\e[0m\n$ ' +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' diff --git a/Docker/mysql/inputrc b/Docker/mysql/inputrc new file mode 100644 index 0000000..db8d91d --- /dev/null +++ b/Docker/mysql/inputrc @@ -0,0 +1,2 @@ +set show-all-if-ambiguous on +set completion-ignore-case on diff --git a/Docker/mysql/mysql.cnf b/Docker/mysql/mysql.cnf new file mode 100644 index 0000000..0553107 --- /dev/null +++ b/Docker/mysql/mysql.cnf @@ -0,0 +1,12 @@ +[client] +default-character-set=utf8 + +[mysqld] +max_allowed_packet=500M + +collation-server = utf8_unicode_ci +init-connect='SET NAMES utf8' +character-set-server = utf8 + +[mysql] +default-character-set=utf8 diff --git a/Docker/nginx/Dockerfile b/Docker/nginx/Dockerfile new file mode 100644 index 0000000..aa3e544 --- /dev/null +++ b/Docker/nginx/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx:latest + +COPY ./default.conf /etc/nginx/conf.d/default.conf +COPY ./bashrc /root/.bashrc +COPY ./inputrc /root/.inputrc diff --git a/Docker/nginx/bashrc b/Docker/nginx/bashrc new file mode 100644 index 0000000..74d78f9 --- /dev/null +++ b/Docker/nginx/bashrc @@ -0,0 +1,3 @@ +PS1='\e[36m\e[1mNGINX\e[0m:\e[90m\w\e[0m\n$ ' +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' diff --git a/Docker/nginx/default.conf b/Docker/nginx/default.conf new file mode 100644 index 0000000..4d70b20 --- /dev/null +++ b/Docker/nginx/default.conf @@ -0,0 +1,61 @@ +server { + listen 80; + root /var/www/html/performance-art.fr/public_html; + index index.html index.php; + server_name dev.performance-art.fr; + + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + access_log on; + error_log /var/log/nginx/error.log error; + + sendfile off; + + client_max_body_size 100m; + + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass phpd7:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_intercept_errors off; + fastcgi_buffer_size 16k; + fastcgi_buffers 4 16k; + fastcgi_read_timeout 150; + } + + location ~ /\.ht { + deny all; + } +} + +server { + listen 80; + root /var/www/html/performance-art.fr/static_html; + server_name static.performance-art.fr; + + index index.html index.js index.css index.json index.woff index.ttf; # index.ico index.jpg index.png index.gif index.jpeg + + # rewrite ^/modules/(.*)\.(css|js)$ /modules/$1/index.$2 last; + # rewrite ^/sites/all/modules/(.*)\.(css|js)$ /sites/all/modules/$1/index.$2 last; + rewrite ^/(.*)/(.*)\.(css|js|png|woff|ttf|ico|gif)$ /$1/$2/index.$3; + rewrite ^/analytics.js$ /analytics/index.js; + rewrite ^/sites/default/files/styles/(.*)\.(ico|jpeg|jpg|gif|png)$ /sites/default/files/styles/$1/index.$2 last; + rewrite ^/sites/all/themes/gui/perfarttimeline/images/blank.gif$ /sites/all/themes/gui/perfarttimeline/images/blank/index.gif last; + + + charset utf-8; + + access_log on; + error_log /var/log/nginx/error.log error; + + +} diff --git a/Docker/nginx/inputrc b/Docker/nginx/inputrc new file mode 100644 index 0000000..db8d91d --- /dev/null +++ b/Docker/nginx/inputrc @@ -0,0 +1,2 @@ +set show-all-if-ambiguous on +set completion-ignore-case on diff --git a/Docker/nginx_static/Dockerfile b/Docker/nginx_static/Dockerfile new file mode 100644 index 0000000..aa3e544 --- /dev/null +++ b/Docker/nginx_static/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx:latest + +COPY ./default.conf /etc/nginx/conf.d/default.conf +COPY ./bashrc /root/.bashrc +COPY ./inputrc /root/.inputrc diff --git a/Docker/nginx_static/bashrc b/Docker/nginx_static/bashrc new file mode 100644 index 0000000..74d78f9 --- /dev/null +++ b/Docker/nginx_static/bashrc @@ -0,0 +1,3 @@ +PS1='\e[36m\e[1mNGINX\e[0m:\e[90m\w\e[0m\n$ ' +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' diff --git a/Docker/nginx_static/default.conf b/Docker/nginx_static/default.conf new file mode 100644 index 0000000..5e0b8e6 --- /dev/null +++ b/Docker/nginx_static/default.conf @@ -0,0 +1,16 @@ +server { + listen 80; + root /var/www/html/performance-art.fr/static_html; + index index.html index.js index.css index.json index.woff index.ttf index.png index.gif; + server_name static.performance-art.fr; + + rewrite ^/(fr|en)/(sites|modules|misc)/(.*)$ /$2/$3 last; + rewrite ^/(fr|en)/perfart/ajax/(.*)$ /$1/perfart/ajax/$2.json last; + + charset utf-8; + + access_log on; + error_log /var/log/nginx/error.log error; + + +} diff --git a/Docker/nginx_static/inputrc b/Docker/nginx_static/inputrc new file mode 100644 index 0000000..db8d91d --- /dev/null +++ b/Docker/nginx_static/inputrc @@ -0,0 +1,2 @@ +set show-all-if-ambiguous on +set completion-ignore-case on diff --git a/Docker/npm/Dockerfile b/Docker/npm/Dockerfile new file mode 100644 index 0000000..8915447 --- /dev/null +++ b/Docker/npm/Dockerfile @@ -0,0 +1,30 @@ +FROM node:lts-alpine + +RUN apk update && apk --no-cache add shadow && \ + usermod -u 1001 node && \ + groupmod -g 1001 node + +RUN find / -group 1000 -exec chgrp -h node {} \; +RUN find / -user 1000 -exec chown -h node {} \; + +ARG USER_UID +ARG USER_UNAME +ARG USER_GID +ARG USER_GNAME + + +# RUN addgroup -g 1000 gdp && \ + # adduser -h /home/gdp -D -u 1000 gdp && \ +RUN adduser -u ${USER_UID} -G users -s /bin/sh -D ${USER_UNAME} + # chown -R gdp:gdp /home/gdp + +USER ${USER_UNAME} + +COPY ./bashrc /home/${USER_UNAME}/.bashrc +COPY ./inputrc /home/${USER_UNAME}/.inputrc + +COPY ./client-entrypoint.sh /usr/local/bin +USER root +RUN chmod +x /usr/local/bin/client-entrypoint.sh +USER ${USER_UNAME} +CMD ["/bin/sh","/usr/local/bin/client-entrypoint.sh"] diff --git a/Docker/npm/bashrc b/Docker/npm/bashrc new file mode 100644 index 0000000..c5b03d2 --- /dev/null +++ b/Docker/npm/bashrc @@ -0,0 +1,3 @@ +PS1='\e[36m\e[1mNODE\e[0m:\e[90m\w\e[0m\n$ ' +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' diff --git a/Docker/npm/client-entrypoint.sh b/Docker/npm/client-entrypoint.sh new file mode 100644 index 0000000..6df0c1a --- /dev/null +++ b/Docker/npm/client-entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# cat /etc/passwd|grep 1000 +cd /app + +# echo "Cleaning node_modules" +# rm -rf node_modules +# +# echo "Cleaning npm cache" +# npm cache clean --f +# +# echo "Npm install" +# npm install + +echo "Npm Clean Install" +npm ci + +echo "Run npm dev" +npm run dev diff --git a/Docker/npm/inputrc b/Docker/npm/inputrc new file mode 100644 index 0000000..db8d91d --- /dev/null +++ b/Docker/npm/inputrc @@ -0,0 +1,2 @@ +set show-all-if-ambiguous on +set completion-ignore-case on diff --git a/Docker/php/Dockerfile b/Docker/php/Dockerfile new file mode 100644 index 0000000..0f152cf --- /dev/null +++ b/Docker/php/Dockerfile @@ -0,0 +1,74 @@ +FROM php:7.3-fpm + +RUN apt-get update && apt-get install -y \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libmcrypt-dev \ + libpng-dev \ + mysql-client \ + zip \ + libzip-dev && \ + # docker-php-ext-install -j$(nproc) iconv && \ + docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + apt-get install -y imagemagick libmagickwand-dev && \ + pecl install imagick && docker-php-ext-enable imagick && \ + docker-php-ext-install -j$(nproc) gd && \ + docker-php-ext-install pdo_mysql zip && \ + docker-php-ext-install opcache && \ + docker-php-ext-install bcmath && \ + apt-get install -y git vim && \ + pecl install redis-4.3.0 && \ + pecl install xdebug-2.7.0 && \ + docker-php-ext-enable redis xdebug + +RUN export COMPOSER_HOME=/usr/local/composer && \ + curl -sS https://getcomposer.org/installer \ + | php -- --install-dir=/usr/local/bin --filename=composer + # in this case (D7) drush launcher is not working don't know why. + # Replaced by an alias of drush installed with composer + # https://www.drupal.org/node/1302418#comment-10710726 + # curl https://drupalconsole.com/installer \ + # -L -o /usr/local/bin/drupal && \ + # chmod +x /usr/local/bin/drupal && \ + # curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar \ + # -L -o /usr/local/bin/drush && \ + # chmod +x /usr/local/bin/drush + +# RUN apt-get install -y curl && \ +# curl -sL https://deb.nodesource.com/setup_12.x | bash - && \ +# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ +# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ +# apt-get update && \ +# apt-get install -y nodejs yarn + +RUN apt-get install -y rsyslog +COPY ./rsyslog-drupal.conf /etc/rsyslog.d/drupal.conf +# ENTRYPOINT ["sh", "-c", "service rsyslog start ; tail -f /dev/null"] + +COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini +# COPY ./php-fpm-custom.conf /usr/local/etc/php-fpm.d/php-fpm-custom.conf + +# COPY ./bashrc /root/.bashrc +# COPY ./inputrc /root/.inputrc + + +ARG USER_UID +ARG USER_UNAME +ARG USER_GID +ARG USER_GNAME + +RUN if getent group ${USER_GNAME} ; then groupdel ${USER_GNAME}; fi &&\ + groupadd -g ${USER_GID} ${USER_GNAME} &&\ + useradd -l -u ${USER_UID} -g ${USER_GNAME} ${USER_UNAME} &&\ + install -d -m 0755 -o ${USER_UNAME} -g ${USER_GNAME} /home/${USER_UNAME} &&\ + chown --changes --silent --no-dereference --recursive \ + --from=33:33 ${USER_UID}:${USER_GID} \ + /home/${USER_UNAME} + # /.composer \ + # /var/run/php-fpm \ + # /var/lib/php/sessions \ + +COPY ./bashrc /home/${USER_UNAME}/.bashrc +COPY ./inputrc /home/${USER_UNAME}/.inputrc + +USER ${USER_UNAME} diff --git a/Docker/php/bashrc b/Docker/php/bashrc new file mode 100644 index 0000000..cf0be6f --- /dev/null +++ b/Docker/php/bashrc @@ -0,0 +1,6 @@ + +PS1='\e[36m\e[1mPHP-7.3\e[0m:\e[90m\w\e[0m\n$ ' +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' + +alias drush="php ./vendor/bin/drush" diff --git a/Docker/php/inputrc b/Docker/php/inputrc new file mode 100644 index 0000000..db8d91d --- /dev/null +++ b/Docker/php/inputrc @@ -0,0 +1,2 @@ +set show-all-if-ambiguous on +set completion-ignore-case on diff --git a/Docker/php/php-custom.ini b/Docker/php/php-custom.ini new file mode 100644 index 0000000..8db0ca2 --- /dev/null +++ b/Docker/php/php-custom.ini @@ -0,0 +1,9 @@ +memory_limit = 2048M +upload_max_filesize = 50M +post_max_size = 50M +;max_execution_time = 150 + +; Log level +; Possible Values: alert, error, warning, notice, debug +; Default Value: notice +log_level = debug diff --git a/Docker/php/rsyslog-drupal.conf b/Docker/php/rsyslog-drupal.conf new file mode 100644 index 0000000..6489ad4 --- /dev/null +++ b/Docker/php/rsyslog-drupal.conf @@ -0,0 +1 @@ +local7.* /var/log/drupal.log diff --git a/Docker/redis/Dockerfile b/Docker/redis/Dockerfile new file mode 100644 index 0000000..cdd3571 --- /dev/null +++ b/Docker/redis/Dockerfile @@ -0,0 +1,3 @@ +FROM redis:4 +COPY redis.conf /usr/local/etc/redis/redis.conf +CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ] \ No newline at end of file diff --git a/Docker/redis/redis.conf b/Docker/redis/redis.conf new file mode 100644 index 0000000..9cd0f14 --- /dev/null +++ b/Docker/redis/redis.conf @@ -0,0 +1,2 @@ +maxmemory 1gb +maxmemory-policy allkeys-lru \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d7c77a9 --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +#!/usr/bin/make + +SHELL = /bin/sh + +USER_UID := $(shell id -u) +USER_UNAME := $(shell id -un) +USER_GID := $(shell id -g) +USER_GNAME := $(shell id -gn) + +DATE_NOW := $(shell date '+%Y-%m-%d_%H%M%S') + +export USER_UID +export USER_UNAME +export USER_GID +export USER_GNAME + +build: + docker-compose build --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) + +buildnc: + docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) + +buildncnginx: + docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) nginx + +buildncnginx_static: + docker-compose -f docker-compose-static.yml build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) nginx_static + +up: + docker-compose up -d + +up_static: + docker-compose -f docker-compose-static.yml up -d + +down_static: + docker-compose -f docker-compose-static.yml down + + +restart_nginx: + docker-compose restart nginx + +restart_nginx_static: + docker-compose -f docker-compose-static.yml restart nginx_static + +# upbuild: +# docker-compose up -d --build + +ps: + docker-compose ps + +logs: + docker-compose logs -f + +down: + docker-compose down + +exec_phpd7: + docker exec -it clameurs-phpd7-1 bash + +exec_mysqld7: + docker exec -it clameurs-mysqld7-1 bash + +exec_nginx: + docker exec -it clameurs-nginx-1 bash +exec_npm: + docker exec -it clameurs-npm-1 sh + +dump_d7_db: + docker exec clameurs-mysqld7-1 sh -c 'exec mysqldump -uroot -pperfart perfart' > ./ressources/perfart_d7-$(DATE_NOW)-local.sql diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c26b28 --- /dev/null +++ b/README.md @@ -0,0 +1,184 @@ + +# esadhar.fr Docker Environement +esadhar.fr powered by druapl 7 in docker environement (nginx, php:7-fpm+drush, phpmyadmin, redis) + +## Install docker +```sh +sudo pacman -S docker docker-compose docker-machine +``` + +## Clone this repos + +this will clone this repos (main docker environement) and the edlp drupal 8 source code (without sites/default folder) + +```sh +git clone --recursive -o esadhar.net https://esadhar.net/gogs/bachir/docker-esadhar-fr.git +``` + +### setup /sites/default/settings.php + +```sh +cp -r ressources/default public_html_d7/sites/ +``` + +### get the sites/default/files folder +get the files from where you have it and rsync it to public_html_d7/sites/default/files/ + +## Mysql +Copy your-sql-dump.sql into ./ressources/esadhar_d7.sql +It will be automaticly imported into the mysql container db (only) on the first ```make up``` + +## Hosts and reverse proxy + +add to your /etc/hosts : +``` +127.0.0.1 dev.d7.esadhar.fr +127.0.0.1 dev.phpmyadmin.d7.esadhar.fr +``` +### apache +configure your apache vhosts to add a reverse proxy that will redirect the dev.d7.esadhar.fr to our container +```apache + + ServerName dev.esadhar.fr + ProxyPass / http://127.0.0.1:8880/ + ProxyPassReverse / http://127.0.0.1:8880/ + ProxyRequests Off + ProxyPreserveHost On + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + +``` +```apache + + ServerName dev.phpmyadmin.esadhar.fr + ProxyPass / http://127.0.0.1:8881/ + ProxyPassReverse / http://127.0.0.1:8881/ + ProxyRequests Off + ProxyPreserveHost On + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + +``` + +### nginx +```nginx +server { + listen 80; + server_name dev.d7.esadhar.fr; + + location / { + proxy_pass http://127.0.0.1:8880; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + } +} +server { + listen 80; + server_name dev.phpmyadmin.d7.esadhar.fr; + + location / { + proxy_pass http://127.0.0.1:8881; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_buffer_size 128k; + proxy_buffers 4 256k; + proxy_busy_buffers_size 256k; + } +} +``` + +## Docker + +### build +only before the first run (may take some time) +```sh +make build +``` +### run +then each time you want to launch the app +```sh +make up +``` +Be aware that a first up, since the db is empty, it will be populated with your file db.sql. It may take some time depending of your db size. + + +## Visualize +You can now visit http://dev.d7.esadhar.fr on your browser + +## Coding +### drush +you can access to drush by loging into the php container +```sh +make exec_phpd7 +``` +once inside the php container you can use drush as usual + +### gulp +Dev process needs gulp to run in: +- public_html/sites/all/modules/custom/materio/ +- public_html/sites/all/themes/custom/materio/ + if you have to modifie js or scss source code, you need to do in each of these 2 folder: +```sh +npm install +gulp +``` + +## Makefile + +do not use directly docker or docker-compose to run this instance +use make instead like ```make up``` + +```makefile +build: + docker-compose build --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) + +buildnc: + docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) + +up: + docker-compose up -d + +upbuild: + docker-compose up -d --build + +ps: + docker-compose ps + +logs: + docker-compose logs -f + +down: + docker-compose down + +exec_phpd7: + docker exec -it esadharfr_phpd7_1 bash + +exec_mysqld7: + docker exec -it esadharfr_mysqld7_1 bash + +``` + + +# sources +https://www.ostraining.com/blog/drupal/docker/ + +http://tech.osteel.me/posts/2017/01/15/how-to-use-docker-for-local-web-development-an-update.html + +https://mmenozzi.github.io/2016/01/22/php-web-development-with-docker/ + +https://dzone.com/articles/continuous-drupal-maintaining-a-drupal-website-wit// + +https://github.com/glaux/drupal8docker + +https://www.jeffgeerling.com/blogs/jeff-geerling/drupal-8-redis-php-7-nginx-and + +https://chromatichq.com/blog/configuring-redis-caching-drupal-8 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..502243a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,93 @@ +version: "3.5" + +services: + mysqld7: + image: mariadb:latest + volumes: + - db-data-d7:/var/lib/mysql + - ./Docker/mysql/mysql.cnf:/etc/mysql/conf.d/custom.cnf:ro + - ./Docker/mysql/bashrc:/root/.bashrc:ro + networks: + - database + hostname: mysqld7 + environment: + MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}" + MYSQL_DATABASE: "${DB_NAME}" + MYSQL_USER: "${DB_USERNAME}" + MYSQL_PASSWORD: "${DB_PASSWORD}" + + redisd7: + image: redis:4 + command: redis-server /usr/local/etc/redis.conf + volumes: + - redis-data-d7:/data + - ./Docker/redis/redis.conf:/usr/local/etc/redis.conf + networks: + - redisd7 + ports: + - "6389" + + phpd7: + build: ./Docker/php/ + expose: + - 9000 + user: ${USER_UID}:${USER_GID} + volumes: + - php-data-d7:/home/${USER_UNAME} + - "${D7_ROOT}:/var/www/html/clameurs-lawebserie.fr/public_html" + - "${LOG_ROOT}/php:/var/log:rw" + - "${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini" + working_dir: "/var/www/html/clameurs-lawebserie.fr/public_html" + networks: + - database + - redisd7 + - server + depends_on: + - mysqld7 + - redisd7 + + phpmyadmin: + image: phpmyadmin/phpmyadmin + ports: + - 8991:80 + networks: + - database + depends_on: + - mysqld7 + environment: + PMA_HOSTS: mysqld7 + + nginx: + build: ./Docker/nginx/ + ports: + - 8990:80 + volumes: + - "${D7_ROOT}:/var/www/html/clameurs-lawebserie.fr/public_html" + - "${LOG_ROOT}:/var/log:rw" + - "${STATIC_ROOT}:/var/www/html/clameurs-lawebserie.fr/static_html" + working_dir: "/var/www/html/clameurs-lawebserie.fr/public_html" + networks: + - server + depends_on: + - phpd7 + + # npm: + # build: ./Docker/npm + # user: ${USER_UID}:${USER_GID} + # volumes: + # - "${D7_THEME_ROOT}:/app" + # - npm-user-data:/home/${USER_UNAME} + # # ports: + # # - 8788:8788 + # working_dir: "/app" + +volumes: + db-data-d7: + redis-data-d7: + php-data-d7: + # npm-user-data: + +networks: + database: + redisd7: + server: diff --git a/ressources/default/settings.php b/ressources/default/settings.php new file mode 100644 index 0000000..9adf1f5 --- /dev/null +++ b/ressources/default/settings.php @@ -0,0 +1,483 @@ + 'mysql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * 'port' => 3306, + * 'prefix' => 'myprefix_', + * 'collation' => 'utf8_general_ci', + * ); + * @endcode + * + * The "driver" property indicates what Drupal database driver the + * connection should use. This is usually the same as the name of the + * database type, such as mysql or sqlite, but not always. The other + * properties will vary depending on the driver. For SQLite, you must + * specify a database file name in a directory that is writable by the + * webserver. For most other drivers, you must specify a + * username, password, host, and database name. + * + * Some database engines support transactions. In order to enable + * transaction support for a given database, set the 'transactions' key + * to TRUE. To disable it, set it to FALSE. Note that the default value + * varies by driver. For MySQL, the default is FALSE since MyISAM tables + * do not support transactions. + * + * For each database, you may optionally specify multiple "target" databases. + * A target database allows Drupal to try to send certain queries to a + * different database if it can but fall back to the default connection if not. + * That is useful for master/slave replication, as Drupal may try to connect + * to a slave server when appropriate and if one is not available will simply + * fall back to the single master server. + * + * The general format for the $databases array is as follows: + * @code + * $databases['default']['default'] = $info_array; + * $databases['default']['slave'][] = $info_array; + * $databases['default']['slave'][] = $info_array; + * $databases['extra']['default'] = $info_array; + * @endcode + * + * In the above example, $info_array is an array of settings described above. + * The first line sets a "default" database that has one master database + * (the second level default). The second and third lines create an array + * of potential slave databases. Drupal will select one at random for a given + * request as needed. The fourth line creates a new database with a name of + * "extra". + * + * For a single database configuration, the following is sufficient: + * @code + * $databases['default']['default'] = array( + * 'driver' => 'mysql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * 'prefix' => 'main_', + * 'collation' => 'utf8_general_ci', + * ); + * @endcode + * + * You can optionally set prefixes for some or all database table names + * by using the 'prefix' setting. If a prefix is specified, the table + * name will be prepended with its value. Be sure to use valid database + * characters only, usually alphanumeric and underscore. If no prefixes + * are desired, leave it as an empty string ''. + * + * To have all database names prefixed, set 'prefix' as a string: + * @code + * 'prefix' => 'main_', + * @endcode + * To provide prefixes for specific tables, set 'prefix' as an array. + * The array's keys are the table names and the values are the prefixes. + * The 'default' element is mandatory and holds the prefix for any tables + * not specified elsewhere in the array. Example: + * @code + * 'prefix' => array( + * 'default' => 'main_', + * 'users' => 'shared_', + * 'sessions' => 'shared_', + * 'role' => 'shared_', + * 'authmap' => 'shared_', + * ), + * @endcode + * You can also use a reference to a schema/database as a prefix. This maybe + * useful if your Drupal installation exists in a schema that is not the default + * or you want to access several databases from the same code base at the same + * time. + * Example: + * @code + * 'prefix' => array( + * 'default' => 'main.', + * 'users' => 'shared.', + * 'sessions' => 'shared.', + * 'role' => 'shared.', + * 'authmap' => 'shared.', + * ); + * @endcode + * NOTE: MySQL and SQLite's definition of a schema is a database. + * + * Database configuration format: + * @code + * $databases['default']['default'] = array( + * 'driver' => 'mysql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * 'prefix' => '', + * ); + * $databases['default']['default'] = array( + * 'driver' => 'pgsql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * 'prefix' => '', + * ); + * $databases['default']['default'] = array( + * 'driver' => 'sqlite', + * 'database' => '/path/to/databasefilename', + * ); + * @endcode + */ +$databases['default']['default'] = array( + 'driver' => 'mysql', + 'database' => 'materio_base_d7', + 'username' => 'root', + 'password' => 'materio', + 'host' => 'mysql', + 'prefix' => '', + 'collation' => 'utf8_general_ci', + ); + +/** + * Access control for update.php script. + * + * If you are updating your Drupal installation using the update.php script but + * are not logged in using either an account with the "Administer software + * updates" permission or the site maintenance account (the account that was + * created during installation), you will need to modify the access check + * statement below. Change the FALSE to a TRUE to disable the access check. + * After finishing the upgrade, be sure to open this file again and change the + * TRUE back to a FALSE! + */ +$update_free_access = FALSE; + +/** + * Salt for one-time login links and cancel links, form tokens, etc. + * + * This variable will be set to a random value by the installer. All one-time + * login links will be invalidated if the value is changed. Note that this + * variable must have the same value on every web server. If this variable is + * empty, a hash of the serialized database credentials will be used as a + * fallback salt. + * + * For enhanced security, you may set this variable to a value using the + * contents of a file outside your docroot that is never saved together + * with any backups of your Drupal files and database. + * + * Example: + * $drupal_hash_salt = file_get_contents('/home/example/salt.txt'); + * + */ +$drupal_hash_salt = ''; + +/** + * Base URL (optional). + * + * If Drupal is generating incorrect URLs on your site, which could + * be in HTML headers (links to CSS and JS files) or visible links on pages + * (such as in menus), uncomment the Base URL statement below (remove the + * leading hash sign) and fill in the absolute URL to your Drupal installation. + * + * You might also want to force users to use a given domain. + * See the .htaccess file for more information. + * + * Examples: + * $base_url = 'http://www.example.com'; + * $base_url = 'http://www.example.com:8888'; + * $base_url = 'http://www.example.com/drupal'; + * $base_url = 'https://www.example.com:8888/drupal'; + * + * It is not allowed to have a trailing slash; Drupal will add it + * for you. + */ +// $base_url = 'http://dev.materio.com'; // NO trailing slash! + +/** + * PHP settings: + * + * To see what PHP settings are possible, including whether they can be set at + * runtime (by using ini_set()), read the PHP documentation: + * http://www.php.net/manual/en/ini.list.php + * See drupal_initialize_variables() in includes/bootstrap.inc for required + * runtime settings and the .htaccess file for non-runtime settings. Settings + * defined there should not be duplicated here so as to avoid conflict issues. + */ + +/** + * Some distributions of Linux (most notably Debian) ship their PHP + * installations with garbage collection (gc) disabled. Since Drupal depends on + * PHP's garbage collection for clearing sessions, ensure that garbage + * collection occurs by using the most common settings. + */ +ini_set('session.gc_probability', 1); +ini_set('session.gc_divisor', 100); + +/** + * Set session lifetime (in seconds), i.e. the time from the user's last visit + * to the active session may be deleted by the session garbage collector. When + * a session is deleted, authenticated users are logged out, and the contents + * of the user's $_SESSION variable is discarded. + */ +ini_set('session.gc_maxlifetime', 200000); + +/** + * Set session cookie lifetime (in seconds), i.e. the time from the session is + * created to the cookie expires, i.e. when the browser is expected to discard + * the cookie. The value 0 means "until the browser is closed". + */ +ini_set('session.cookie_lifetime', 2000000); + +/** + * If you encounter a situation where users post a large amount of text, and + * the result is stripped out upon viewing but can still be edited, Drupal's + * output filter may not have sufficient memory to process it. If you + * experience this issue, you may wish to uncomment the following two lines + * and increase the limits of these variables. For more information, see + * http://php.net/manual/en/pcre.configuration.php. + */ +# ini_set('pcre.backtrack_limit', 200000); +# ini_set('pcre.recursion_limit', 200000); + +/** + * Drupal automatically generates a unique session cookie name for each site + * based on on its full domain name. If you have multiple domains pointing at + * the same Drupal site, you can either redirect them all to a single domain + * (see comment in .htaccess), or uncomment the line below and specify their + * shared base domain. Doing so assures that users remain logged in as they + * cross between your various domains. + */ +$cookie_domain = 'dev.materio.com'; + +/** + * Variable overrides: + * + * To override specific entries in the 'variable' table for this site, + * set them here. You usually don't need to use this feature. This is + * useful in a configuration file for a vhost or directory, rather than + * the default settings.php. Any configuration setting from the 'variable' + * table can be given a new value. Note that any values you provide in + * these variable overrides will not be modifiable from the Drupal + * administration interface. + * + * The following overrides are examples: + * - site_name: Defines the site's name. + * - theme_default: Defines the default theme for this site. + * - anonymous: Defines the human-readable name of anonymous users. + * Remove the leading hash signs to enable. + */ + $conf['site_name'] = "materiO'"; +# $conf['theme_default'] = 'garland'; +# $conf['anonymous'] = 'Visitor'; + +/** + * A custom theme can be set for the offline page. This applies when the site + * is explicitly set to maintenance mode through the administration page or when + * the database is inactive due to an error. It can be set through the + * 'maintenance_theme' key. The template file should also be copied into the + * theme. It is located inside 'modules/system/maintenance-page.tpl.php'. + * Note: This setting does not apply to installation and update pages. + */ +# $conf['maintenance_theme'] = 'bartik'; + +/** + * Enable this setting to determine the correct IP address of the remote + * client by examining information stored in the X-Forwarded-For headers. + * X-Forwarded-For headers are a standard mechanism for identifying client + * systems connecting through a reverse proxy server, such as Squid or + * Pound. Reverse proxy servers are often used to enhance the performance + * of heavily visited sites and may also provide other site caching, + * security or encryption benefits. If this Drupal installation operates + * behind a reverse proxy, this setting should be enabled so that correct + * IP address information is captured in Drupal's session management, + * logging, statistics and access management systems; if you are unsure + * about this setting, do not have a reverse proxy, or Drupal operates in + * a shared hosting environment, this setting should remain commented out. + */ +# $conf['reverse_proxy'] = TRUE; + +/** + * Set this value if your proxy server sends the client IP in a header other + * than X-Forwarded-For. + * + * The "X-Forwarded-For" header is a comma+space separated list of IP addresses, + * only the last one (the left-most) will be used. + */ +# $conf['reverse_proxy_header'] = 'HTTP_X_CLUSTER_CLIENT_IP'; + +/** + * reverse_proxy accepts an array of IP addresses. + * + * Each element of this array is the IP address of any of your reverse + * proxies. Filling this array Drupal will trust the information stored + * in the X-Forwarded-For headers only if Remote IP address is one of + * these, that is the request reaches the web server from one of your + * reverse proxies. Otherwise, the client could directly connect to + * your web server spoofing the X-Forwarded-For headers. + */ +# $conf['reverse_proxy_addresses'] = array('a.b.c.d', ...); + +/** + * Page caching: + * + * By default, Drupal sends a "Vary: Cookie" HTTP header for anonymous page + * views. This tells a HTTP proxy that it may return a page from its local + * cache without contacting the web server, if the user sends the same Cookie + * header as the user who originally requested the cached page. Without "Vary: + * Cookie", authenticated users would also be served the anonymous page from + * the cache. If the site has mostly anonymous users except a few known + * editors/administrators, the Vary header can be omitted. This allows for + * better caching in HTTP proxies (including reverse proxies), i.e. even if + * clients send different cookies, they still get content served from the cache + * if aggressive caching is enabled and the minimum cache time is non-zero. + * However, authenticated users should access the site directly (i.e. not use an + * HTTP proxy, and bypass the reverse proxy if one is used) in order to avoid + * getting cached pages from the proxy. + */ +# $conf['omit_vary_cookie'] = TRUE; + +/** + * CSS/JS aggregated file gzip compression: + * + * By default, when CSS or JS aggregation and clean URLs are enabled Drupal will + * store a gzip compressed (.gz) copy of the aggregated files. If this file is + * available then rewrite rules in the default .htaccess file will serve these + * files to browsers that accept gzip encoded content. This allows pages to load + * faster for these users and has minimal impact on server load. If you are + * using a webserver other than Apache httpd, or a caching reverse proxy that is + * configured to cache and compress these files itself you may want to uncomment + * one or both of the below lines, which will prevent gzip files being stored. + */ +# $conf['css_gzip_compression'] = FALSE; +# $conf['js_gzip_compression'] = FALSE; + +/** + * String overrides: + * + * To override specific strings on your site with or without enabling locale + * module, add an entry to this list. This functionality allows you to change + * a small number of your site's default English language interface strings. + * + * Remove the leading hash signs to enable. + */ +# $conf['locale_custom_strings_en'][''] = array( +# 'forum' => 'Discussion board', +# '@count min' => '@count minutes', +# ); + +/** + * + * IP blocking: + * + * To bypass database queries for denied IP addresses, use this setting. + * Drupal queries the {blocked_ips} table by default on every page request + * for both authenticated and anonymous users. This allows the system to + * block IP addresses from within the administrative interface and before any + * modules are loaded. However on high traffic websites you may want to avoid + * this query, allowing you to bypass database access altogether for anonymous + * users under certain caching configurations. + * + * If using this setting, you will need to add back any IP addresses which + * you may have blocked via the administrative interface. Each element of this + * array represents a blocked IP address. Uncommenting the array and leaving it + * empty will have the effect of disabling IP blocking on your site. + * + * Remove the leading hash signs to enable. + */ +# $conf['blocked_ips'] = array( +# 'a.b.c.d', +# ); + +/** + * Authorized file system operations: + * + * The Update manager module included with Drupal provides a mechanism for + * site administrators to securely install missing updates for the site + * directly through the web user interface by providing either SSH or FTP + * credentials. This allows the site to update the new files as the user who + * owns all the Drupal files, instead of as the user the webserver is running + * as. However, some sites might wish to disable this functionality, and only + * update the code directly via SSH or FTP themselves. This setting completely + * disables all functionality related to these authorized file operations. + * + * Remove the leading hash signs to disable. + */ +# $conf['allow_authorize_operations'] = FALSE; + +// $conf['cache'] = 0; +$conf['preprocess_js'] = 0; +$conf['preprocess_css'] = 0; + +$conf['session_limit_max'] = 10; + +$conf['maillog_send'] = 0; +$conf['enforce_limit'] = 'no'; + + +$conf['search_api_solr_overrides'] = array( + 'materio_solr3_en' => array( + 'name' => t('Materio EN Solr Server (Overridden)'), + 'options' => array( + 'host' => 'solr', + 'port' => 8983, + 'path' => '/solr/materio_base_en', + ), + ), + 'materio_solr3_fr' => array( + 'name' => t('Materio FR Solr Server (Overridden)'), + 'options' => array( + 'host' => 'solr', + 'port' => 8983, + 'path' => '/solr/materio_base_fr', + ), + ), +); diff --git a/ressources/xdebug.ini b/ressources/xdebug.ini new file mode 100644 index 0000000..cacbdbe --- /dev/null +++ b/ressources/xdebug.ini @@ -0,0 +1,18 @@ +[xdebug] +xdebug.remote_enable=1 +;Should use host.docker.internal but not working on linux +xdebug.remote_host=172.20.0.1 +;Not working on docker context +xdebug.remote_connect_back=0 +;9000 is already bound by php-fpm +xdebug.remote_port=9001 +xdebug.remote_handler=dbgp +xdebug.remote_mode=req +xdebug.remote_autostart=true +; ?=XDEBUG_SESSION_START=1 +;Log file is mounted on volume so you can follow it +xdebug.remote_log=/var/log/xdebug-error.log +xdebug.profiler_enable_trigger=1 +xdebug.profiler_enable=0 +xdebug.profiler_output_dir=/var/log/ +; Example: http://localhost:8080/test?XDEBUG_PROFILE=1 diff --git a/static/build_static.sh b/static/build_static.sh new file mode 100755 index 0000000..436356b --- /dev/null +++ b/static/build_static.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# http://httrack.kauler.com/help/User-defined_structure + +# httrack http://dev.performance-art.fr -O ./web -N "%h%p/%n/index%[page].%t" --near --mirror-wizard --quiet --do-not-log -%v2 -X -p7 --robots=0 --footer '' --sockets=99 −−max−rate=99999999 --disable-security-limits −−keep−alive + +httrack http://dev.performance-art.fr --path ./web --mirror-wizard --update --max-rate=9999999999999 --sockets=99 --near -N "%h%p/%n/index%[page].%t" --robots=0 --keep-alive --footer '' --display --do-not-log --quiet --disable-security-limits -p7 -K3 + +# --continue + +# httrack http://dev.performance-art.fr -O ./web -N "%h%p/%n%[page].%t" --near -WqQ%v --robots=0 --footer '' + +# remove the ajax block from home with sed + +# move the index @the right place +# mv web/dev.performance-art.fr/index/index.html web/dev.performance-art.fr/index.html + + +# as the index file moved, replace ../../ by ../ every-were +# find . -type f -name "*.html" -print0 | xargs -0 sed -i 's/\.\.\/\.\.\//\.\.\//g' +# grep -rlZ '\.\.\/\.\.\/' . | xargs -0 sed -i.bak 's/\.\.\/\.\.\//\.\.\//g' diff --git a/static/posthttrack.sh b/static/posthttrack.sh new file mode 100644 index 0000000..8984a80 --- /dev/null +++ b/static/posthttrack.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# remove the ajax block from home with sed (index.html, fr.html, en.html) + +# move external folders (e.g. ajax.googleapis.com) into the dev.performance-art.fr