Open jemiliolopez opened 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.
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
Changes into 7.2/root/usr/share/container-scripts/php/common.sh:
config_modules_conf() {
}
config_fpm() {
echo "<FilesMatch .php$>" >> /etc/httpd/conf.d/rh-php72-php.conf echo ' SetHandler "proxy:fcgi://127.0.0.1:9000"' >> /etc/httpd/conf.d/rh-php72-php.conf echo "" >> /etc/httpd/conf.d/rh-php72-php.conf sed -i '/listen.allowed_clients/s/^/;/g' /etc/opt/rh/rh-php72/php-fpm.d/www.conf sed -i 's/^user.=.$/user = default/g' /etc/opt/rh/rh-php72/php-fpm.d/www.conf sed -i 's/^group.=.$/group = root/g' /etc/opt/rh/rh-php72/php-fpm.d/www.conf
\ # sed -i '/listen.allowed_clients/s/^/;/g' /etc/opt/rh/rh-php72/php-fpm.d/www.conf
# sed -i '/^.session.save_path.$/d' /etc/opt/rh/rh-php72/php-fpm.d/www.conf # sed -i '/^.soap.wsdl_cache_dir.$/d' /etc/opt/rh/rh-php72/php-fpm.d/www.conf # sed -i '/^.opcache.file_cache.$/d' /etc/opt/rh/rh-php72/php-fpm.d/www.conf
# echo "php_value[session.save_path] = /tmp/session" >> /etc/opt/rh/rh-php72/php-fpm.d/www.conf \ # echo " php_value[soap.wsdl_cache_dir] = /tmp/wsdlcache" >> /etc/opt/rh/rh-php72/php-fpm.d/www.conf # echo "php_value[opcache.file_cache] = /tmp/opcache" >> /etc/opt/rh/rh-php72/php-fpm.d/www.conf } config_general() { config_httpd_conf config_ssl_conf config_modules_conf
Too changed 7.2/root/usr/share/container-scripts/php/httpd-cnf/50-mpm-tuning.off
\
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'
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