Search code examples
apacheinstall4jcanary-deployment

Canary deployment of update to install4j application using Apache


I have a desktop app with install4j auto-updates (checked at app startup). I want to do a phased rollout of the updates.

For this I am thinking of having Apache Load Balancer serve an updated version of updates.xml to a subset of my users. The problems I am seeing:

  • If the response to a request of updates.xml sets a cookie, will the request to the media parts include that cookie? The cookie is needed to prevent loss of stickyness, as explained on the section "Details on load balancer stickyness" of the provided link. I don't want a client app that recieves the updated updates.xml then have an 404 when fetching a mediapart because it's request being redirected to the "old" server.

  • If I setup the load balancing to redirect 10% of my traffic to the new updates.xml, this doesn't mean I will achieve 10% of my users getting the updated version. The actual percentage will have no correlation. This is because even up-to-date apps will still check updates.xml at startup, counting towards the total traffic. I guess this is ok as long as I don't need precise figures but just want to avoid a big bang deployment. But is there a better approach?

Edit

I implemnted load balancing on the deployment folder. The workflow is like this:

  • I have Server Green and Server Blue. Traffic is directed to just Server Green.
  • When I want to deploy, I copy new updates.xml and media files to Server Blue, and only media files to Server Green, old updates.xml is not updated.
  • We route traffic 90% to Server Green, 10% to Server Blue.
  • We gradually increase traffic to Server Blue as we gain confidence on the new version.
  • When we are ready to do rollout to 100%, we copy the new updates.xml to Server Green, and now both servers have exactly the same files.
  • At this point, it doesn't matter how we configure the traffic balancing. It could be 100-0, 50-50, 0-100, etc. We chose to do it 90% green - 10% blue, as this is the balancing configuration we need for next deployment. On next deployment we just deploy to Server Blue, no need to change balancing configuration once again.

Solution

  • If the response to a request of updates.xml sets a cookie, will the request to the media parts include that cookie?

    No, cookies are not managed by install4j, you can only set a cookie in the "Request headers" property of actions like the "Check for update" and "Download file" actions.

    You would have to first add a "HTTP request" action to some resource on the server and configure its "Variable name for response headers" property to extract the cookie. The "HTTP request method" property can be set to "HEAD" so you only get the headers. From that variable (a map instance), you can get the cookie variable and save it to another installer variable. This logic can be done in a "Run script" action.