Skip to content

Commit e0320f1

Browse files
authored
Merge pull request #18 from solutionDrive/add-support-for-different-shopware-versions
Add support for different shopware versions
2 parents 6bdd89e + aa790c2 commit e0320f1

File tree

8 files changed

+436
-26
lines changed

8 files changed

+436
-26
lines changed

bin/sdPlugin.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
#!/usr/bin/env bash
2-
VERSION=$1
2+
PHP_VERSION=$1
3+
SHOPWARE_VERSION=$2
34

4-
if [ -z "${VERSION}" ]; then
5+
if [ -z "${SHOPWARE_VERSION}" ]; then
6+
echo "You must provide the version of shopware you want to interact with, e.g. 54 for shopware 5.4"
7+
exit 1
8+
fi
9+
10+
11+
if [ -z "${PHP_VERSION}" ]; then
512
echo "You must give a version to execute command on, for example 71 for PHP 7.1 container."
613
exit 1
714
fi
@@ -25,8 +32,8 @@ fi
2532
PROJECT_DIR="$( dirname $( dirname $( dirname "${PACKAGE_DIR}") ) )"
2633
PROJECT_NAME="$( basename ${PROJECT_DIR} | tr '[:upper:]' '[:lower:]' )"
2734
# TODO: Think about a good solution for a different shopware version
28-
PHP_CONTAINER_NAME="${PROJECT_NAME}_shopware54_php${VERSION}_1"
29-
WORK_DIR="/var/www/shopware54_php${VERSION}"
35+
PHP_CONTAINER_NAME="${PROJECT_NAME}_shopware${SHOPWARE_VERSION}_php${PHP_VERSION}_1"
36+
WORK_DIR="/var/www/shopware${SHOPWARE_VERSION}_php${PHP_VERSION}"
3037

3138
PLUGIN_NAME=$(find . -name '*.php' -maxdepth 1 |sed 's#.*/##' | sed 's/\.php$//1')
3239

@@ -74,7 +81,7 @@ function execute_in_docker {
7481
export PROJECT_DIR
7582
export PROJECT_NAME
7683

77-
case "$2" in
84+
case "$3" in
7885
add)
7986
shift
8087
add_plugin $@
@@ -92,6 +99,7 @@ case "$2" in
9299
deactivate_plugin $@
93100
;;
94101
*)
95-
echo "usage: <php-version for example 71> add/remove/activate/deactivate"
102+
echo "usage: <php-version for example 71> [shopware-version] add/remove/activate/deactivate"
103+
echo "valid values for shopware-version: 52 | 53 | 54 | 55 (default)"
96104
;;
97105
esac

bin/sdRunInTest.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
#!/usr/bin/env bash
22

33
VERSION=$1
4+
SHOPWARE_VERSION=$2
5+
6+
# Remove Shopware-Version from `$@`, so it is not passed to docker-compose command
7+
for arg do
8+
shift
9+
case $arg in
10+
(52|53|54|55) : ;;
11+
(*) set -- "$@" "$arg" ;;
12+
esac
13+
done
14+
15+
if [ -z "${SHOPWARE_VERSION}" ]; then
16+
echo "You must provide the version of shopware you want to interact with, e.g. 54 for shopware 5.4"
17+
exit 1
18+
fi
419

520
if [ -z "${VERSION}" ]; then
621
echo "You must give a version to execute command on, for example 71 for PHP 7.1 container."
@@ -26,7 +41,7 @@ fi
2641
PROJECT_DIR="$( dirname $( dirname $( dirname "${PACKAGE_DIR}") ) )"
2742
PROJECT_NAME="$( basename ${PROJECT_DIR} | tr '[:upper:]' '[:lower:]' )"
2843
# TODO: Think about a good solution for a different shopware version
29-
PHP_CONTAINER_NAME="${PROJECT_NAME}_shopware54_php${VERSION}_1"
30-
WORK_DIR=${WORK_DIR:-"/var/www/shopware54_php${VERSION}"}
44+
PHP_CONTAINER_NAME="${PROJECT_NAME}_shopware${SHOPWARE_VERSION}_php${VERSION}_1"
45+
WORK_DIR=${WORK_DIR:-"/var/www/shopware${SHOPWARE_VERSION}_php${VERSION}"}
3146

