Skip to content

Commit

Permalink
Merge branch 'release/1.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennelandais committed Feb 9, 2018
2 parents 9235f68 + 9d22e40 commit cb62049
Show file tree
Hide file tree
Showing 116 changed files with 1,383 additions and 759 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*.log
.DS_Store
.buildpath
.settings
.project
_$*
vendor
package/*
*.lock
*.env
dist
.idea
web
data
!src/app/code/community/Allopass/Hipay/data
bin/conf/development/hipay.env
bin/tests/result.xml
bin/tests/errors/*
bin/tests/exportVariables.sh
docker-compose.stage-*.yml
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Version 1.1.2
- [#31](https://github.com/hipay/hipay-wallet-sdk-magento/pull/4) Fix : Create invoice when on capture notification (#4)
- [#31](https://github.com/hipay/hipay-wallet-sdk-magento/pull/4) Dockerize project (#4)

# Version 1.1.1
- New marketing description in front office
- Bugfix rating values (+12, +16 and +18)

# Version 1.1.0
- Add translations Netherlands (Holland)
- New semantic version

# Version 1.0.16
- Bugfix WALMAG-4 : Problem multistore in config and redirect payment page
19 changes: 19 additions & 0 deletions bin/conf/development/mage.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ENVIRONMENT=development

#====================================================
# Variables used by MAGENTO Installation
#=====================================================
MAGENTO_LOCALE=en_GB
MAGENTO_TIMEZONE=Pacific/Auckland
MAGENTO_DEFAULT_CURRENCY=EUR
MAGENTO_URL=http://localhost
PORT_WEB=8044
MAGENTO_ROOT=/var/www/htdocs/
MAGENTO_ADMIN_FIRSTNAME=HiPay
MAGENTO_ADMIN_LASTNAME=HiPay
MAGENTO_ADMIN_EMAIL=jprotin@hipay.com
MAGENTO_ADMIN_USERNAME=hipay
MAGENTO_ADMIN_PASSWORD=hipay123
MAGENTO_VERSION=1.9.2.3
SAMPLE_DATA_VERSION=1.9
MAGE_IS_DEVELOPER_MODE=true
8 changes: 8 additions & 0 deletions bin/conf/development/mysql.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#====================================================
# Mysql configuration (Necessary for mysql container)
#=====================================================
MYSQL_HOST=mysql
MYSQL_ROOT_PASSWORD=admin
MYSQL_USER=magento
MYSQL_PASSWORD=magento
MYSQL_DATABASE=magento
13 changes: 13 additions & 0 deletions bin/conf/development/php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[PHP]

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 18000
max_input_time = 60
memory_limit = 2G
upload_max_filesize = 32M
max_input_vars = 5000
date.timezone = "UTC"
display_errors = On
sendmail_path = /usr/sbin/ssmtp -t
180 changes: 180 additions & 0 deletions bin/conf/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#!/bin/bash

# Variables Shell
COLOR_SUCCESS='\033[0;32m'
NC='\033[0m'
ENV_DEVELOPMENT="development"
ENV_STAGE="stage"
PREFIX_STORE1=$RANDOM
PREFIX_STORE2=$RANDOM
PREFIX_STORE3=$RANDOM

printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
printf "\n${COLOR_SUCCESS} CHECK MAGENTO INSTALLATION ${NC}\n"
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
if [ ! -f /var/www/htdocs/index.php ]; then

printf "\n${COLOR_SUCCESS} MAGENTO IS NOT YET INSTALLED : INSTALLATION IS BEGINNING ${NC}\n"

# Download MAGENTO from repository
cd /tmp && curl -s https://codeload.github.com/OpenMage/magento-mirror/tar.gz/$MAGENTO_VERSION -o $MAGENTO_VERSION.tar.gz && tar xf $MAGENTO_VERSION.tar.gz && cp -rf magento-mirror-$MAGENTO_VERSION/* magento-mirror-$MAGENTO_VERSION/.htaccess /var/www/htdocs

sleep 10

# Install demo
echo "Install Magento sample data version $SAMPLE_DATA_VERSION"
install-sampledata-$SAMPLE_DATA_VERSION

sleep 10

# Install magento
install-magento

chown -R www-data:www-data /var/www/htdocs
chmod -R a+rw /var/www/htdocs
rm -f /var/www/htdocs/install.php

################################################################################
# INSTALLING HIPAY'S FILES
################################################################################
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
printf "\n${COLOR_SUCCESS} COPY HIPAY FILES ${NC}\n"
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
cp -Rf /tmp/src/app/code /var/www/htdocs/app/
cp -Rf /tmp/src/app/design /var/www/htdocs/app/
cp -Rf /tmp/src/app/etc /var/www/htdocs/app/
cp -Rf /tmp/src/app/locale /var/www/htdocs/app/
cp -Rf /tmp/src/skin /var/www/htdocs/

printf "\n"
echo "Files from local folder \"src\" are transfered in dockerized magento"
printf "\n"
n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" cache:clean

# Prefix for Entity Order
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
printf "\n${COLOR_SUCCESS} UPDATE TRANSACTION PREFIX ${NC}\n"
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"

n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" db:query "INSERT INTO eav_entity_store values (9,5,2,1,2);"

n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" db:query "UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='$PREFIX_STORE1'
WHERE eav_entity_type.entity_type_code='order' and eav_entity_store.store_id = 1 ;"
echo " Prefix STORE 1 for order id : $PREFIX_STORE1"

n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" db:query "UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='$PREFIX_STORE2'
WHERE eav_entity_type.entity_type_code='order' and eav_entity_store.store_id = 2 ;"
echo " Prefix STORE 2 for order id : $PREFIX_STORE2"

n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" db:query "UPDATE eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_prefix='$PREFIX_STORE3'
WHERE eav_entity_type.entity_type_code='order' and eav_entity_store.store_id = 3 ;"
echo " Prefix STORE 2 for order id : $PREFIX_STORE3"


################################################################################
# CONFIGURATION PER ENVIRONMENT
################################################################################
if [ "$ENVIRONMENT" = "$ENV_DEVELOPMENT" ];then

printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
printf "\n${COLOR_SUCCESS} APPLY CONFIGURATION : $ENV_DEVELOPMENT ${NC}\n"
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"

n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" cache:disable
n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" dev:log --on --global
n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" dev:log:db --on

# INSTALL X DEBUG
echo '' | pecl install xdebug
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini
echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini
echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini

printf "\n"
echo "XDebug installation : YES "

cp -f /tmp/$ENVIRONMENT/php/php.ini /usr/local/etc/php/php.ini
else
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
printf "\n${COLOR_SUCCESS} APPLY CONFIGURATION $ENVIRONMENT ${NC}\n"
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"

n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" cache:clean
n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" cache:disable
n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" dev:log --on --global
n98-magerun.phar --skip-root-check --root-dir="$MAGENTO_ROOT" dev:log:db --off

cp -f /tmp/$ENVIRONMENT/php/php.ini /usr/local/etc/php/php.ini
fi

################################################################################
# SEPCIFIC PORT CONFIGURATION
################################################################################
if [ "$PORT_WEB" != "80" ] && [ "$ENVIRONMENT" != "production" ];then
sed -i -e "s/80/$PORT_WEB/" /etc/apache2/sites-available/000-default.conf

echo "Listen $PORT_WEB" >> /etc/apache2/ports.conf

if [ "$PHP_VERSION" = "5.4" ];then
echo "Listen $PORT_WEB" >> /etc/apache2/apache2.conf
fi
fi

################################################################################
# CHANGE MAGENTO'S SOURCE FOR PHP7 SUPPORT
################################################################################
if [ "$PHP_VERSION" = "7.0" ];then
sed -i -e "555s/\$callback\[0\])->\$callback\[1\]();/\$callback\[0\])->\{\$callback\[1\]\}();/" /var/www/htdocs/app/code/core/Mage/Core/Model/Layout.php
fi

################################################################################
# CRON CONFIGURATION
################################################################################
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
printf "\n${COLOR_SUCCESS} CRON CONGIGURATION ${NC}\n"
printf "\n${COLOR_SUCCESS} ======================================= ${NC}\n"
chmod u+x $MAGENTO_ROOT/cron.sh
crontab -l | { cat; echo "*/5 * * * * su www-data -s /bin/bash -c 'sh "$MAGENTO_ROOT"cron.sh' >> /var/log/cron.log"; } | crontab -
else
printf "\n${COLOR_SUCCESS} => MAGENTO IS ALREADY INSTALLED IN THE CONTAINER ${NC}\n"
fi

