Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(purge): Setting the purge date to midnight of the day for purging #61

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Puppet Summary

This repo has taken inspiration from the [puppet-summary repo](https://github.com/skx/puppet-summary). When using the
summary application I found that you could not run the application in High Availability mode within Kubernetes. This is
due to the fact that the application uses a SQLite database and the file is locked when the application is
using `SQLITE` and storing the YAML files on the local filesystem.

This repo has been updated to use MySQL, MongoDB or SQLite as the database backend and also has the ability to upload
the raw reports to Google Cloud Storage for further processing. This also allows for more than one instance of the
application to be running at the same time. By allowing for MySQL or MongoDB as the database backend, this allows for
data retention on a more reliable database.
This is an application that helps you sort through the Puppet reports that are generated by your Puppet infrastructure.
The summary will give you a quick overview of the state of your infrastructure and will help you identify any issues
that may have occurred. There is an API and web interface that you can use to view the reports. The application will
also allow you to upload the raw reports from Puppet to the application, which will then be processed and stored in
the database. The application will also allow you to purge the database of old reports. The application is written in
GO and uses the gorilla/mux router for the API and the web interface.

## Usage

Expand Down Expand Up @@ -77,10 +74,10 @@ DB_CONN_STR="mongodb+srv://user:password@host/?retryWrites=true"
#### Google Cloud Storage

```shell
./puppet-summary -gcs -gcs-bucket <bucket>
./puppet-summary -gcs <bucket>
```

This will enable the `/upload` endpoint to push the raw reports from Puppet to Google Cloud Storage. For this, you will
This will allow the `/upload` endpoint to push the raw reports from Puppet to Google Cloud Storage. For this, you will
be required to specify a `gcs-bucket` flag with the name of the bucket to upload to; you will also need
the `GCS_CREDENTIALS` environment variable with the contents of the JSON credentials file. For example:

Expand Down
1 change: 1 addition & 0 deletions cmd/summary/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func purgeData(purgeDays int) {
// Get the start and end dates for the purge.
now := time.Now()
from := now.AddDate(0, 0, -purgeDays)
from = time.Date(from.Year(), from.Month(), from.Day(), 0, 0, 0, 0, from.Location())

err := dataaccess.Purge(from)
if err != nil {
Expand Down
Loading