Initial commit

This commit is contained in:
2019-11-20 07:44:43 +01:00
commit 5bf49c4a81
41188 changed files with 5459177 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
version: '3.1'
services:
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: prestashop
MYSQL_USER: prestashop
MYSQL_PASSWORD: prestashop
networks:
- default
nginx:
image: nginx:1.14.0-alpine
ports:
- "8080:80"
volumes:
- ./prestashop/:/prestashop/
- ./prestashop-nginx/prestashop-nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
- "fpm"
networks:
- default
fpm:
build:
context: prestashop-fpm
# If you want to change the prestashop user UID to match your local user UID
# change it here and bellow
# args:
# UID: '1001'
volumes:
- ./prestashop/:/prestashop/
depends_on:
- "db"
user: "1001"
networks:
- default
networks:
default:

View File

@@ -0,0 +1,28 @@
FROM php:7.1-fpm-alpine
ARG UID=1001
RUN apk add --no-cache \
tzdata \
zlib-dev \
libjpeg-turbo-dev \
libmcrypt-dev \
pcre-dev \
libpng-dev \
freetype-dev \
libxml2-dev \
icu-dev
ENV TZ Europe/Paris
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install iconv intl pdo_mysql mbstring soap gd zip
RUN docker-php-source extract \
&& if [ -d "/usr/src/php/ext/mysql" ]; then docker-php-ext-install mysql; fi \
&& if [ -d "/usr/src/php/ext/mcrypt" ]; then docker-php-ext-install mcrypt; fi \
&& if [ -d "/usr/src/php/ext/opcache" ]; then docker-php-ext-install opcache; fi \
&& docker-php-source delete
COPY prestashop-php.ini /usr/local/etc/php/conf.d/prestashop-php.ini
RUN adduser -D -H -u ${UID} prestashop

View File

@@ -0,0 +1,14 @@
[PHP]
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It is
; generally recommended that <?php and ?> should be used and that this feature
; should be disabled, as enabling it may result in issues when generating XML
; documents, however this remains supported for backward compatibility reasons.
; Note that this directive does not control the <?= shorthand tag, which can be
; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off

View File

@@ -0,0 +1,143 @@
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
root /prestashop;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name _;
# Add stdout logging
error_log /dev/stdout info;
access_log /dev/stdout;
# Redirect 404 errors to prestashop
error_page 404 /index.php?controller=404;
# Gzip Settings, convert all types.
gzip on;
gzip_vary on;
gzip_proxied any;
# Can be enhance to 5, but it can slow you server
# gzip_comp_level 5;
# gzip_min_length 256;
gzip_types
application/atom+xml
application/javascript
application/json
application/ld+json
application/manifest+json
application/rss+xml
application/vnd.geo+json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/bmp
image/svg+xml
image/x-icon
text/cache-manifest
text/css
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
# Symfony controllers
location /admin/ { # [REQUIRED EDIT] the name of your admin directory
if (!-e $request_filename) {
rewrite ^/.*$ /admin/index.php last; # [REQUIRED EDIT] the name of your admin directory
}
}
# Cloudflare / Max CDN fix
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}
# Do not save logs for these
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
auth_basic off;
allow all;
log_not_found off;
access_log off;
}
location / {
# Redirect pretty urls to index.php
try_files $uri $uri/ /index.php?$args;
# Images
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
# AlphaImageLoader for IE and fancybox
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;
# Web service API
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
# Installation sandbox
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;
}
# File security
# .htaccess .DS_Store .htpasswd etc
location ~ /\. {
deny all;
}
# Source code directories
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor)/ {
deny all;
}
# Prevent exposing other sensitive files
location ~ \.(yml|log|tpl|twig|sass)$ {
deny all;
}
# Prevent injection of php files
location /upload {
location ~ \.php$ {
deny all;
}
}
location /img {
location ~ \.php$ {
deny all;
}
}
location ~ \.php$ {
# Verify that the file exists, redirect to index if not
try_files $fastcgi_script_name /index.php$uri&$args;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_pass fpm:9000;
}
}

View File

@@ -0,0 +1,32 @@
version: '3.1'
services:
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: prestashop
MYSQL_USER: prestashop
MYSQL_PASSWORD: prestashop
networks:
- default
nginx:
build:
context: prestashop-nginx-fpm
ports:
- "8080:80"
volumes:
- ./prestashop/:/prestashop/
environment:
PUID: "1001"
WEBROOT: "/prestashop"
SKIP_COMPOSER: 1
REMOVE_FILES: 0
REAL_IP_HEADER: 1
REAL_IP_FROM: "10.1.0.0/16"
PHP_ERRORS_STDERR: 1
networks:
- default
networks:
default:

View File

