pier_

Roll back a deploy

Return an app or site to a previous deploy's image without a rebuild

Goal. api was deployed with a faulty change; the previous deploy is running again within a minute.

See the history

pier deploys ls api
output
                                                                                        
 STATUS     TYPE RESOURCE ENV  COMMIT  MESSAGE                                  CREATED 
                                                                                        
 succeeded  app  api      prod da2b... fix(configdiff): a volume binding is ... 26s ago 
 superseded app  api      prod         zot.pier-registry.svc.cluster.local:5... 1m ago  
 superseded app  api      prod         zot.pier-registry.svc.cluster.local:5... 2m ago  
 succeeded  app  api      prod da2b... fix(configdiff): a volume binding is ... 3m ago  
                                                                                        

Every pier deploy, and every push once GitHub is connected, is a row with the image it produced. pier deploys info <id> shows the details and pier deploys logs <id> the build log.

Roll back

pier rollback api
output
→  Rolling back to the previous deployment depl_01m1... (1m ago) — pass --to to pick another.
→  Rolling back api...
Status: running
OK  Rolled back api to depl_01m1... (image: registry.pier.run/01a053...)

With no --to, the previous successful deploy is chosen. The target rolls to that deploy's image; nothing is rebuilt.

pier deploys ls api
output
                                                                                        
 STATUS     TYPE RESOURCE ENV  COMMIT  MESSAGE                                  CREATED 
                                                                                        
 running    app  api      prod         zot.pier-registry.svc.cluster.local:5... 4s ago  
 succeeded  app  api      prod da2b... fix(configdiff): a volume binding is ... 43s ago 
 superseded app  api      prod         zot.pier-registry.svc.cluster.local:5... 2m ago  
 superseded app  api      prod         zot.pier-registry.svc.cluster.local:5... 2m ago  
 succeeded  app  api      prod da2b... fix(configdiff): a volume binding is ... 3m ago  
                                                                                        

The rollback is itself a deploy. To roll forward again, run pier rollback api --to <id> with the newer id, or pier deploy api once the fix is committed.

Variations

  • A specific deploy: pier rollback api --to <id> with an id from pier deploys ls.
  • A site: pier rollback www returns to the previous published bundle.
  • Variables: a rollback changes the image, not the environment. If a variable caused the problem, reset it with pier vars set (Set environment variables).

See also

pier rollback · pier deploys · Deploys

On this page