Skip to content

Commit a3b785e

Browse files
authored
Merge pull request #2 from Elastic-Suite/feat-moveSrc
Move src outside the container for debugging
2 parents ac7b0bc + 7b7ebaa commit a3b785e

37 files changed

Lines changed: 11875 additions & 3 deletions

ReadMe.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
git clone git@github.com:Elastic-Suite/gally-shopware-connector.git plugins/GallyPlugin
99
git clone git@github.com:Elastic-Suite/shopware-lumage-sample-data-plugin.git plugins/LumaSampleData
1010
```
11+
- Fix permission
12+
```
13+
sudo chown -R www-data:www-data src plugins
14+
```
1115
- Set env vars:
1216

1317
| Var | Description | Example value |
@@ -25,6 +29,8 @@
2529
```shell
2630
# Update compose minimum stability in order to be able to require not released sdk package.
2731
docker compose exec shopware composer config minimum-stability dev
32+
# Composer install
33+
docker compose exec shopware composer install
2834
# Refresh plugin list from source
2935
docker compose exec shopware bin/console plugin:refresh
3036
# Install magento sample data (it can take several minutes)

compose.override.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ services:
33
extra_hosts:
44
- ${GALLY_SERVER_NAME:-gally.localhost}:host-gateway
55
environment:
6+
- APP_ENV=prod
67
- APP_DEBUG=0
8+
- APP_URL=https://${SERVER_NAME}/
9+
- TRUSTED_PROXIES=0.0.0.0/0
10+
- TRUSTED_HOSTS=^${SERVER_NAME}$
11+
- COMPOSER_HOME=$HOME/.config/composer
712
- SYMFONY_DEPRECATIONS_HELPER=disabled
813
- XDEBUG_ENABLED=1
914
- XDEBUG_REMOTE_HOST=172.17.0.1

compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ services:
66
- target: 433
77
- target: 80
88
volumes:
9-
- ./messenger.yaml:/var/www/html/config/packages/messenger.yaml
9+
- ./src:/var/www/html:rw,cached
1010
- ./plugins:/var/www/html/custom/plugins:rw,cached
11-
- src_data:/var/www/html/
11+
- jwt:/var/www/html/config/jwt:rw,cached
12+
- var:/var/www/html/var:rw,cached
1213
- db_data:/var/lib/mysql
1314
labels:
1415
- traefik.enable=true
@@ -22,4 +23,5 @@ services:
2223

2324
volumes:
2425
db_data:
25-
src_data:
26+
jwt:
27+
var:

src/.env

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
###> shopware/core ###
3+
4+
5+
APP_SECRET=c91f5ee05ba237ee7e48ca177dd3ea81
6+
INSTANCE_ID=5b0a513bbafcaa5bd261b387e989d5bd
7+
BLUE_GREEN_DEPLOYMENT=0
8+
9+
# With Shopware 6.4.17.0 the MAILER_DSN variable will be used in this template instead of MAILER_URL
10+
11+
###< shopware/core ###
12+
13+
###> symfony/messenger ###
14+
# Choose one of the transports below
15+
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
16+
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
17+
# doctrine://default?auto_setup=0
18+
###< symfony/messenger ###
19+
20+
###> symfony/mailer ###
21+
# MAILER_DSN=null://null
22+
###< symfony/mailer ###
23+
24+
###> symfony/lock ###
25+
# Choose one of the stores below
26+
# postgresql+advisory://db_user:db_password@localhost/db_name
27+
LOCK_DSN=flock
28+
###< symfony/lock ###
29+
30+
###> shopware/elasticsearch ###
31+
OPENSEARCH_URL=http://localhost:9200
32+
SHOPWARE_ES_ENABLED=0
33+
SHOPWARE_ES_INDEXING_ENABLED=0
34+
SHOPWARE_ES_INDEX_PREFIX=sw
35+
SHOPWARE_ES_THROW_EXCEPTION=1
36+
###< shopware/elasticsearch ###
37+
38+
###> shopware/storefront ###
39+
PROXY_URL=http://localhost
40+
SHOPWARE_HTTP_CACHE_ENABLED=1
41+
SHOPWARE_HTTP_DEFAULT_TTL=7200
42+
###< shopware/storefront ###
43+
APP_ENV=dev
44+
APP_URL=http://localhost
45+
DATABASE_URL=mysql://root:root@127.0.0.1:3306/shopware
46+
MAILER_DSN=smtp://127.0.0.1:1025