@@ -0,0 +1,4 @@
FROM richarvey/nginx-php-fpm:1.3.10
COPY prestashop-nginx.conf /var/www/html/conf/nginx/nginx-site.conf
COPY prestashop-php.ini /usr/local/etc/php/conf.d/prestashop-php.ini

View File

@@ -0,0 +1,144 @@
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
root /prestashop;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name _;
# Add stdout logging
error_log /dev/stdout info;
access_log /dev/stdout;
# Redirect 404 errors to prestashop
error_page 404 /index.php?controller=404;
# Gzip Settings, convert all types.
gzip on;
gzip_vary on;
gzip_proxied any;
# Can be enhance to 5, but it can slow you server
# gzip_comp_level 5;
# gzip_min_length 256;
gzip_types
application/atom+xml
application/javascript
application/json
application/ld+json
application/manifest+json
application/rss+xml
application/vnd.geo+json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/bmp
image/svg+xml
image/x-icon
text/cache-manifest
text/css
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
# Symfony controllers
location /admin/ { # [REQUIRED EDIT] the name of your admin directory
if (!-e $request_filename) {
rewrite ^/.*$ /admin/index.php last; # [REQUIRED EDIT] the name of your admin directory
}
}
# Cloudflare / Max CDN fix
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}
# Do not save logs for these
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
auth_basic off;
allow all;
log_not_found off;
access_log off;
}
location / {
# Redirect pretty urls to index.php
try_files $uri $uri/ /index.php?$args;
# Images
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
# AlphaImageLoader for IE and fancybox
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;
# Web service API
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
# Installation sandbox
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;
}
# File security
# .htaccess .DS_Store .htpasswd etc
location ~ /\. {
deny all;
}
# Source code directories
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor)/ {
deny all;
}
# Prevent exposing other sensitive files
location ~ \.(yml|log|tpl|twig|sass)$ {
deny all;
}
# Prevent injection of php files
location /upload {
location ~ \.php$ {
deny all;
}
}
location /img {
location ~ \.php$ {
deny all;
}
}
location ~ \.php$ {
# Verify that the file exists, redirect to index if not
try_files $fastcgi_script_name /index.php$uri&$args;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
}

View File

@@ -0,0 +1,14 @@
[PHP]
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It is
; generally recommended that <?php and ?> should be used and that this feature
; should be disabled, as enabling it may result in issues when generating XML
; documents, however this remains supported for backward compatibility reasons.
; Note that this directive does not control the <?= shorthand tag, which can be
; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off

View File

@@ -0,0 +1,98 @@
#!/bin/bash
#http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
#Requirements
# composer git
# ext-curl ext-intl
PS_BRANCH=develop
PS_VERSION=1.7.4.0
DB_SERVER=db
DB_USER=prestashop
DB_PASSWORD=prestashop
CURRENT_DIR=`pwd`
PRESTASHOP_SOURCE="$CURRENT_DIR/prestashop-source"
PRESTASHOP_DEST="$CURRENT_DIR/nginx_fpm/prestashop"
function usage {
echo "Usage: $0 [option...]"
echo ""
echo "Usage examples:"
echo ""
echo "Clone Prestashop from github to $PRESTASHOP_SOURCE directory:"
echo ""
echo "$0 -c "
echo ""
echo "Build version 1.7.4.0 from branch 1.7.4.x and deploy it to $CURRENT_DIR/nginx_fpm_supervisord/prestashop"
echo ""
echo "$0 -b 1.7.4.x -v 1.7.4.0 -d nginx_fpm_supervisord"
echo ""
}
function clonePrestaShop() {
echo "Cloning PrestaShop"
git clone git@github.com:PrestaShop/PrestaShop.git $PRESTASHOP_SOURCE
}
function buildRelease() {
echo "Building new Release: $PS_VERSION from branch $PS_BRANCH"
cd $PRESTASHOP_SOURCE
git checkout $PS_BRANCH
php tools/build/CreateRelease.php --version="$PS_VERSION" --no-zip --destination-dir=$PRESTASHOP_DEST
mv $PRESTASHOP_DEST/prestashop/* $PRESTASHOP_DEST/
rm -Rf $PRESTASHOP_DEST/prestashop
}
function __main() {
if [[ $# -eq 0 ]] ; then
usage
exit 0
fi
local positional=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-b|--branch)
PS_BRANCH=$2
shift 2
;;
-c|--clone)
clonePrestaShop
shift 2
;;
-v|--version)
PS_VERSION=$2
shift 2
;;
-d|--destination)
PRESTASHOP_DEST="$CURRENT_DIR/$2/prestashop"
shift 2
;;
-?|--help)
usage
shift
exit 0;
;;
--debug)
set -x
shift
;;
*)
positional+=("$key")
shift
;;
esac
done
set -- "${positional[@]:-}"
buildRelease
}
__main "$@"