Skip to content

Stop existing active deployment with same path when a deleted one is restored

With the new Pages interface it is possible to restore a previously deleted deployment for as long as the cron job has not yet permanently deleted it.

This allows for the user to manually roll back to a previous deployment by restoring a stopped one and deleting the active one.

The UX is a bit confusing here though: restoring a stopped deployment will make two deployments with the same path available to the go process, in which case it will use the newer one, which may not be the intended behaviour.

It should not be possible to have two active deployments with the same path (primary or prefixed). When restoring one deployment, all others with the same path_prefix should be stopped

Implementation guide

  1. In app/workers/pages/deactivate_expired_deployments_cron_worker.rb update the restore method. Call deactivate on active PagesDeployments of the same project that have the same path_prefix
  2. Add specs to ensure this is working as expected to spec/models/pages_deployment_spec.rb
Edited by Janis Altherr