cpan-testers / cpantesters-project

A meta-project for tracking CPAN Testers project goals
6 stars 1 forks source link

Add Rex task to show/hide scheduled downtime message #17

Open preaction opened 7 years ago

preaction commented 7 years ago

We should have an easy way to show/hide the scheduled maintenance message. This should be done via a Rex task.

There should be two Rex tasks: One to show the downtime message, one to hide it and return to normal operation. The Rex tasks should work via Debian's default Apache config tools: a2ensite and a2dissite. The downtime message should be its own site config, and the Rex task should enable/disable the appropriate sites as needed.

Everything about the downtime message should be in the cpantesters-deploy project, including the site config file, and the downtime message HTML itself. The user should be prompted to update the downtime message (by opening $EDITOR locally) before uploading it to the server and enabling it.

In order for the message to be displayed, the Fastly cache will need to be cleared. This should be done via an API if possible, otherwise the user should be instructed to clear the Fastly cache manually.

preaction commented 7 years ago

@ranguard mentioned we can use Net::Fastly to try to access the Fastly API automatically to do these things. The Fastly web UI has a way to generate API keys that can be used to limit access to simply the commands we want people to be able to run (since our Rexfile is public, which means the API keys will also be public). Otherwise, we'll have to figure out a way to secure the thing, which may mean forcing operations folks to have their own API keys (since they already need their own accounts on the cpantesters servers anyway).

ranguard commented 7 years ago

Generating a token https://docs.fastly.com/api/auth#tokens_db4655a45a0107448eb0676577446e40

Make sure to limit to the scope ( https://docs.fastly.com/api/auth#scopes ) to just purging, and probably a specific service.

preaction commented 7 years ago

The CPAN and BackPAN mirrors on cpantesters.org are also down. The maintenance on the CPAN Testers app should not affect them, so the configuration should find a way to keep them up.

preaction commented 7 years ago

The mirrors are back up, and there are now start_maintenance and stop_maintenance tasks in the Rexfile to start and stop the maintenance mode, which disables the app sites, enables the maintenance sites, and keeps the cpan/backpan mirrors up.

It does not yet automatically purge the Fastly cache, that remains to be done.