chown -R www-data:www-data /var/www/htdocs

################################################################################
# IF CONTAINER IS KILLED, REMOVE PID
################################################################################
if [ -f /var/run/apache2/apache2.pid ]; then
rm -f /var/run/apache2/apache2.pid
fi

################################################################################
# RUN SERVICE FOR CRON JOB
################################################################################
service rsyslog start
service cron start

printf "${COLOR_SUCCESS} |======================================================================${NC}\n"
printf "${COLOR_SUCCESS} | ${NC}\n"
printf "${COLOR_SUCCESS} | DOCKER MAGENTO TO HIPAY $ENVIRONMENT IS UP ${NC}\n"
printf "${COLOR_SUCCESS} | ${NC}\n"
printf "${COLOR_SUCCESS} | URL FRONT : $MAGENTO_URL:$PORT_WEB ${NC}\n"
printf "${COLOR_SUCCESS} | URL BACK : $MAGENTO_URL:$PORT_WEB/admin ${NC}\n"
printf "${COLOR_SUCCESS} | URL MAIL CATCHER: $MAGENTO_URL:1095/ ${NC}\n"
printf "${COLOR_SUCCESS} | ${NC}\n"
printf "${COLOR_SUCCESS} | PHP VERSION : $PHP_VERSION ${NC}\n"
printf "${COLOR_SUCCESS} | MAGENTO VERSION : $MAGENTO_VERSION ${NC}\n"
printf "${COLOR_SUCCESS} | SAMPLE_DATA_VERSION: $SAMPLE_DATA_VERSION ${NC}\n"
printf "${COLOR_SUCCESS} |======================================================================${NC}\n"

