Search
Varnish Controller

Staged Deployment

Note: This has been deprecated in 6.0.0.

To stage changes before applying them in production we can assign different tags to different agents and then use the staging functionality provided. In this case, we use the tags prod and stage to distinguish the agents.

  • Agent-1 tagged with prod
  • Agent-2 tagged with stage
  • Deployment-1 assigned prod
  • VCL-1 created
  • Deployment-1 assigned to VCLGroup-1
  • New VCL-2 created
  • VCLGroup-1 staged with VCL-2 and tag stage

A new staging VCLGroup/Deployment will now be automatically created and deployed to agents with the tag stage. When the staging has been tested, the VCLGroup-1 can be promoted. Promote VCLGroup-1, makes VCLGroup-1 use VCL-2 instead of VCL-1.

The above steps can be translated into CLI commands.

# Create tags and assign to agents
vcli tags add prod stage
vcli agents tag 1 --tags 1
vcli agents tag 2 --tags 2

# Upload a VCL from the file my.vcl
vcli file add main my.vcl

# Create a domain
vcli domains add example.com

# Create a deployment
vcli dep add depProd --tags 1

# Now create a VCLGroup
vcli vg add myProd --dep 1 --dom 1 --vcl 1

# Deploy it
vcli vg deploy 1

# Now we want to stage a new VCL change so we upload a new VCL
vcli file add newVCL new.vcl

# Let's stage this to agent marked with "stage" tag
# Since no domain is specified the staging VG will use the same domain as the production one.
# But we can use a different domain specifying the new domain with "--dom <id>"
vcli vg stage 1 --vcl 2 --tags 2

# A new VCLGroup and deployment will now be automatically created and deployed
# to the agent with 'stage' tag. Modifying the new VCL will just be deployed to
# the staging VCLGroup.
# If we regret our staging we can delete it or if we are happy with the change and it
# has been tested, the VCLGroup can be promoted. Promote means that the new VCL is moved from
# the staging VCLGroup into the production VCLGroup.

# Either delete the staging without affecting the production VCLGroup
vcli vg delstage 1

# ...or promote our changes to production
vcli vg promote 1

If we decide to promote the VCLGroup, the staging VCLGroup and deployment that was automatically created will be removed from the system.