development/scripts/deploy_app.sh
Dane Everitt 23fefe41cc
Fix the disasterous performance
Disables xdebug on the CLI to make tests run in a few seconds rather than taking minutes.

Also adds support for using docker-sync for "native" performance in the docker container. If you choose to not use it, vagrant will mount the files using the standard osx method which is slower, but still within reasonable bounds.
2018-07-14 20:50:42 -07:00

67 lines
1.8 KiB
Bash

#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
cp /tmp/.deploy/pterodactyl.conf /etc/supervisor/conf.d/pterodactyl.conf
cp /tmp/.deploy/pterodactyl.local.conf /etc/nginx/sites-available/pterodactyl.local.conf
# Needed for FPM to start correctly.
mkdir -p /run/php
# Disable xdebug on the CLI for _MASSIVE_ performance improvement
phpdismod -s cli xdebug
cd /srv/www
chmod -R 755 storage/* bootstrap/cache
# Start out in a "this isn't a new install" mode
freshInstall=false
# If no environment file is found copy the example one and then generate the key.
if [ ! -f ".env" ]; then
cp .env.example .env
fi
# Force this into local/debug mode
sed -i "s/APP_ENV=.*/APP_ENV=local/" .env
sed -i "s/APP_DEBUG=.*/APP_DEBUG=true/" .env
composer install --no-interaction --prefer-dist --no-suggest --no-scripts --no-progress
php artisan config:clear
# Configure the cronjob
(crontab -l 2>/dev/null; echo "* * * * * php /srv/www/artisan schedule:run >> /dev/null 2>&1") | crontab -
# Create symlink
rm -f /root/app
ln -s /srv/www /root/app
# Configure OPCache
cat >> /etc/php/7.2/cli/conf.d/10-opcache.ini <<EOF
opcache.revalidate_freq = 0
opcache.max_accelerated_files = 11003
opcache.memory_consumption = 192
opcache.interned_strings_buffer = 16
opcache.fast_shutdown = 1
opcache.enable = 1
opcache.enable_cli = 1
EOF
cat >> /etc/php/7.2/fpm/conf.d/20-xdebug.ini <<EOF
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_host=host.pterodactyl.local
EOF
# Install development dependencies
yarn install --no-progress
# Cleanup
rm -rfv /var/www
rm -rv /etc/nginx/sites-enabled/*
ln -s /etc/nginx/sites-available/pterodactyl.local.conf /etc/nginx/sites-enabled/pterodactyl.local.conf
# Start processes
supervisorctl reread
supervisorctl update
supervisorctl start pteroq:*
supervisorctl restart nginx