if [ -f /var/run/apache2/apache2.pid ]; then
rm -f /var/run/apache2/apache2.pid
fi

exec apache2-foreground
19 changes: 19 additions & 0 deletions bin/conf/production/mage.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ENVIRONMENT=production

#====================================================
# Variables used by MAGENTO Installation
#=====================================================
MAGENTO_LOCALE=en_GB
MAGENTO_TIMEZONE=Pacific/Auckland
MAGENTO_DEFAULT_CURRENCY=EUR
MAGENTO_URL={MAGENTO_URL}
PORT_WEB={PORT_WEB}
MAGENTO_ROOT=/var/www/htdocs/
MAGENTO_ADMIN_FIRSTNAME=HiPay
MAGENTO_ADMIN_LASTNAME=HiPay
MAGENTO_ADMIN_EMAIL=jprotin@hipay.com
MAGENTO_ADMIN_USERNAME=hipay
MAGENTO_ADMIN_PASSWORD=hipay123
MAGENTO_VERSION=1.9.2.3
SAMPLE_DATA_VERSION=1.9
MAGE_IS_DEVELOPER_MODE=false
8 changes: 8 additions & 0 deletions bin/conf/production/mysql.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#====================================================
# Mysql configuration (Necessary for mysql container)
#=====================================================
MYSQL_HOST=mysql
MYSQL_ROOT_PASSWORD=admin
MYSQL_USER=magento
MYSQL_PASSWORD=magento
MYSQL_DATABASE=magento
13 changes: 13 additions & 0 deletions bin/conf/production/php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[PHP]

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 18000
max_input_time = 60
memory_limit = 2G
upload_max_filesize = 32M
max_input_vars = 5000
date.timezone = "UTC"
display_errors = Off
sendmail_path = /usr/sbin/ssmtp -t
17 changes: 17 additions & 0 deletions bin/conf/stage/mage.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ENVIRONMENT=stage

#====================================================
# Variables used by MAGENTO Installation
#=====================================================
MAGENTO_LOCALE=en_GB
MAGENTO_TIMEZONE=Pacific/Auckland
MAGENTO_DEFAULT_CURRENCY=EUR
MAGENTO_URL=http://local-magento.hipay.com
PORT_WEB=80
MAGENTO_ROOT=/var/www/htdocs/
MAGENTO_ADMIN_FIRSTNAME=HiPay
MAGENTO_ADMIN_LASTNAME=HiPay
MAGENTO_ADMIN_EMAIL=jprotin@hipay.com
MAGENTO_ADMIN_USERNAME=hipay
MAGENTO_ADMIN_PASSWORD=hipay123
MAGE_IS_DEVELOPER_MODE=false
8 changes: 8 additions & 0 deletions bin/conf/stage/mysql.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#====================================================
# Mysql configuration (Necessary for mysql container)
#=====================================================
MYSQL_HOST=mysql
MYSQL_ROOT_PASSWORD=admin
MYSQL_USER=magento
MYSQL_PASSWORD=magento
MYSQL_DATABASE=magento
13 changes: 13 additions & 0 deletions bin/conf/stage/php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[PHP]

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 18000
max_input_time = 60
memory_limit = 2G
upload_max_filesize = 32M
max_input_vars = 5000
date.timezone = "UTC"
display_errors = Off
sendmail_path = /usr/sbin/ssmtp -t
15 changes: 15 additions & 0 deletions bin/deployment/deploy_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
port=$(wget --no-check-certificate --user=$DOCKER_MACHINE_LOGIN --password=$DOCKER_MACHINE_PASS -qO- https://docker-knock-auth.hipay.org/KyP54YzX/?srvname=deploy.hipay-pos-platform.com)

GITHUB_BRANCH=$CIRCLE_BRANCH
if [ -n "$CIRCLE_TAG" ];then
GITHUB_BRANCH=$CIRCLE_TAG
fi

BRANCH=${GITHUB_BRANCH////-}

echo "Deploy project for project $CIRCLE_PROJECT_REPONAME and branch $GITHUB_BRANCH"
sshpass -p $PASS_DEPLOY ssh root@docker-knock-auth.hipay.org -p $port "export DOCKER_API_VERSION=1.23 && docker exec " \
"deploy.hipay-pos-platform.com" /deploy/deploy_project.sh $CIRCLE_PROJECT_REPONAME $GITHUB_BRANCH $CIRCLE_BUILD_URL


Loading

0 comments on commit cb62049

Please sign in to comment.