3247
docker exec --workdir ${WORK_DIR} -it $(docker container ls -f name=${PHP_CONTAINER_NAME} -q) ${@:2}

bin/sdTest.sh

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
#!/usr/bin/env bash
22

3+
SHOPWARE_VERSION=$2
4+
5+
# Remove Shopware-Version from `$@`, so it is not passed to docker-compose command
6+
for arg do
7+
shift
8+
case $arg in
9+
(52|53|54|55) : ;;
10+
(*) set -- "$@" "$arg" ;;
11+
12+
esac
13+
done
14+
15+
16+
if [ -z "${SHOPWARE_VERSION}" ]; then
17+
echo "You must provide the version of shopware you want to interact with, e.g. 54 for shopware 5.4"
18+
exit 1
19+
fi
20+
321
# directory of this script
422
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
523

@@ -24,7 +42,7 @@ fi
2442
export PROJECT_DIR="$( dirname $( dirname $( dirname "${PACKAGE_DIR}") ) )"
2543
export PACKAGE_DIR="${PACKAGE_DIR}"
2644
export PROJECT_NAME="$( basename ${PROJECT_DIR} | tr '[:upper:]' '[:lower:]' )"
27-
export DOCKER_COMPOSE_YAML=${PROJECT_DIR}"/etc/test/docker-compose.yml"
45+
export DOCKER_COMPOSE_YAML=${PROJECT_DIR}"/etc/test/docker-compose${SHOPWARE_VERSION}.yml"
2846

