devnely-org / s2i-php-container

PHP container images based on Red Hat Software Collections and intended for OpenShift and general usage, that provide a platform for building and running PHP applications. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.
http://softwarecollections.org
Apache License 2.0
0 stars 0 forks source link

add_fpm_wpi_msyqlclient_silo #3

Open jemiliolopez opened 4 years ago

jemiliolopez commented 4 years ago

Creamos la rama #3_add_fpm_wpi_mysqlclient donde sustanciaremos las nuevas propiedades. Add fpm (FastCGI): En 7.2/Dockerfile:

Instalamos wp-cli RUN set -x && cd /tmp && \ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \ php wp-cli.phar --info && \ chmod +x wp-cli.phar && \ mv wp-cli.phar /usr/local/bin/wp && \ wp --info

jemiliolopez commented 4 years ago

Como podemos comprobar en 7.2/Dockerfile: we expone el port 9000 to fpm add to path /opt/rh/rh-mysql80/root/usr/bin/:/opt/app-root/src/.npm-global/bin/:/opt/app-root/src/node_modules/.bin/ (nodejs) New package for fpm : rh-php72-php-fpm New package for mysqlclient: rh-mysql80-mysql

Variable SERVER_NAME; necesaria para apache. Le ponemos un nombre por defecto. Al desplegar podemos cambiarlo. Para configurar apache debemos añadir el archivo s2i-php-container/7.2/root/usr/share/container-scripts/php/httpd-cnf/00-servername.conf: ServerName "${SERVER_NAME}"

Varialble WP_INSTALL_VERSION la version de wordpress que vamos a instalar.

Las variables que empiezan por DB son obligatorias, por los que no tienen valores por defecto debemos de asignarlos en el despliegue.

jemiliolopez commented 4 years ago

Add to file 7.2/root/usr/libexec/container-setup. Here make folder /silo y changed permissions.

mkdir -p /silo/wordpress

chmod -R a+rwX /silo && \

chmod -R ug+r  /silo && \
    chmod -R ug+r  /silo && \
    chown -R 1001:0 /silo && \
    chown -R 1001:0 /silo

chmod -R a+rwx /etc/opt/rh/rh-php${PHP_VER_SHORT}/php.d chmod a+rw /etc/opt/rh/rh-php${PHP_VER_SHORT}/php.ini chmod a+rwX /var/opt/rh/rh-php${PHP_VER_SHORT}/run/php-fpm chmod -R a+rwX /var/opt/rh/rh-php72/lib/php

jemiliolopez commented 4 years ago

Changes into 7.2/root/usr/share/container-scripts/php/common.sh:

config_modules_conf() {

}

\ StartServers 3 MinSpareThreads 16 MaxSpareThreads 250 ThreadsPerChild 25 MaxRequestWorkers 400 MaxConnectionsPerChild 100 \

jemiliolopez commented 4 years ago

Too change files 7.2/s2i/bin/run and 7.2/s2i/bin/run

7.2/s2i/bin/assemble

++++ shopt -s dotglob ## para mover los archivos ocultos

echo "---> Installing application source..." ++++ mv /tmp/src/* ./

mv /tmp/src/.htcaccess ./ mv /tmp/src/gulpfile.js ./

mkdir -p /opt/app-root/s2i

mv /tmp/src/builder/assemble /opt/app-root/s2i mv /tmp/src/builder/run /opt/app-root/s2i mv /tmp/src/builder/save-artifacts /opt/app-root/s2i

download-wp () { # Download en /opt/app-root/src if [ -z "$WP_INSTALL_VERSION" ]; then \ # wp core download --locale='es_ES' --version='latest' --path='/opt/app-root/src' wp core download --version='latest' --path='/opt/app-root/src' else \ # wp core download --locale='es_ES' --version="$WP_INSTALL_VERSION" --path='/opt/app-root/src' wp core download --version="$WP_INSTALL_VERSION" --path='/opt/app-root/src' fi }

npm update npm init --yes npm install gulp --save npm install fs-extra --save npm install gulp-concat --save

#Instala wordpress en /opt/app-root/src. Eliminamos locale porque para las versiones latest igualno existe el paquete.

download-wp

process_extending_files ./php-post-assemble/ ${PHP_CONTAINER_SCRIPTS_PATH}/post-assemble/

fix-permissions /opt/app-root fix-permissions ./ fix-permissions /silo

fix-permissions ${HTTPD_CONFIGURATION_PATH}

7.2/s2i/bin/run

exec /bin/bash -c 'php-fpm && httpd -D FOREGROUND'