-
Notifications
You must be signed in to change notification settings - Fork 5
/
deploy.sh
28 lines (27 loc) · 1.51 KB
/
deploy.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
/usr/share/stratus/cli crons.stop;
/usr/local/bin/php bin/magento maintenance:enable;
/usr/local/bin/php -dmemory_limit=20000M bin/magento setup:upgrade;
/usr/local/bin/php -dmemory_limit=20000M bin/magento setup:di:compile;
/usr/local/bin/php -dmemory_limit=20000M /usr/local/bin/composer dump-autoload --no-dev --optimize --apcu;
/usr/local/bin/php -dmemory_limit=20000M bin/magento setup:static-content:deploy --jobs=$(nproc);
/usr/share/stratus/cli autoscaling.reinit;
sleep 150s;
echo "\e[41m****Flushing Magento, Varnish, Redis and CloudFront CDN cache at this stage****";
/usr/local/bin/php -dmemory_limit=20000M bin/magento cache:clean;
/usr/local/bin/php -dmemory_limit=20000M bin/magento cache:flush;
/usr/share/stratus/cli cache.opcache.flush;
/usr/share/stratus/cli cache.cloudfront.invalidate;
/usr/share/stratus/cli cache.varnish.clear;
redis-cli -h redis flushall && redis-cli -h redis-config-cache -p 6381 flushall;
/usr/local/bin/php bin/magento maintenance:disable;
echo "\e[41m****Deployment Finished Site Enabled and tested****";
status_code=$(curl -kI --header 'Host: {yourhost}.com' --write-out %{http_code} --silent --output /dev/null 'https://nginx/')
if [[ "$status_code" -ne 200 ]] ; then
echo "Site not active $status_code please push script again"
else
echo "\e[41m****Beginning Indexing****";
n98-magerun2 sys:cron:run indexer_reindex_all_invalid;
n98-magerun2 sys:cron:run indexer_update_all_views;
/usr/share/stratus/cli crons.start;
echo "\e[41m****Activity Completed please visit store and test****";
fi