2947
if [ "$1" != "init" ]; then
3048
source ${PACKAGE_DIR}/etc/scripts/checkSdTestEnvironment.sh
@@ -41,11 +59,11 @@ function prepare {
4159
function echo_configuration {
4260
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
4361
echo "Running (web)server on ports:"
44-
echo "PHP 7.2: 10872"
45-
echo "PHP 7.1: 10871"
46-
echo "PHP 7.0: 10870"
47-
echo "PHP 5.6: 10856"
48-
echo "MySQL: 10331"
62+
echo "PHP 7.2: ${SHOPWARE_VERSION}872"
63+
echo "PHP 7.1: ${SHOPWARE_VERSION}871"
64+
echo "PHP 7.0: ${SHOPWARE_VERSION}870"
65+
echo "PHP 5.6: ${SHOPWARE_VERSION}856"
66+
echo "MySQL: ${SHOPWARE_VERSION}331"
4967
echo ""
5068
echo "PROJECT_DIR: ${PROJECT_DIR}"
5169
echo "PROJECT_NAME: ${PROJECT_NAME}"
@@ -64,7 +82,7 @@ function init_environment {
6482
cp ${PACKAGE_DIR}/README.md ${PROJECT_DIR}/README.TESTING.md
6583

6684
echo "Copying docker-compose.yml to be able to easily modify it for special needs"
67-
cp ${PACKAGE_DIR}/docker-compose.yml ${PROJECT_DIR}/etc/test/docker-compose.yml
85+
cp ${PACKAGE_DIR}/docker-compose${SHOPWARE_VERSION}.yml ${PROJECT_DIR}/etc/test/docker-compose${SHOPWARE_VERSION}.yml
6886

6987
echo "Copying config files to be able to easily modify it for special needs"
7088
cp ${PACKAGE_DIR}/php/* ${PROJECT_DIR}/etc/test/php
@@ -174,6 +192,6 @@ case "$1" in
174192
get_logs $@
175193
;;
176194
*)
177-
echo "usage: init/start/stop/run/restart/build/reset/remove/pull/logs"
195+
echo "usage: init/start/stop/run/restart/build/reset/remove/pull/logs <Shopware-Version, e.g. 54 for shopware 5.4>"
178196
;;
179197
esac

docker-compose52.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
version: '3'
2+
3+
services:
4+
nginx:
5+
image: nginx:1.15-alpine
6+
environment:
7+
- TZ=Europe/Berlin
8+
ports:
9+
- "52870:52870"
10+
- "52871:52871"
11+
- "52872:52872"
12+
volumes:
13+
- shopware52_php72:/var/www/shopware52_php72:delegated
14+
- shopware52_php71:/var/www/shopware52_php71:delegated
15+
- shopware52_php70:/var/www/shopware52_php70:delegated
16+
- ${PROJECT_DIR}:/opt/host:delegated
17+
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
18+
- ./nginx/include.shopware.conf:/etc/nginx/include.shopware.conf
19+
- ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
20+
links:
21+
- shopware52_php72
22+
- shopware52_php71
23+
- shopware52_php70
24+
- mysql
25+
depends_on:
26+
- shopware52_php72
27+
- shopware52_php71
28+
- shopware52_php70
29+
30+
shopware52_php72:
31+
image: solutiondrive/docker-shopware-container:shopware5.2.27-php7.2
32+
environment:
33+
- TZ=Europe/Berlin
34+
- DB_DATABASE=shopware52_php72
35+
- WEB_HOST=localhost:52872
36+
volumes:
37+
- shopware52_php72:/var/www/shopware52_php72:delegated
38+
- ${PROJECT_DIR}:/opt/host:delegated
39+
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-override-php.ini
40+
- ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf
41+
links:
42+
- mysql
43+
depends_on:
44+
- mysql
45+
46+
shopware52_php71:
47+
image: solutiondrive/docker-shopware-container:shopware5.2.27-php7.1
48+
environment:
49+
- TZ=Europe/Berlin
50+
- DB_DATABASE=shopware52_php71
51+
- WEB_HOST=localhost:52871
52+
volumes:
53+
- shopware52_php71:/var/www/shopware52_php71:delegated
54+
- ${PROJECT_DIR}:/opt/host:delegated
55+
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-override-php.ini
56+
- ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf
57+
links:
58+
- mysql
59+
depends_on:
60+
- mysql
61+
62+
shopware52_php70:
63+
image: solutiondrive/docker-shopware-container:shopware5.2.27-php7.0
64+
environment:
65+
- TZ=Europe/Berlin
66+
- DB_DATABASE=shopware52_php70
67+
- WEB_HOST=localhost:52870
68+
volumes:
69+
- shopware52_php70:/var/www/shopware52_php70:delegated
70+
- ${PROJECT_DIR}:/opt/host:delegated
71+
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-override-php.ini
72+
- ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf
73+
links:
74+
- mysql
75+
depends_on:
76+
- mysql
77+
78+
mysql:
79+
image: mysql:5.7.20
80+
environment:
81+
- MYSQL_ROOT_PASSWORD=root
82+
- MYSQL_ALLOW_EMPTY_PASSWORD=false
83+
- MYSQL_DATABASE=test
84+
ports:
85+
- "52331:3306"
86+
87+
volumes:
88+
shopware52_php72:
89+
shopware52_php71:
90+
shopware52_php70:

docker-compose53.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
version: '3'
2+
3+
services:
4+
nginx:
5+
image: nginx:1.15-alpine
6+
environment:
7+
- TZ=Europe/Berlin
8+
ports:
9+
- "53870:53870"
10+
- "53871:53871"
11+
- "53872:53872"
12+
volumes:
13+
- shopware53_php72:/var/www/shopware53_php72:delegated
14+
- shopware53_php71:/var/www/shopware53_php71:delegated
15+
- shopware53_php70:/var/www/shopware53_php70:delegated
16+
- ${PROJECT_DIR}:/opt/host:delegated
17+
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
18+
- ./nginx/include.shopware.conf:/etc/nginx/include.shopware.conf
19+
- ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
20+
links:
21+
- shopware53_php72
22+
- shopware53_php71
23+
- shopware53_php70
24+
- mysql
25+
depends_on:
26+
- shopware53_php72
27+
- shopware53_php71
28+
- shopware53_php70
29+
30+
shopware53_php72:
31+
image: solutiondrive/docker-shopware-container:shopware5.3.7-php7.2
32+
environment:
33+
- TZ=Europe/Berlin
34+
- DB_DATABASE=shopware53_php72
35+
- WEB_HOST=localhost:53872
36+
volumes:
37+
- shopware53_php72:/var/www/shopware53_php72:delegated
38+
- ${PROJECT_DIR}:/opt/host:delegated
39+
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-override-php.ini
40+
- ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf
41+
links:
42+
- mysql
43+
depends_on:
44+
- mysql
45+
46+
shopware53_php71:
47+
image: solutiondrive/docker-shopware-container:shopware5.3.7-php7.1
48+
environment:
49+
- TZ=Europe/Berlin
50+
- DB_DATABASE=shopware53_php71
51+
- WEB_HOST=localhost:53871
52+
volumes:
53+
- shopware53_php71:/var/www/shopware53_php71:delegated
54+
- ${PROJECT_DIR}:/opt/host:delegated
55+
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-override-php.ini
56+
- ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf
57+
links:
58+
- mysql
59+
depends_on:
60+
- mysql
61+
62+
shopware53_php70:
63+
image: solutiondrive/docker-shopware-container:shopware5.3.7-php7.0
64+
environment:
65+
- TZ=Europe/Berlin
66+
- DB_DATABASE=shopware53_php70
67+
- WEB_HOST=localhost:53870
68+
volumes:
69+
- shopware53_php70:/var/www/shopware53_php70:delegated
70+
- ${PROJECT_DIR}:/opt/host:delegated
71+
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-override-php.ini
72+
- ./php/www.conf:/usr/local/etc/php-fpm.d/www.conf
73+
links:
74+
- mysql
75+
depends_on:
76+
- mysql
77+
78+
mysql:
79+
image: mysql:5.7.20
80+
environment:
81+
- MYSQL_ROOT_PASSWORD=root
82+
- MYSQL_ALLOW_EMPTY_PASSWORD=false
83+
- MYSQL_DATABASE=test
84+
ports:
85+
- "53331:3306"
86+
87+
volumes:
88+
shopware53_php72:
89+
shopware53_php71:
90+
shopware53_php70:
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ services:
66
environment:
77
- TZ=Europe/Berlin
88
ports:
9-
- "10870:10870"
10-
- "10871:10871"
11-
- "10872:10872"
9+
- "54870:54870"
10+
- "54871:54871"
11+
- "54872:54872"
1212
volumes:
1313
- shopware54_php72:/var/www/shopware54_php72:delegated
1414
- shopware54_php71:/var/www/shopware54_php71:delegated
@@ -32,7 +32,7 @@ services:
3232
environment:
3333
- TZ=Europe/Berlin
3434
- DB_DATABASE=shopware54_php72
35-
- WEB_HOST=localhost:10872
35+
- WEB_HOST=localhost:54872
3636
volumes:
3737
- shopware54_php72:/var/www/shopware54_php72:delegated
3838
- ${PROJECT_DIR}:/opt/host:delegated
@@ -48,7 +48,7 @@ services:
4848
environment:
4949
- TZ=Europe/Berlin
5050
- DB_DATABASE=shopware54_php71
51-
- WEB_HOST=localhost:10871
51+
- WEB_HOST=localhost:54871
5252
volumes:
5353
- shopware54_php71:/var/www/shopware54_php71:delegated
5454
- ${PROJECT_DIR}:/opt/host:delegated
@@ -64,7 +64,7 @@ services:
6464
environment:
6565
- TZ=Europe/Berlin
6666
- DB_DATABASE=shopware54_php70
67-
- WEB_HOST=localhost:10870
67+
- WEB_HOST=localhost:54870
6868
volumes:
6969
- shopware54_php70:/var/www/shopware54_php70:delegated
7070
- ${PROJECT_DIR}:/opt/host:delegated
@@ -82,7 +82,7 @@ services:
8282
- MYSQL_ALLOW_EMPTY_PASSWORD=false
8383
- MYSQL_DATABASE=test
8484
ports:
85-
- "10331:3306"
85+
- "54331:3306"
8686

8787
volumes:
8888
shopware54_php72:

0 commit comments

Comments
 (0)