Unverified Commit 714677f3 authored by Kevin Di Lallo's avatar Kevin Di Lallo Committed by GitHub
Browse files

Merge pull request #199 from nikhildoifode/na-1217

Upgraded InfluxDB to 1.8 from 1.7
parents 3d886e76 63a650b2
Loading
Loading
Loading
Loading

charts/influxdb/.helmignore

100755 → 100644
+0 −0

File mode changed from 100755 to 100644.

charts/influxdb/Chart.yaml

100755 → 100644
+14 −10
Original line number Diff line number Diff line
apiVersion: v2
name: influxdb
version: 3.0.1
appVersion: 1.7.6
appVersion: 1.8.0
description: Scalable datastore for metrics, events, and real-time analytics.
home: https://www.influxdata.com/time-series-platform/influxdb/
keywords:
- influxdb
- database
- timeseries
home: https://www.influxdata.com/time-series-platform/influxdb/
- influxdata
maintainers:
- email: rawkode@influxdata.com
  name: rawkode
- email: giacomo@influxdata.com
  name: gitirabassi
- email: urakiny@gmail.com
  name: aisuko
- email: naseem@transit.app
  name: naseemkullah
name: influxdb
sources:
- https://github.com/influxdata/influxdb
maintainers:
- name: jackzampolin
  email: jack@influxdb.com
- name: aisuko
  email: urakiny@gmail.com
engine: gotpl
version: 4.8.10

charts/influxdb/README.md

100755 → 100644
+278 −47

File changed.File mode changed from 100755 to 100644.

Preview size limit exceeded, changes collapsed.

+66 −0
Original line number Diff line number Diff line
#! /usr/bin/env bash

set -e

# This script wants these variable to be set.

## S3_BUCKET <- The name of the bucket where the backups are stored
## S3_ENDPOINT <- The endpoint of the S3 service
## AWS_ACCESS_KEY_ID <- Access credentials        
## AWS_SECRET_ACCESS_KEY <- Access credentials
## DAYS_TO_RETAIN <- The TTL for the backups === number of backups to keep.

# Sanity check to avoid removing all backups.
[[ "$DAYS_TO_RETAIN" -lt 1 ]] && DAYS_TO_RETAIN=1

function get_records {
    before_date="$1"

    aws s3api list-objects \
        --bucket ${S3_BUCKET} \
        --endpoint-url ${S3_ENDPOINT} \
        --query "Contents[?LastModified<='${before_date}'][].{Key: Key}"
}

function remove_old_backups {
    before_date=$(date --iso-8601=seconds -d "-${DAYS_TO_RETAIN} days")  
    now=$(date --iso-8601=seconds)

    del_records=$(get_records "${before_date}")
    all_records=$(get_records "${now}")

    del_paths=()
    all_paths=()
    
    function _jq {
        echo ${row} | base64 --decode | jq -r ${1}
    }

    for row in $(echo "${del_records}" | jq -r '.[] | @base64'); do       
        del_paths+=($(_jq '.Key'))                
    done

    for row in $(echo "${all_records}" | jq -r '.[] | @base64'); do
        all_paths+=($(_jq '.Key'))                
    done

    # Number of backups left if all old backups are removed.
    left=$((${#all_paths[@]} - ${#del_paths[@]}))

    # We ALWAYS keep N backups even if their TTL has expired!
    if (( ${left} < ${DAYS_TO_RETAIN} )); then
        num_to_delete=$((${#all_paths[@]} - ${DAYS_TO_RETAIN}))
    else
        num_to_delete=${#del_paths[@]}
    fi

    for path in "${del_paths[@]::${num_to_delete}}"; do
        aws s3 rm "s3://${S3_BUCKET}/${path}" \
            --endpoint-url "${S3_ENDPOINT}"
    done
}

# Installs jq.
yum install -y jq

remove_old_backups
+25 −10

File changed.

Preview size limit exceeded, changes collapsed.

Loading