Skip to content

Commit

Permalink
Merge branch 'release/2.3.14' into craft-webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Oct 25, 2020
2 parents 22ad627 + 99c52ee commit 3d8c8ac
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# ASSETS
/cms/web/assets/*
/cms/web/cpresources/*
/cms/web/dist/*

# BUILD FILES
node_modules
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# nystudio107/craft Change Log

## 2.3.14 - 2020.10.25
### Added
* Added `/cms/web/dist/*` to root `.gitignore`
* Use a separate php_xdebug container only when the `XDEBUG_SESSION` cookie is set, so regular requests are more performant

## 2.3.13 - 2020.09.25
### Added
* Add `run_queue.sh` keep alive script
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "craftcms/craft",
"description": "nystudio107 Craft 3.4 CMS scaffolding project",
"version": "2.3.13",
"version": "2.3.14",
"keywords": [
"craft",
"cms",
Expand Down
21 changes: 19 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ services:
volumes:
- cpresources:/var/www/project/cms/web/cpresources
- ./cms/web:/var/www/project/cms/web:cached
# php - personal home page
# php - run php-fpm
php:
build: &php-build
context: ./docker-config/php-dev-craft
context: ./docker-config/php-prod-craft
dockerfile: ./Dockerfile
depends_on:
- "mariadb"
Expand All @@ -38,6 +38,23 @@ services:
- ./cms:/var/www/project/cms:cached
- ./cms/vendor:/var/www/project/cms/vendor:delegated
- ./cms/storage/logs:/var/www/project/cms/storage/logs:delegated
# php - run php-fpm with xdebug
php_xdebug:
build:
context: ./docker-config/php-dev-craft
dockerfile: ./Dockerfile
depends_on:
- "php"
env_file:
*env
expose:
- "9000"
init: true
links:
*php-links
user: www-data
volumes:
*php-volumes
# queue - runs queue jobs via php craft queue/listen
queue:
build:
Expand Down
10 changes: 9 additions & 1 deletion docker-config/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# default Docker DNS server
resolver 127.0.0.11;

map $cookie_XDEBUG_SESSION $my_fastcgi_pass {
default php_xdebug;
'' php;
}

server {
listen 80;
listen [::]:80;
Expand Down Expand Up @@ -25,7 +33,7 @@ server {
location ~ [^/]\.php(/|$) {
try_files $uri $uri/ /index.php?$query_string;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_pass $my_fastcgi_pass:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
Expand Down
4 changes: 2 additions & 2 deletions docker-config/php-dev-base/xdebug.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_port=9001
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=0
xdebug.remote_connect_back=1
xdebug.remote_host=host.docker.internal
xdebug.remote_autostart=1
24 changes: 1 addition & 23 deletions docker-config/php-dev-craft/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get update \
pdo_mysql \
&& \
# Install Composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer \
curl -sS https://getcomposer.org/installer | php -- --version=1.10.16 --install-dir=/usr/local/bin/ --filename=composer \
# Clean apt repo caches that don't need to be part of the image
&& \
apt-get clean \
Expand All @@ -26,9 +26,6 @@ RUN apt-get update \

WORKDIR /var/www/project

COPY ./run_queue.sh .
RUN chmod a+x run_queue.sh

# Create the storage directory and make it writeable by PHP
RUN mkdir -p /var/www/project/cms/storage && \
mkdir -p /var/www/project/cms/storage/runtime && \
Expand All @@ -39,22 +36,3 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \
chown -R www-data:www-data /var/www/project/cms/web/cpresources

WORKDIR /var/www/project/cms

# Force permissions, update Craft, and start php-fpm

# Do a `composer install` without running any Composer scripts
# - If `composer.lock` is present, it will install what is in the lock file
# - If `composer.lock` is missing, it will update to the latest dependencies
# and create the `composer.lock` file
# This automatic running adds to the startup overhead of `docker-compose up`
# but saves far more time in not having to deal with out of sync versions
# when working with teams or multiple environments
CMD composer install --no-scripts --optimize-autoloader --no-interaction \
&& \
chown -R www-data:www-data /var/www/project/cms/vendor \
&& \
chown -R www-data:www-data /var/www/project/cms/storage \
&& \
composer craft-update \
&& \
php-fpm
74 changes: 74 additions & 0 deletions docker-config/php-prod-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
FROM php:7.3-fpm

# Install packages
RUN apt-get update \
&& \
# apt Debian packages
apt-get install -y \
apt-utils \
autoconf \
ca-certificates \
curl \
g++ \
libbz2-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libpq-dev \
libssl-dev \
libicu-dev \
libmagickwand-dev \
libzip-dev \
unzip \
zip \
&& \
# pecl PHP extensions
pecl install \
imagick-3.4.4 \
redis \
&& \
# Configure PHP extensions
docker-php-ext-configure \
gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& \
# Install PHP extensions
docker-php-ext-install \
bcmath \
bz2 \
exif \
ftp \
gettext \
gd \
iconv \
intl \
mbstring \
opcache \
pdo \
shmop \
sockets \
sysvmsg \
sysvsem \
sysvshm \
zip \
&& \
# Enable PHP extensions
docker-php-ext-enable \
imagick \
redis \
# Clean apt repo caches that don't need to be part of the image
&& \
apt-get clean \
&& \
# Clean out directories that don't need to be part of the image
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Append our php.ini overrides to the end of the file
RUN echo "upload_max_filesize = 10M" > /usr/local/etc/php/php.ini && \
echo "post_max_size = 10M" >> /usr/local/etc/php/php.ini && \
echo "max_execution_time = 300" >> /usr/local/etc/php/php.ini && \
echo "memory_limit = 256M" >> /usr/local/etc/php/php.ini && \
echo "opcache.revalidate_freq = 0" >> /usr/local/etc/php/php.ini && \
echo "opcache.validate_timestamps = 1" >> /usr/local/etc/php/php.ini

# Copy the `zzz-docker.conf` file into place for php-fpm
COPY ./zzz-docker.conf /usr/local/etc/php-fpm.d/zzz-docker.conf
4 changes: 4 additions & 0 deletions docker-config/php-prod-base/zzz-docker.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[www]
pm.max_children = 10
pm.process_idle_timeout = 10s
pm.max_requests = 1000
56 changes: 56 additions & 0 deletions docker-config/php-prod-craft/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM nystudio107/php-prod-base

# Install packages
RUN apt-get update \
&& \
# apt Debian packages
apt-get install -y \
nano \
&& \
# Install PHP extensions
docker-php-ext-install \
pdo_mysql \
&& \
# Install Composer
curl -sS https://getcomposer.org/installer | php -- --version=1.10.16 --install-dir=/usr/local/bin/ --filename=composer \
# Clean apt repo caches that don't need to be part of the image
&& \
apt-get clean \
&& \
# Clean out directories that don't need to be part of the image
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /var/www/project

COPY ./run_queue.sh .
RUN chmod a+x run_queue.sh

# Create the storage directory and make it writeable by PHP
RUN mkdir -p /var/www/project/cms/storage && \
mkdir -p /var/www/project/cms/storage/runtime && \
chown -R www-data:www-data /var/www/project/cms/storage

# Create the cpresources directory and make it writeable by PHP
RUN mkdir -p /var/www/project/cms/web/cpresources && \
chown -R www-data:www-data /var/www/project/cms/web/cpresources

WORKDIR /var/www/project/cms

# Force permissions, update Craft, and start php-fpm

# Do a `composer install` without running any Composer scripts
# - If `composer.lock` is present, it will install what is in the lock file
# - If `composer.lock` is missing, it will update to the latest dependencies
# and create the `composer.lock` file
# This automatic running adds to the startup overhead of `docker-compose up`
# but saves far more time in not having to deal with out of sync versions
# when working with teams or multiple environments
CMD composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction \
&& \
chown -R www-data:www-data /var/www/project/cms/vendor \
&& \
chown -R www-data:www-data /var/www/project/cms/storage \
&& \
composer craft-update \
&& \
php-fpm
File renamed without changes.

0 comments on commit 3d8c8ac

Please sign in to comment.