Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4aee308
Add Noodle Pos Pro repo
Jan 23, 2019
e68de09
Add default credential user
Jan 23, 2019
bd0ac2f
Change order param
Jan 23, 2019
2a136d7
Add more testing environments
Jan 23, 2019
120d164
Fix repo name
Jan 23, 2019
38b840b
Add node name to the script
Jan 23, 2019
d9ddc28
Change and fix build server magento
Jan 23, 2019
7c600e3
Build magento server increment wait timeout
Jan 23, 2019
4fde412
Fix build step add wait for complately magento installation
Jan 23, 2019
1f2e55f
Change try to wait magento server install complately after check firs…
Jan 23, 2019
0487c0c
Fix retry limit break up db container is up
Jan 23, 2019
df46d06
Update mysql percona config for magento 2.3 env
Jan 24, 2019
b3866fb
Add open port 443
Jan 24, 2019
619d060
Change magento 2.3.0 nginx 1.8 with less database
Jan 26, 2019
1e48614
Add mem limit to docker
Jan 26, 2019
bb30d80
change nginx magento base url
Jan 26, 2019
a7c0e70
New build to check magento install
Jan 26, 2019
a5e97a8
Debug build
Jan 27, 2019
2d101c4
Update build script
Jan 27, 2019
a538558
add mode exec
Jan 27, 2019
2ba2a59
Update build
Jan 27, 2019
e67b3d4
Update build
Jan 27, 2019
f46d10a
Update build & debuging
Jan 27, 2019
98f31e7
Update build
Jan 27, 2019
2dede06
Update build
Jan 27, 2019
bc5a695
Update build
Jan 27, 2019
ea99fd6
Update build
Jan 27, 2019
8119b03
Update build
Jan 27, 2019
a18bd09
Update build: auto add volume
Jan 27, 2019
10f510f
Update build
Jan 27, 2019
d4f17a8
Update build
Jan 27, 2019
c067c29
Update build
Jan 28, 2019
8f95e18
Update build
Jan 28, 2019
3ceb9b8
Update build: debug
Jan 28, 2019
be92739
Update build
Jan 28, 2019
b733a7b
Update build debug
Jan 28, 2019
0e3799d
Update build
Jan 28, 2019
c91ee95
Update build
Jan 28, 2019
2b011db
Update build
Jan 28, 2019
7a7c83d
Add Magestore-Noodle/pos-enterprise repository
Jan 28, 2019
5a732c9
Update build
Jan 28, 2019
8a7927f
Add entrypoint to magento server environment, lessdata for all 2.3.0
Jan 28, 2019
d226f67
Update report hook to slack
Jan 28, 2019
14e2793
Add default variable
Jan 28, 2019
d59b2f9
Fix https url
Jan 28, 2019
d8c70be
Fix port secure 443
Jan 29, 2019
54ba7fa
Add indexer reindex command
Jan 31, 2019
1157edc
Add clear magento cache
Jan 31, 2019
bb6f16e
Update build.sh
Feb 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ pipeline {
}
}
parameters {
choice(name: 'HTTP_SERVER', choices: ['nginx-1.8', 'apache-2.2', 'apache-2.4'], description: 'HTTP Server')
choice(name: 'HTTP_SERVER', choices: ['apache-2.4', 'apache-2.2', 'nginx-1.8'], description: 'HTTP Server')
choice(name: 'PHP_VERSION', choices: ['7.2', '7.1', '7.0', '5.6'], description: 'PHP Version')
choice(name: 'MAGENTO_VERSION', choices: ['2.3.0', '2.2.7', '2.2.6', '2.1.16'], description: 'Magento Version')
choice(name: 'GITHUB_REPO', choices: ['magestore-shark/pos-pro', 'Magestore/pos-standard', 'Magestore/pos-pro', 'Magestore/pos-enterprise'], description: 'Github repository')
choice(name: 'GITHUB_REPO', choices: ['Magestore-Noodle/pos-enterprise', 'Magestore-Noodle/pos-pro', 'magestore-shark/pos-pro', 'Magestore/pos-standard', 'Magestore/pos-pro', 'Magestore/pos-enterprise'], description: 'Github repository')
string(name: 'GITHUB_BRANCH', defaultValue: '4-develop', description: 'Github branch or pull request. Example: 3-develop, pull/3')
choice(name: 'TIME_TO_LIVE', choices: ['1h', '2h', '4h', '1d', '7d'], description: 'Server living time')
credentials(name: 'GITHUB_USER', description: 'Github username and password', defaultValue: 'c005e544-9ad8-48be-ba44-a0f6d519a2ec', credentialType: "Username with password", required: true)
credentials(name: 'GITHUB_USER', description: 'Github username and password', defaultValue: 'd79f2198-246f-431c-94c5-3d2824ca8e31', credentialType: "Username with password", required: true)
}
environment {
CI = 'true'
Expand Down
4 changes: 4 additions & 0 deletions bin/apache-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Start apache2
apache2-foreground
98 changes: 83 additions & 15 deletions bin/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env sh
echo "This step running on node $NODE_NAME"

if [[ ! -z "${JENKINS_DATA}" ]]; then
cd $JENKINS_DATA/workspace/$JOB_BASE_NAME
Expand Down Expand Up @@ -34,7 +35,7 @@ else
git fetch --depth 1 origin +refs/$GITHUB_BRANCH/merge
fi
git checkout FETCH_HEAD

rm -rf .git
if [ $? -ne 0 ]; then
exit 1
fi
Expand All @@ -51,32 +52,99 @@ cp -Rf client/pos/build server/app/code/Magestore/Webpos/build/apps/pos
cp ../$COMPOSE_FILE docker-compose.yml
COMPOSE_HTTP_TIMEOUT=200 docker-compose up -d

PORT=`docker-compose port --protocol=tcp magento 80 | sed 's/0.0.0.0://'`
MAGENTO_URL="http://$NODE_IP:$PORT"
# check db container is run correctly
WHILE_LIMIT=10 # timeout 360 seconds
while ! DBISUP=`docker-compose ps | grep 3306 | grep Up`
do
if [ ! -z "$DBISUP" ]; then
break
else
docker-compose rm db # remove stopped container
COMPOSE_HTTP_TIMEOUT=200 docker-compose up -d
if [ $WHILE_LIMIT -lt 1 ]; then
break
fi
fi
WHILE_LIMIT=$(( WHILE_LIMIT - 1 ))
sleep 3
done

echo "Wait for mysql work"
COMPOSE_HTTP_TIMEOUT=200 docker-compose exec -T magento php mysql.php

# Install magento
echo "Install magento"
set +x
MAGENTO_CMD='php bin/magento setup:install --use-rewrites=1 \
--db-host=db \
--db-name=magento \
--db-password=magento \
--db-prefix=m_ \
--admin-firstname=Admin \
--admin-lastname=MFTF \
--admin-email=admin@localhost.com \
--admin-user=admin \
--admin-password=admin123 \
--base-url=$BASE_URL \
--backend-frontname=admin \
--admin-use-security-key=0 \
--key=8f1e9249ca82c072122ae8d08bc0b0cf '
set -x
docker-compose exec -u www-data -T magento bash -c "$MAGENTO_CMD"

# Check magento installation
COUNT_LIMIT=120 # timeout 600 seconds
while ! RESPONSE=`docker-compose exec -T magento curl -s https://localhost.com/magento_version`
#check maintenance flag
! `docker-compose exec -T magento [ -f var/.maintenance.flag ]` || sh -c "\
echo 'Magento is maintenance mode try to restart container'; \
COMPOSE_HTTP_TIMEOUT=200 docker-compose restart magento "

sleep 3
echo "Check magento installation"
COUNT_LIMIT=10 # timeout 600 seconds
while ! RESPONSE=`docker-compose exec -T magento curl -s localhost/magento_version`
do
if [ $COUNT_LIMIT -lt 1 ]; then
break
fi
COUNT_LIMIT=$(( COUNT_LIMIT - 1 ))
sleep 5
sleep 3
done

if [[ ${RESPONSE:0:8} != "Magento/" ]]; then
docker-compose restart magento
PORT=`docker-compose port --protocol=tcp magento 80 | sed 's/0.0.0.0://'`
MAGENTO_URL="http://$NODE_IP:$PORT"
while ! RESPONSE=`docker-compose exec -T magento curl -s https://localhost.com/magento_version`
do
sleep 5
done
if [[ "${RESPONSE:0:8}" != "Magento/" ]]; then
echo "Cannot setup magento"
exit 1
fi

# Upgrade module (if needed)
# install POS
echo "Install POS modules:"
#sed -i 's/#AUTO_ADD_VOLUME_server_app_code_Magestore/- \.\/server\/app\/code\/Magestore:\/var\/www\/html\/app\/code\/Magestore/g' docker-compose.yml
#docker-compose up -d magento
CONTAINER_ID=`docker-compose ps -q magento`
docker exec -i -u www-data $CONTAINER_ID mkdir -p /var/www/html/app/code
docker cp ./server/app/code/Magestore $CONTAINER_ID:/var/www/html/app/code
docker exec -i $CONTAINER_ID chown -R www-data:www-data /var/www/html/app/code/Magestore

echo "Wait for mysql work"
COMPOSE_HTTP_TIMEOUT=200 docker-compose exec -T magento php mysql.php

PORT=`docker-compose port --protocol=tcp magento 80 | sed 's/0.0.0.0://'`
MAGENTO_URL="http://$NODE_IP:$PORT"

# Correct magento url
docker-compose exec -u www-data -T magento bash -c \
"php bin/magento setup:store-config:set \
--admin-use-security-key=0 \
--base-url=$MAGENTO_URL/ "

docker-compose exec -u www-data -T magento bash -c "php bin/magento setup:upgrade"
docker-compose exec -u www-data -T magento bash -c "php bin/magento webpos:deploy"
docker-compose exec -u www-data -T magento bash -c "php bin/magento indexer:reindex"
docker-compose exec -u www-data -T magento bash -c "composer require zendframework/zend-barcode"
# Update config for testing
MAGENTO_CMD='php bin/magento config:set cms/wysiwyg/enabled disabled ; \
php bin/magento config:set admin/security/admin_account_sharing 1 ; \
php bin/magento config:set admin/captcha/enable 0 '
docker-compose exec -u www-data -T magento bash -c "$MAGENTO_CMD"

# clear magento cache
docker-compose exec -u www-data -T magento bash -c "php bin/magento cache:clean"
2 changes: 1 addition & 1 deletion bin/finish.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env sh

echo "This step running on node $NODE_NAME"
set +x

if [[ ! -z "${JENKINS_DATA}" ]]; then
Expand Down
6 changes: 6 additions & 0 deletions bin/nginx-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# Start php-fpm
php-fpm -y /usr/local/etc/php-fpm.conf -D
# Start nginx
nginx -g "daemon off;"
27 changes: 26 additions & 1 deletion bin/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env sh
echo "This step running on node $NODE_NAME"

if [[ ! -z "${JENKINS_DATA}" ]]; then
cd $JENKINS_DATA/workspace/$JOB_BASE_NAME
Expand All @@ -12,8 +13,13 @@ if [[ -z "$PORT" ]]; then
echo "Server is not running..."
exit 1
fi
PORTS=`docker-compose port --protocol=tcp magento 443 | sed 's/0.0.0.0://'`
if [[ -z "$PORTS" ]]; then
echo "Port 443 is not open or server is not running..."
fi

MAGENTO_URL="http://$NODE_IP:$PORT"
MAGENTO_SECURE_URL="https://$NODE_IP:$PORTS"

PORT=`docker-compose port --protocol=tcp phpmyadmin 80 | sed 's/0.0.0.0://'`
PHPMYADMIN_URL="http://$NODE_IP:$PORT"
Expand All @@ -27,11 +33,30 @@ echo "Server Info: $HTTP_SERVER php-$PHP_VERSION Magento-$MAGENTO_VERSION"
echo "Built from: $GITHUB_REPO $GITHUB_BRANCH"
echo ""
echo "Magento: $MAGENTO_URL/admin"
[ -z "$PORTS" ] || echo " $MAGENTO_SECURE_URL/admin"
echo "POS: $MAGENTO_URL/pub/apps/pos/"
[ -z "$PORTS" ] || echo " $MAGENTO_SECURE_URL/pub/apps/pos/"
echo "Admin: admin/admin123"
echo "PHPMyAdmin: $PHPMYADMIN_URL"
echo "EMAIL: $EMAIL_URL"
echo "MAIL BOX: $EMAIL_URL"
echo ""

# Slack hook
INFO="\n"
INFO="${INFO}Server Info: $HTTP_SERVER php-$PHP_VERSION Magento-$MAGENTO_VERSION \n"
INFO="${INFO}Built from: $GITHUB_REPO $GITHUB_BRANCH \n"
INFO="${INFO}\n"
INFO="${INFO}Magento: $MAGENTO_URL/admin \n"
[ -z "$PORTS" ] || INFO="${INFO} $MAGENTO_SECURE_URL/admin \n"
INFO="${INFO}POS: $MAGENTO_URL/pub/apps/pos/ \n"
[ -z "$PORTS" ] || INFO="${INFO} $MAGENTO_SECURE_URL/pub/apps/pos/ \n"
INFO="${INFO}Admin: admin/admin123 \n"
INFO="${INFO}PHPMyAdmin: $PHPMYADMIN_URL \n"
INFO="${INFO}MAIL BOX: $EMAIL_URL \n"
INFO="${INFO}"

curl -X POST -s --data-urlencode "payload={\"text\": \"[RUNNING] <$RUN_DISPLAY_URL|$BUILD_DISPLAY_NAME> $INFO \"}" ${SLACK_HOOKS_POS4:-localhost}

# Living time
set -x
sleep $TIME_TO_LIVE
4 changes: 4 additions & 0 deletions db/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM percona/percona-server:5.7

# Copy data to image
COPY --chown=mysql:mysql mysql /var/lib/mysql
15 changes: 15 additions & 0 deletions db/conf.d/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[mysqld]
innodb_buffer_pool_size = 2048M
innodb_buffer_pool_instances = 2
innodb_read_io_threads = 8
innodb_write_io_threads = 8
thread_cache_size = 20
key_buffer_size = 128M
query_cache_limit = 10M
query_cache_size = 10M
innodb_log_file_size = 512M
innodb_log_files_in_group = 1
innodb_log_buffer_size = 64M
innodb_flush_method=O_DIRECT
innodb_flush_log_at_trx_commit=0
innodb_file_per_table
19 changes: 16 additions & 3 deletions magento-2.3.0/apache-2.4/docker-compose.php-7.1.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
version: '3'
version: '2.1'
services:
magento:
image: magestore/mftf:2.3.0-apache-php7.1.25
volumes:
- ./server/app/code/Magestore:/var/www/html/app/code/Magestore
# - ./server/app/code/Magestore:/var/www/html/app/code/Magestore
- ../bin/apache-entrypoint:/usr/local/bin/entrypoint
ports:
- 8080-8089:80
- 8180-8189:443
networks:
webnet:
aliases:
- localhost.com
environment:
BASE_URL: http://localhost/
MAGENTO_DEV_MODE: developer
mem_limit: 3GB
memswap_limit: 0
entrypoint:
- entrypoint

db:
image: magestore/mftf-db:percona-5.7
image: magestore/mftf-db:percona-5.7-lessdata
environment:
MYSQL_ROOT_PASSWORD: magento
volumes:
- ./../db/conf.d:/etc/my.cnf.d
networks:
- webnet
mem_limit: 3GB
memswap_limit: 0

phpmyadmin:
image: phpmyadmin/phpmyadmin
Expand Down
53 changes: 53 additions & 0 deletions magento-2.3.0/apache-2.4/docker-compose.php-7.2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '2.1'
services:
magento:
image: magestore/mftf:2.3.0-apache-php7.2.13
volumes:
#- ./server/app/code/Magestore:/var/www/html/app/code/Magestore
- ../bin/apache-entrypoint:/usr/local/bin/entrypoint
ports:
- 8080-8089:80
- 8180-8189:443
networks:
webnet:
aliases:
- localhost.com
environment:
BASE_URL: http://localhost/
MAGENTO_DEV_MODE: developer
mem_limit: 3GB
memswap_limit: 0
entrypoint:
- entrypoint

db:
image: magestore/mftf-db:percona-5.7-lessdata
environment:
MYSQL_ROOT_PASSWORD: magento
volumes:
- ./../db/conf.d:/etc/my.cnf.d
networks:
- webnet
mem_limit: 3GB
memswap_limit: 0

phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8060-8069:80
environment:
PMA_HOST: db
PMA_USER: root
PMA_PASSWORD: magento
networks:
- webnet

mailhog:
image: mailhog/mailhog
ports:
- 8020-8029:8025
networks:
- webnet

networks:
webnet:
53 changes: 53 additions & 0 deletions magento-2.3.0/nginx-1.8/docker-compose.php-7.1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '2.1'
services:
magento:
image: magestore/mftf:2.3.0-nginx-php7.1.25
volumes:
#- ./server/app/code/Magestore:/var/www/html/app/code/Magestore
- ../bin/nginx-entrypoint:/usr/local/bin/nginx-entrypoint
ports:
- 8080-8089:80
- 8180-8189:443
networks:
webnet:
aliases:
- localhost.com
environment:
BASE_URL: http://localhost/
MAGENTO_DEV_MODE: developer
mem_limit: 3GB
memswap_limit: 0
entrypoint:
- nginx-entrypoint

db:
image: magestore/mftf-db:percona-5.7-lessdata
environment:
MYSQL_ROOT_PASSWORD: magento
volumes:
- ./../db/conf.d:/etc/my.cnf.d
networks:
- webnet
mem_limit: 3GB
memswap_limit: 0

phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8060-8069:80
environment:
PMA_HOST: db
PMA_USER: root
PMA_PASSWORD: magento
networks:
- webnet

mailhog:
image: mailhog/mailhog
ports:
- 8020-8029:8025
networks:
- webnet

networks:
webnet:
Loading