Skip to content

Commit 2975e82

Browse files
committed
Merge branch 'master' of github.com:BitBagCommerce/SyliusWishlistPlugin into feature/HM-1-sylius2-upgrade
# Conflicts: # .github/workflows/build.yml # .github/workflows/coding_standard.yml # composer.json # doc/01-installation.md # doc/03-customization.md # doc/04-development.md # doc/05-testing.md # features/adding_wishlist_product_to_cart.feature # spec/Checker/ProductProcessingCheckerSpec.php # spec/CommandHandler/Wishlist/AddProductsToCartHandlerSpec.php # spec/CommandHandler/Wishlist/CreateNewWishlistHandlerSpec.php # spec/CommandHandler/Wishlist/RemoveSelectedProductsFromWishlistHandlerSpec.php # spec/Duplicator/WishlistProductsToOtherWishlistDuplicatorSpec.php # src/Command/RemoveGuestWishlistsCommand.php # src/CommandHandler/Wishlist/AddProductsToCartHandler.php # src/CommandHandler/Wishlist/CreateNewWishlistHandler.php # src/CommandHandler/Wishlist/RemoveSelectedProductsFromWishlistHandler.php # src/Controller/Action/AddProductsToCartAction.php # src/Controller/Action/AddSelectedProductsToCartAction.php # src/Controller/Action/BaseWishlistProductsAction.php # src/Controller/Action/RemoveSelectedProductsFromWishlistAction.php # src/Duplicator/WishlistProductsToOtherWishlistDuplicator.php # src/Exception/WishlistProductNotFoundException.php # src/Form/Type/WishlistCollectionType.php # src/Resources/config/config.yml # src/Resources/config/services/checker.xml # src/Resources/config/services/command.xml # src/Resources/config/services/duplicator.xml # src/Resources/config/services/message_handler.xml # src/Resources/views/Admin/_scripts.html.twig # src/Resources/views/Admin/_styles.html.twig # src/Resources/views/Product/Show/_addToCart.html.twig # src/Resources/views/Shop/_scripts.html.twig # src/Resources/views/Shop/_styles.html.twig # src/Resources/views/WishlistDetails/_globalActions.html.twig # src/Resources/views/WishlistDetails/index.html.twig # src/Resources/views/_wishlist_header.html.twig # tests/Application/config/bundles.php # tests/Application/config/packages/security.yaml # tests/Application/package.json # tests/Application/templates/bundles/SyliusShopBundle/Product/Show/_addToCart.html.twig # tests/Behat/Context/Cli/WishlistContext.php # tests/Behat/Context/Common/WishlistContext.php # tests/Behat/Resources/services.yml # tests/Behat/Resources/suites/api/api_wishlist.yml # tests/Behat/Resources/suites/cli/cli_wishlist.yml # tests/Behat/Resources/suites/ui/ui_wishlist.yml
2 parents c0ce0da + 9b4101f commit 2975e82

20 files changed

+452
-1
lines changed

.docker/fpm.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[www]
2+
user = www-data
3+
group = www-data
4+
5+
listen = /var/run/php-www.sock
6+
listen.owner = www-data
7+
listen.group = www-data
8+
listen.mode = 0660
9+
10+
clear_env = no
11+
12+
pm = dynamic
13+
pm.max_children = 5
14+
pm.start_servers = 2
15+
pm.min_spare_servers = 1
16+
pm.max_spare_servers = 3
17+
18+
pm.status_path = /status
19+
catch_workers_output = yes
20+
21+
security.limit_extensions = .php

