How to run Upgrade All from command line?

AI-generated summary

In a discussion titled “How to run Upgrade All from command line?” in the Support category, yanokwa seeks to minimize downtime during Discourse upgrades by running them via command line on a stock install. pfaffman suggests that a two-container setup — separating web and data — is essentially the stock configuration and best suited for minimizing downtime. Later, yanokwa shares that as of a recent update, upgrades can now be triggered via API using curl. The command to upgrade all components is:

curl -X POST "https://example.com/admin/docker/upgrade" \
-H "Content-Type: application/x-www-form-urlencoded;" \
-d "path=all" \
-d "api_key=1234" \
-d "api_username=system"

The path parameter can also target specific plugins (e.g., /var/www/discourse/plugins/discourse-solved). The underlying API, documented at docker_manager/manager-client/app/models/repo.js#L134, supports checking versions, initiating upgrades, and monitoring progress — with appropriate use of GET or POST requests. This solution enables automated, low-downtime upgrades without requiring container separation, fulfilling yanokwa’s original goal.

My high-level goal here is to run upgrades from the command line and minimize downtime when running those upgrades.

I understand that I can separate web and data containers, but my hope is for something I can run on a stock install.

I have noticed that the “Upgrade All” button at /admin/upgrade does an upgrade that minimizes the downtime, so I’d to run whatever it runs at the command line. Anyone know how to do that?

A two container install is pretty much a stock install. If what you want is

Then a two-container install is what you want.

As of a few days ago, it’s now possible to do upgrades via API (and thus curl). Thanks to @Osama for helping me with this!

To upgrade all, run this command:

curl -X POST "https:/example.com/admin/docker/upgrade" \
-H "Content-Type: application/x-www-form-urlencoded;" \
-d "path=all" \
-d "api_key=1234" \
-d "api_username=system"

path can be an absolute link to the plugin repo’s location on disk. So if you want run this on the discourse-solved plugin, you’d set path to /var/www/discourse/plugins/discourse-solved

There’s a pretty good API at starting at docker_manager/manager-client/app/models/repo.js#L134 that lets you find the latest versions, upgrade, and check progress. Don’t forget to the call from POST to GET as necessary.