src/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/.idea
2+
/vendor/
3+
4+
###> shopware/core ###
5+
.env.local
6+
.env.local.php
7+
.env.*.local
8+
/public/bundles/*
9+
/public/media/*
10+
/public/theme/*
11+
/public/thumbnail/*
12+
/public/sitemap/*
13+
/files/*
14+
!/files/.htaccess
15+
/var/*
16+
!/var/.htaccess
17+
/auth.json
18+
/install.lock
19+
public/asset-manifest.json
20+
###< shopware/core ###

src/.htaccess

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
DirectoryIndex index.html index.php
2+
3+
<IfModule mod_negotiation.c>
4+
Options -MultiViews
5+
</IfModule>
6+
7+
<IfModule mod_alias.c>
8+
# Restrict access to VCS directories
9+
RedirectMatch 404 /\\.(svn|git|hg|bzr|cvs)(/|$)
10+
11+
# Restrict access to root folder files
12+
RedirectMatch 404 /(composer\.(json|lock|phar)|README\.md|\.gitignore|.*\.dist|\.env.*)$
13+
</IfModule>
14+

src/bin/.htaccess

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Files ~ ".*">
2+
# Deny all requests from Apache 2.4+.
3+
<IfModule mod_authz_core.c>
4+
Require all denied
5+
</IfModule>
6+
7+
# Deny all requests from Apache 2.0-2.2.
8+
<IfModule !mod_authz_core.c>
9+
Deny from all
10+
</IfModule>
11+
</Files>

src/bin/build-administration.sh

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env bash
2+
3+
unset CDPATH
4+
CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
5+
6+
export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
7+
export ENV_FILE=${ENV_FILE:-"${PROJECT_ROOT}/.env"}
8+
export NPM_CONFIG_FUND=false
9+
export NPM_CONFIG_AUDIT=false
10+
export NPM_CONFIG_UPDATE_NOTIFIER=false
11+
12+
# shellcheck source=functions.sh
13+
source "${PROJECT_ROOT}/bin/functions.sh"
14+
15+
curenv=$(declare -p -x)
16+
17+
load_dotenv "$ENV_FILE"
18+
19+
# Restore environment variables set globally
20+
set -o allexport
21+
eval "$curenv"
22+
set +o allexport
23+
24+
set -euo pipefail
25+
26+
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
27+
export DISABLE_ADMIN_COMPILATION_TYPECHECK=true
28+
export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
29+
30+
if [[ -e "${PROJECT_ROOT}/vendor/shopware/platform" ]]; then
31+
ADMIN_ROOT="${ADMIN_ROOT:-"${PROJECT_ROOT}/vendor/shopware/platform/src/Administration"}"
32+
else
33+
ADMIN_ROOT="${ADMIN_ROOT:-"${PROJECT_ROOT}/vendor/shopware/administration"}"
34+
fi
35+
36+
BIN_TOOL="${CWD}/console"
37+
38+
if [[ ${CI:-""} ]]; then
39+
BIN_TOOL="${CWD}/ci"
40+
41+
if [[ ! -x "$BIN_TOOL" ]]; then
42+
chmod +x "$BIN_TOOL"
43+
fi
44+
fi
45+
46+
# build admin
47+
[[ ${SHOPWARE_SKIP_BUNDLE_DUMP:-""} ]] || "${BIN_TOOL}" bundle:dump
48+
"${BIN_TOOL}" feature:dump || true
49+
50+
if [[ $(command -v jq) ]]; then
51+
OLDPWD=$(pwd)
52+
cd "$PROJECT_ROOT" || exit
53+
54+
jq -c '.[]' "var/plugins.json" | while read -r config; do
55+
srcPath=$(echo "$config" | jq -r '(.basePath + .administration.path)')
56+
57+
# the package.json files are always one upper
58+
path=$(dirname "$srcPath")
59+
name=$(echo "$config" | jq -r '.technicalName' )
60+
61+
skippingEnvVarName="SKIP_$(echo "$name" | sed -e 's/\([a-z]\)/\U\1/g' -e 's/-/_/g')"
62+
63+
if [[ ${!skippingEnvVarName:-""} ]]; then
64+
continue
65+
fi
66+
67+
if [[ -f "$path/package.json" && ! -d "$path/node_modules" && $name != "administration" ]]; then
68+
echo "=> Installing npm dependencies for ${name}"
69+
70+
npm install --prefix "$path" --no-audit --prefer-offline
71+
fi
72+
done
73+
cd "$OLDPWD" || exit
74+
else
75+
echo "Cannot check extensions for required npm installations as jq is not installed"
76+
fi
77+
78+
(cd "${ADMIN_ROOT}"/Resources/app/administration && npm install --prefer-offline --production)
79+
80+
# Dump entity schema
81+
if [[ -z "${SHOPWARE_SKIP_ENTITY_SCHEMA_DUMP:-""}" ]] && [[ -f "${ADMIN_ROOT}"/Resources/app/administration/scripts/entitySchemaConverter/entity-schema-converter.ts ]]; then
82+
mkdir -p "${ADMIN_ROOT}"/Resources/app/administration/test/_mocks_
83+
"${BIN_TOOL}" -e prod framework:schema -s 'entity-schema' "${ADMIN_ROOT}"/Resources/app/administration/test/_mocks_/entity-schema.json
84+
(cd "${ADMIN_ROOT}"/Resources/app/administration && npm run convert-entity-schema)
85+
fi
86+
87+
(cd "${ADMIN_ROOT}"/Resources/app/administration && npm run build)
88+
[[ ${SHOPWARE_SKIP_ASSET_COPY:-""} ]] ||"${BIN_TOOL}" assets:install

src/bin/build-js.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
BIN_DIR="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
4+
5+
set -euo pipefail
6+
7+
8+
if [[ -e "${BIN_DIR}/build-administration.sh" ]]; then
9+
"${BIN_DIR}/build-administration.sh"
10+
fi
11+
12+
if [[ -e "${BIN_DIR}/build-storefront.sh" ]]; then
13+
"${BIN_DIR}/build-storefront.sh"
14+
fi

src/bin/build-storefront.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env bash
2+
3+
unset CDPATH
4+
CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
5+
6+
set -euo pipefail
7+
8+
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
9+
export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
10+
export NPM_CONFIG_FUND=false
11+
export NPM_CONFIG_AUDIT=false
12+
export NPM_CONFIG_UPDATE_NOTIFIER=false
13+
14+
if [[ -e "${PROJECT_ROOT}/vendor/shopware/platform" ]]; then
15+
STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/platform/src/Storefront"}"
16+
else
17+
STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/storefront"}"
18+
fi
19+
20+
BIN_TOOL="${CWD}/console"
21+
22+
if [[ ${CI:-""} ]]; then
23+
BIN_TOOL="${CWD}/ci"
24+
25+
if [[ ! -x "$BIN_TOOL" ]]; then
26+
chmod +x "$BIN_TOOL"
27+
fi
28+
fi
29+
30+
# build storefront
31+
[[ ${SHOPWARE_SKIP_BUNDLE_DUMP:-""} ]] || "${BIN_TOOL}" bundle:dump
32+
[[ ${SHOPWARE_SKIP_FEATURE_DUMP:-""} ]] || "${BIN_TOOL}" feature:dump
33+
34+
if [[ $(command -v jq) ]]; then
35+
OLDPWD=$(pwd)
36+
cd "$PROJECT_ROOT" || exit
37+
38+
jq -c '.[]' "var/plugins.json" | while read -r config; do
39+
srcPath=$(echo "$config" | jq -r '(.basePath + .storefront.path)')
40+
41+
# the package.json files are always one upper
42+
path=$(dirname "$srcPath")
43+
name=$(echo "$config" | jq -r '.technicalName' )
44+
45+
skippingEnvVarName="SKIP_$(echo "$name" | sed -e 's/\([a-z]\)/\U\1/g' -e 's/-/_/g')"
46+
47+
if [[ ${!skippingEnvVarName:-""} ]]; then
48+
continue
49+
fi
50+
51+
if [[ -f "$path/package.json" && ! -d "$path/node_modules" && $name != "storefront" ]]; then
52+
echo "=> Installing npm dependencies for ${name}"
53+
54+
npm install --prefix "$path" --prefer-offline
55+
fi
56+
done
57+
cd "$OLDPWD" || exit
58+
else
59+
echo "Cannot check extensions for required npm installations as jq is not installed"
60+
fi
61+
62+
npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --prefer-offline --production
63+
node "${STOREFRONT_ROOT}"/Resources/app/storefront/copy-to-vendor.js
64+
npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run production
65+
[[ ${SHOPWARE_SKIP_ASSET_COPY:-""} ]] ||"${BIN_TOOL}" assets:install
66+
[[ ${SHOPWARE_SKIP_THEME_COMPILE:-""} ]] || "${BIN_TOOL}" theme:compile --active-only
67+
68+
if ! [ "${1:-default}" = "--keep-cache" ]; then
69+
"${BIN_TOOL}" cache:clear
70+
fi

0 commit comments

Comments
 (0)