Ben

Ben

Under review

Hi,

with enabled zero downtime deployment, the current deploy script will run before the actual going live because the symlinks are automatically changed after running. With e.g. Statamic, there is a command to preheat the cache by crawling the current live site, which is still the old one at the time of deployment. If you do not have enabled zero downtime deployment, you do not have that issue because the site is technically changed within the control of the deployment script. So it would be really cool if there is an additional deploy script variable to execute the symlink change and post-deploy stuff of zero downtime in the script, so that we can do something after that like preheat the cache.

Dennis

Dennis

·

Are you using {RELEASE} by any chance to run your commands in?

no votes yet
Ben

Ben

·

Yes, I do, but that's just giving the new release folder. Problem is that the preheat logic crawls the currently live site and that is still the "old" one at the time of executing the deployment script. So the preheated HTML files will be put into the currently live folder. If we could have the folders switched with a new custom variable, we could be sure to execute the preheating after symlinking to the new folder.

no votes yet
Ben

Ben

· ·

That would also give more flexibility to the zero downtime deployment script since this could be easily done with normal deployments because we control the actual "going live" ourselves on them via git pull, refresh caches etc. This "functionality" is missing on zero downtime deployments.

no votes yet
Ben

Ben

·

btw this does also apply to the queue restart problem. When you restart your queue during zero downtime deployment, it will not pick up the latest changes

no votes yet
Dennis

Dennis

·

Could you post your deploy script? (Exclude any sensitive data)

no votes yet
Ben

Ben

·

if [[ {COMMIT_MESSAGE} =~ "[BOT]" ]]; then echo "AUTO-COMMITTED ON PRODUCTION. NOTHING TO DEPLOY." {DO_NOT_NOTIFY} exit 0 fi

cd {RELEASE} git reset --hard git pull composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader {RELOAD_PHP_FPM}

rm -rf public/static/ php8.1 artisan cache:clear

php8.1 artisan config:cache php8.1 artisan route:cache php8.1 artisan view:cache php8.1 artisan event:cache

php8.1 artisan migrate --force

{RESTART_DAEMON ###}

php8.1 artisan statamic:stache:warm # Warm the Statamic stache. php8.1 artisan statamic:search:update --all # Update the search index. php8.1 artisan statamic:assets:generate-presets # Generate all asset presets.

yarn yarn production

echo "🚀 Application deployed!"

no votes yet
Ben

Ben

·

Anything that's relaying on currently live data (queues use currently active live directory, warm static caches with live URL) will not work with zero downtime deployment.

no votes yet

You may use @ to mention someone.

Execute commands after zero downtime deployment

2 total votes
Daniel Sturm Ben
  • Dennis moved item to board Under review

    3 months ago
  • Ben moved item to project Site Level Requests

    3 months ago
  • Ben created the item

    3 months ago