Skip to content

BB-2883 Allow instantce_statistics_csv to receive multiple domains; Create trial_instances_report on cronjob

Modifies the instance_statistics_csv command to allow for multiple domains. Also uses this new version in a new task to send a trial instances report to emails set in settings.TRIAL_INSTANCES_REPORT_RECIPIENTS

JIRA tickets: BB-2883

Screenshots:

trial_instance_report_email trial_instance_report_csv

Testing instructions:

Test on functionality on staging:

  1. Generate the public SSH key for www-data@stage.manage.opencraft.com using ssh-keygen -y -f ~/.ssh/id_rsa
  2. Add public key to authorized_keys file on logs.opencraft.com
  3. Set INSTANCE_LOGS_SERVER_HOST to logs.opencraft.com in .env file on stage.manage.opencraft.com
  4. Run
make manage -- instance_statistics_csv --domains daniel.stage.opencraft.hosting,piotr.stage.opencraft.hosting,gabrieltesting.stage.opencraft.hosting
  1. Wait for resulting output

Test task on staging:

  1. Generate the public SSH key for www-data@stage.manage.opencraft.com using ssh-keygen -y -f ~/.ssh/id_rsa
  2. Add public key to authorized_keys file on logs.opencraft.com
  3. Set INSTANCE_LOGS_SERVER_HOST to logs.opencraft.com in .env file on stage.manage.opencraft.com
  4. Set TRIAL_INSTANCE_REPORT_RECIPIENTS to '["YOUR_EMAIL@opencraft.com"]' in .env file on stage.manage.opencraft.com
  5. Edit reports/tasks.py and change this line
@db_periodic_task(crontab(day='1', hour='2', minute='0'))

to this

@db_periodic_task(crontab(minute='*/5'))
  1. Start the web process with make run (in the web screen tab) and wait 5-6 minutes
  2. Check your email for a resulting CSV

Reviewers

  • @lgp171188

Merge request reports