Skip to content

Commit

Permalink
Removed LE Cert renewal and commands
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Aug 18, 2021
1 parent 55206ad commit 339569e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 349 deletions.
32 changes: 2 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,8 @@ update_dependencies: &update_dependencies
vendor/bin/blt circleci:update
- save_cache: *save_cache

update_certs: &update_certs
<<: *defaults
steps:
- *add_ssh
- *add_known_hosts
- checkout
- restore_cache: *restore_cache
- run: composer install --optimize-autoloader
- *disable_telemetry
- run:
name: Update Prod SSL Certs
command: |
vendor/bin/blt humsci:update-cert prod
vendor/bin/blt humsci:clean-backups
# Declare all of the jobs we should run.
version: 2

jobs:
run-updates:
<<: *update_dependencies
Expand All @@ -226,12 +211,10 @@ jobs:
<<: *deploy_branch
run-deploy-tag:
<<: *deploy_tag
run-update-certs:
<<: *update_certs

# Declare a workflow that runs all of our jobs in parallel.
workflows:
version: 2
version: 2.1
deploy_tag:
jobs:
# Tags are only created on successful code. Deploy the tag after creation.
Expand Down Expand Up @@ -275,14 +258,3 @@ workflows:
- /9\..*-release/
jobs:
- run-updates

update_certs:
triggers:
- schedule:
cron: "0 0 1 * *"
filters:
branches:
only:
- /develop/
jobs:
- run-update-certs
33 changes: 33 additions & 0 deletions blt/src/Blt/Plugin/Commands/HsAcquiaApiCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,39 @@ public function backupDatabases($options = ['start-at' => NULL]) {
}
}

/**
* Delete all old database backups.
*
* @command humsci:clean-backups
*/
public function deleteOldBackups() {
$this->connectAcquiaApi();
$environments = $this->acquiaEnvironments->getAll($this->appId);
$environment_uuids = [];

foreach ($environments as $environment) {
if ($environment->name != 'ra') {
$environment_uuids[$environment->uuid] = $environment->name;
}
}

foreach ($this->acquiaDatabases->getAll($this->appId) as $database) {
$this->say(sprintf('Gather database backup info for %s', $database->name));

foreach ($environment_uuids as $environment_uuid => $name) {
$backups = $this->acquiaDatabaseBackups->getAll($environment_uuid, $database->name);
foreach ($backups as $backup) {

$start_at = strtotime($backup->startedAt);
if ($backup->type == 'ondemand' && time() - $start_at > 60 * 60 * 24 * 7) {
$this->say(sprintf('Deleting %s backup #%s on %s environment.', $database->name, $backup->id, $name));
$this->acquiaDatabaseBackups->delete($environment_uuid, $database->name, $backup->id);
}
}
}
}
}

/**
* Sync the staging sites databases with that from production.
*
Expand Down
Loading

0 comments on commit 339569e

Please sign in to comment.