-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevdocs-cloud-docker-b2b-prod.sh
79 lines (54 loc) · 2.09 KB
/
devdocs-cloud-docker-b2b-prod.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -ex
MAGENTO_VERSION=2.4.3
B2B=1.3.2
CLOUD_DOCKER_VERSION=1.2.4
# PHP=7.4
echo 'Preparing for installation'
if [ -d "magento-cloud-${MAGENTO_VERSION}" ]
then
cd magento-cloud-${MAGENTO_VERSION}
echo 'Clearing existing projects'
docker-compose down --volume
echo "Clearing existing template"
rm -rf vendor composer.lock var/log/*
# echo 'Pruning Docker resources'
# docker system prune --force --all
else
echo 'Starting official procedure from Step 1 (https://devdocs.magento.com/cloud/docker/docker-mode-production.html)'
echo "Downloading a template for Magento ${MAGENTO_VERSION}"
git clone --branch ${MAGENTO_VERSION} [email protected]:magento/magento-cloud.git magento-cloud-${MAGENTO_VERSION}
cd magento-cloud-${MAGENTO_VERSION}
echo 'Getting auth.json from global Composer locale'
cp ~/.composer/auth.json . || exit
fi
echo 'Starting official procedure from Step 3 (https://devdocs.magento.com/cloud/docker/docker-mode-production.html)'
if [ ! -f "auth.json" ]; then
echo "Add 'auth.json'."
exit
fi
echo 'Adding B2B extension'
composer require magento/extension-b2b:${B2B} --no-update
echo 'Updating dependencies'
COMPOSER_MEMORY_LIMIT=-1 composer update
echo 'Start the Docker configuration generator'
./vendor/bin/ece-docker build:compose
echo 'Build files to containers and run in the background'
docker-compose up --detach
echo 'Build Magento'
docker-compose run --rm build cloud-build
echo 'Deploy Magento'
docker-compose run --rm deploy cloud-deploy
echo 'Run post-deploy hooks'
docker-compose run --rm deploy cloud-post-deploy
echo 'Configure Varnish'
docker-compose run --rm deploy magento-command config:set system/full_page_cache/caching_application 2 --lock-env
echo 'Connect Varnish'
docker-compose run --rm deploy magento-command setup:config:set --http-cache-hosts=varnish
echo 'Clear the cache'
docker-compose run --rm deploy magento-command cache:clean
# docker-compose restart
echo 'Access the local Magento Cloud template'
open http://magento2.docker
open http://magento2.docker/admin
open http://magento2.docker:8025/