.docker/nginx.conf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
user www-data;
2+
worker_processes auto;
3+
daemon off;
4+
pid /run/nginx.pid;
5+
6+
include /etc/nginx/modules-enabled/*.conf;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include /etc/nginx/mime.types;
14+
default_type application/octet-stream;
15+
16+
server_tokens off;
17+
18+
client_max_body_size 64m;
19+
sendfile on;
20+
tcp_nodelay on;
21+
tcp_nopush on;
22+
23+
gzip_vary on;
24+
25+
access_log /var/log/nginx/access.log;
26+
error_log /var/log/nginx/error.log;
27+
28+
server {
29+
listen 80;
30+
31+
root /app/tests/Application/public;
32+
index index.php;
33+
34+
location / {
35+
try_files $uri /index.php$is_args$args;
36+
}
37+
38+
location ~ \.php$ {
39+
include fastcgi_params;
40+
41+
fastcgi_pass unix:/var/run/php-www.sock;
42+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
43+
44+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
45+
fastcgi_param DOCUMENT_ROOT $realpath_root;
46+
}
47+
}
48+
}

.docker/nginx/nginx.conf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
user www-data;
2+
worker_processes auto;
3+
daemon off;
4+
pid /run/nginx.pid;
5+
6+
include /etc/nginx/modules-enabled/*.conf;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include /etc/nginx/mime.types;
14+
default_type application/octet-stream;
15+
16+
server_tokens off;
17+
18+
client_max_body_size 64m;
19+
sendfile on;
20+
tcp_nodelay on;
21+
tcp_nopush on;
22+
23+
gzip_vary on;
24+
25+
access_log /var/log/nginx/access.log;
26+
error_log /var/log/nginx/error.log;
27+
28+
server {
29+
listen 80;
30+
31+
root /app/tests/Application/public;
32+
index index.php;
33+
34+
location / {
35+
try_files $uri /index.php$is_args$args;
36+
}
37+
38+
location ~ \.php$ {
39+
include fastcgi_params;
40+
41+
fastcgi_pass unix:/var/run/php8-fpm.sock;
42+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
43+
44+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
45+
fastcgi_param DOCUMENT_ROOT $realpath_root;
46+
}
47+
}
48+
}

.docker/php/php-cli.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[PHP]
2+
memory_limit=1024M
3+
4+
[date]
5+
date.timezone=${PHP_DATE_TIMEZONE}
6+
7+
[opcache]
8+
opcache.enable=0
9+
opcache.memory_consumption=256
10+
opcache.max_accelerated_files=20000
11+
opcache.validate_timestamps=0
12+
;opcache.preload=/app/config/preload.php
13+
opcache.preload_user=www-data
14+
opcache.jit=1255
15+
opcache.jit_buffer_size=256M

.docker/php/php-fpm.ini

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[PHP]
2+
memory_limit=-1
3+
4+
[date]
5+
date.timezone=${PHP_DATE_TIMEZONE}
6+
7+
[opcache]
8+
zend_extension=opcache.so
9+
opcache.enable=0
10+
opcache.memory_consumption=256
11+
opcache.max_accelerated_files=20000
12+
opcache.validate_timestamps=0
13+
;opcache.preload=/app/config/preload.php
14+
opcache.preload_user=www-data
15+
opcache.jit=1255
16+
opcache.jit_buffer_size=256M
17+
18+
[xdebug]
19+
zend_extension=xdebug
20+
xdebug.mode=${XDEBUG_MODE}
21+
xdebug.client_host=host.docker.internal
22+
xdebug.start_with_request=trigger
23+
xdebug.client_port=9003
24+
xdebug.discover_client_host=1

.docker/supervisord.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[supervisord]
2+
nodaemon = true
3+
user = root
4+
pidfile = /run/supervisord.pid
5+
6+
[program:nginx]
7+
command = /usr/sbin/nginx
8+
user = root
9+
autostart = true
10+
11+
[program:php-fpm]
12+
command = /usr/sbin/php-fpm -F
13+
user = root
14+
autostart = true

Dockerfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
FROM ubuntu:20.04
2+
ARG DEBIAN_FRONTEND=noninteractive
3+
ARG PHP_VERSION=8.2
4+
ENV LC_ALL=C.UTF-8
5+
6+
# Install basic tools
7+
RUN apt-get update && apt-get install -y \
8+
software-properties-common \
9+
curl \
10+
make \
11+
supervisor \
12+
unzip \
13+
python2 \
14+
g++
15+
16+
# Append NODE, NGINX and PHP repositories
17+
RUN add-apt-repository ppa:ondrej/php \
18+
&& add-apt-repository ppa:ondrej/nginx \
19+
&& curl -sL https://deb.nodesource.com/setup_14.x | bash -
20+
21+
# Install required PHP extensions
22+
RUN apt-get update && apt-get install -y \
23+
nodejs \
24+
nginx \
25+
php${PHP_VERSION} \
26+
php${PHP_VERSION}-apcu \
27+
php${PHP_VERSION}-calendar \
28+
php${PHP_VERSION}-common \
29+
php${PHP_VERSION}-cli \
30+
php${PHP_VERSION}-ctype \
31+
php${PHP_VERSION}-curl \
32+
php${PHP_VERSION}-dom \
33+
php${PHP_VERSION}-exif \
34+
php${PHP_VERSION}-fpm \
35+
php${PHP_VERSION}-gd \
36+
php${PHP_VERSION}-intl \
37+
php${PHP_VERSION}-mbstring \
38+
php${PHP_VERSION}-mysql \
39+
php${PHP_VERSION}-opcache \
40+
php${PHP_VERSION}-pdo \
41+
php${PHP_VERSION}-pgsql \
42+
php${PHP_VERSION}-sqlite \
43+
php${PHP_VERSION}-xdebug \
44+
php${PHP_VERSION}-xml \
45+
php${PHP_VERSION}-xsl \
46+
php${PHP_VERSION}-yaml \
47+
php${PHP_VERSION}-zip
48+
49+
# Install Composer
50+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename composer
51+
52+
# Cleanup
53+
RUN apt-get remove --purge -y software-properties-common curl && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* /usr/share/man/*
54+
55+
# Create directory for php-fpm socket
56+
# Link php-fpm binary file without version
57+
# -p Creates missing intermediate path name directories
58+
RUN ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm && mkdir -p /run/php
59+
60+
# Install yarn
61+
RUN npm install -g yarn && npm cache clean --force
62+
63+
# Initialize config files
64+
COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisor.conf
65+
COPY .docker/nginx.conf /etc/nginx/nginx.conf
66+
COPY .docker/fpm.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
67+
COPY .docker/php/php-fpm.ini /etc/php/${PHP_VERSION}/fpm/php.ini
68+
COPY .docker/php/php-cli.ini /etc/php/${PHP_VERSION}/cli/php.ini
69+
70+
WORKDIR /app
71+
72+
EXPOSE 80
73+
74+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
phpunit:
2+
vendor/bin/phpunit
3+
4+
phpspec:
5+
vendor/bin/phpspec run --ansi --no-interaction -f dot
6+
7+
phpstan:
8+
vendor/bin/phpstan analyse
9+
10+
psalm:
11+
vendor/bin/psalm
12+
13+
behat-js:
14+
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress
15+
16+
install:
17+
composer install --no-interaction --no-scripts
18+
19+
backend:
20+
tests/Application/bin/console sylius:install --no-interaction
21+
tests/Application/bin/console sylius:fixtures:load default --no-interaction
22+
23+
frontend:
24+
(cd tests/Application && yarn install --pure-lockfile)
25+
(cd tests/Application && bin/console assets:install public)
26+
27+
behat:
28+
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress
29+
30+
init: install backend frontend
31+
32+
ci: init phpstan psalm phpunit phpspec behat
33+
34+
integration: init phpunit behat
35+
36+
static: install phpspec phpstan psalm

bin/docker-setup

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
mkdir -p tests/Application/var/log
4+
mkdir -p tests/Application/var/cache
5+
chown -Rf www-data:www-data tests/Application/var/log
6+
chown -Rf www-data:www-data tests/Application/var/cache
7+
8+
chown -Rf www-data:www-data tests/Application/public/media
9+
chown -Rf www-data:www-data tests/Application/public/media/*
10+
11+
composer install
12+
13+
tests/Application/bin/console cache:clear
14+
tests/Application/bin/console assets:install
15+
tests/Application/bin/console doctrine:database:create --if-not-exists
16+
tests/Application/bin/console doctrine:schema:update --force
17+
tests/Application/bin/console sylius:fixtures:load -n
18+
19+
(cd tests/Application && yarn install)
20+
(cd tests/Application && yarn build)

docker-compose.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
services:
2+
app:
3+
container_name: app
4+
build:
5+
context: .
6+
environment:
7+
APP_ENV: "dev"
8+
DATABASE_SERVER_VERSION: "8.0.39"
9+
DATABASE_URL: "mysql://root:mysql@mysql/sylius_%kernel.environment%??charset=utf8mb4&serverVersion=8.0.39"
10+
# DATABASE_URL: "pgsql://root:postgres@postgres/sylius_%kernel.environment%?charset=utf8" # When using postgres
11+
PHP_DATE_TIMEZONE: "Europe/Warsaw"
12+
MAILER_DSN: "smtp://mailhog:1025"
13+
# to enable step debugging, build with e.g. XDEBUG_MODE=debug, or set the below to "debug"
14+
XDEBUG_MODE: ${XDEBUG_MODE:-off}
15+
# to use xdebug, create a server named PHPSTORM in Settings > PHP > Servers
16+
PHP_IDE_CONFIG: "serverName=PHPSTORM"
17+
volumes:
18+
- ./:/app:delegated
19+
- ./.docker/php.ini:/etc/php8/php.ini:delegated
20+
- ./.docker/nginx.conf:/etc/nginx/nginx.conf:delegated
21+
ports:
22+
- "80:80"
23+
depends_on:
24+
- mysql
25+
networks:
26+
- sylius
27+
28+
mysql:
29+
container_name: mysql
30+
image: mysql:8.0
31+
platform: linux/amd64
32+
environment:
33+
MYSQL_ROOT_PASSWORD: mysql
34+
ports:
35+
- ${MYSQL_PORT:-3306}:3306
36+
networks:
37+
- sylius
38+
39+
# postgres:
40+
# image: postgres:14-alpine
41+
# environment:
42+
# POSTGRES_USER: root
43+
# POSTGRES_PASSWORD: postgres
44+
# ports:
45+
# - ${POSTGRES_PORT:-5432}:5432
46+
# networks:
47+
# - sylius
48+
49+
mailhog:
50+
container_name: mailhog
51+
# do not use in production!
52+
image: mailhog/mailhog:latest
53+
environment:
54+
- MH_STORAGE=maildir
55+
# volumes:
56+
# - ./docker/mailhog/maildir:/maildir:rw,delegated
57+
ports:
58+
- "${MAILHOG_PORT:-8025}:8025"
59+
networks:
60+
- sylius
61+
62+
networks:
63+
sylius:
64+
driver: bridge

0 commit comments

Comments
 (0)