Merge remote-tracking branch 'thanos/master' into main

This commit is contained in:
Miguel A. Cabrera Minagorri
2022-04-08 18:23:25 +02:00
16 changed files with 4459 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
name: 🐞 Bug
description: Create a report to help us improve
body:
- type: markdown
attributes:
value: |
Thank you for reporting an issue. Before you open the bug report please review the README file present in the root of this repository.
Please fill in as much of the following form as you're able.
- type: input
attributes:
label: Name and Version
description: Name and version of the affected container image
placeholder: bitnami/wordpress:1.2.3
validations:
required: true
- type: textarea
attributes:
label: What steps will reproduce the bug?
description: Enter details about your bug.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: textarea
attributes:
label: What is the expected behavior?
description: If possible please provide textual output instead of screenshots.
- type: textarea
attributes:
label: What do you see instead?
description: If possible please provide textual output instead of screenshots.
validations:
required: true
- type: textarea
attributes:
label: Additional information
description: Tell us anything else you think we should know.

View File

@@ -0,0 +1 @@
blank_issues_enabled: false

View File

@@ -0,0 +1,29 @@
name: "\U0001F680 Feature request"
description: Suggest an idea for this project
body:
- type: markdown
attributes:
value: |
Thank you for suggesting an idea to improve this Bitnami container image.
Please fill in as much of the following form as you're able.
- type: input
attributes:
label: Name and Version
description: Name and version of the affected container image
placeholder: bitnami/wordpress:1.2.3
validations:
required: true
- type: textarea
attributes:
label: What is the problem this feature will solve?
validations:
required: true
- type: textarea
attributes:
label: What is the feature you are proposing to solve the problem?
description: Describe the requests. If you already have something in mind... PRs are welcome!
validations:
required: true
- type: textarea
attributes:
label: What alternatives have you considered?

View File

@@ -0,0 +1,32 @@
<!--
Before you open the request please review the following guidelines and tips to help it be more easily integrated:
- Describe the scope of your change - i.e. what the change does.
- Describe any known limitations with your change.
- Please run any tests or examples that can exercise your modified code.
Thank you for contributing! We will try to test and integrate the change as soon as we can, but be aware we have many GitHub repositories to manage and can't immediately respond to every request. There is no need to bump or check in on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated sometimes the priorities of Bitnami might not match the priorities of the pull request. Don't fret, the open source community thrives on forks and GitHub makes it easy to keep your changes in a forked repo.
-->
**Description of the change**
<!-- Describe the scope of your change - i.e. what the change does. -->
**Benefits**
<!-- What benefits will be realized by the code change? -->
**Possible drawbacks**
<!-- Describe any known limitations with your change -->
**Applicable issues**
<!-- Enter any applicable Issues here (You can reference an issue using #) -->
**Additional information**
<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->

View File

@@ -0,0 +1,20 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '0 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.'
stale-pr-message: 'This Pull Request has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thank you for your contribution.'
close-issue-message: 'Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.'
close-pr-message: 'Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Pull Request. Do not hesitate to reopen it later if necessary.'
days-before-stale: 15
days-before-close: 5
exempt-issue-labels: 'on-hold'
exempt-pr-labels: 'on-hold'

View File

@@ -0,0 +1,9 @@
FROM scratch
LABEL maintainer "Bitnami <containers@bitnami.com>"
COPY prebuildfs /
COPY rootfs /
USER 1001
ENTRYPOINT [ "/bin/thanos" ]

View File

@@ -0,0 +1,10 @@
version: '2'
services:
thanos:
image: docker.io/bitnami/thanos:0
command:
- query
- --grpc-address=0.0.0.0:10901
- --http-address=0.0.0.0:9090
ports:
- '9090:9090'

View File

@@ -0,0 +1,7 @@
{
"thanos": {
"digest": "74548ede7f73c09fc4b4fbd6ba34b7915f5fcc87678950219aaf9651930805c7",
"type": "BLACKSMITH",
"version": "0.25.2"
}
}

View File

@@ -0,0 +1,3 @@
Bitnami containers ship with software bundles. You can find the licenses under:
/opt/bitnami/nami/COPYING
/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
# Contributor Code of Conduct
As contributors and maintainers of this project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities.
Communication through any of Bitnami's channels (GitHub, mailing lists, Twitter, and so on) must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
We promise to extend courtesy and respect to everyone involved in this project, regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to this project to do the same.
If any member of the community violates this code of conduct, the maintainers of this project may take action, including removing issues, comments, and PRs or blocking accounts, as deemed appropriate.
If you are subjected to or witness unacceptable behavior, or have any other concerns, please communicate with us.
If you have suggestions to improve this Code of Conduct, please submit an issue or PR.
**Attribution**
This Code of Conduct is adapted from the Angular project available at this page: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md

View File

@@ -0,0 +1,52 @@
# Contributing Guidelines
Contributions are welcome via GitHub Pull Requests. This document outlines the process to help get your contribution accepted.
Any type of contribution is welcome: new features, bug fixes, documentation improvements, etc.
## How to Contribute
1. Fork this repository, develop, and test your changes.
2. Submit a pull request.
### Requirements
When submitting a PR make sure that:
- It must pass CI jobs for linting and test the changes (if any).
- It must follow [container best practices](https://engineering.bitnami.com/articles/best-practices-writing-a-dockerfile.html).
- The title of the PR is clear enough.
- If necessary, add information to the repository's `README.md`.
#### Sign Your Work
The sign-off is a simple line at the end of the explanation for a commit. All commits needs to be signed. Your signature certifies that you wrote the patch or otherwise have the right to contribute the material. The rules are pretty simple, you only need to certify the guidelines from [developercertificate.org](https://developercertificate.org/).
Then you just add a line to every git commit message:
Signed-off-by: Joe Smith <joe.smith@example.com>
Use your real name (sorry, no pseudonyms or anonymous contributions.)
If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`.
Note: If your git config information is set properly then viewing the `git log` information for your commit will look something like this:
```
Author: Joe Smith <joe.smith@example.com>
Date: Thu Feb 2 11:41:15 2018 -0800
Update README
Signed-off-by: Joe Smith <joe.smith@example.com>
```
Notice the `Author` and `Signed-off-by` lines match. If they don't your PR will be rejected by the automated DCO check.
### PR Approval and Release Process
1. Changes are manually reviewed by Bitnami team members usually within a business day.
2. Once the changes are accepted, the PR is tested (if needed) into the Bitnami CI pipeline, the container is deployed and tested (verification and functional tests) using docker-compose and Helm (if there is an associated Helm Chart).
3. The PR is merged by the reviewer(s) in the GitHub `master` branch.
4. Then our CI/CD system is going to push the container image to the different registries including the recently merged changes.
***NOTE***: Please note that, in terms of time, may be a slight difference between the appearance of the code in GitHub and the image with the changes in the different registries.

13
bitnami/thanos/LICENSE.md Normal file
View File

@@ -0,0 +1,13 @@
Copyright &copy; 2022 Bitnami
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

210
bitnami/thanos/README.md Normal file
View File

@@ -0,0 +1,210 @@
# Thanos packaged by Bitnami
## What is Thanos?
> Thanos is a highly available metrics system that can be added on top of existing Prometheus deployments, providing a global query view across all Prometheus installations.
[Overview of Thanos](https://thanos.io/)
Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.
## TL;DR
```console
$ docker run --name thanos bitnami/thanos:latest
```
### Docker Compose
```console
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-thanos/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
```
## Why use Bitnami Images?
* Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
* With Bitnami images the latest bug fixes and features are available as soon as possible.
* Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
> This [CVE scan report](https://quay.io/repository/bitnami/thanos?tab=tags) contains a security report with all open CVEs. To get the list of actionable security issues, find the "latest" tag, click the vulnerability report link under the corresponding "Security scan" field and then select the "Only show fixable" filter on the next page.
## How to deploy Thanos in Kubernetes?
Deploying Bitnami applications as Helm Charts is the easiest way to get started with our applications on Kubernetes. Read more about the installation in the [Bitnami Thanos Chart GitHub repository](https://github.com/bitnami/charts/tree/master/bitnami/thanos).
## Why use a non-root container?
Non-root container images add an extra layer of security and are generally recommended for production environments. However, because they run as a non-root user, privileged tasks are typically off-limits. Learn more about non-root containers [in our docs](https://docs.bitnami.com/tutorials/work-with-non-root-containers/).
## Supported tags and respective `Dockerfile` links
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/tutorials/understand-rolling-tags-containers/).
* [`0`, `0-scratch`, `0.25.2`, `0.25.2-scratch-r2`, `latest` (0/scratch/Dockerfile)](https://github.com/bitnami/bitnami-docker-thanos/blob/0.25.2-scratch-r2/0/scratch/Dockerfile)
## Connecting to other containers
Using [Docker container networking](https://docs.docker.com/engine/userguide/networking/), a different server running inside a container can easily be accessed by your application containers and vice-versa.
Containers attached to the same network can communicate with each other using the container name as the hostname.
### Using the Command Line
#### Step 1: Create a network
```console
$ docker network create thanos-network --driver bridge
```
#### Step 2: Create a volume for Prometheus data
```console
$ docker volume create --name prometheus_data
```
#### Step 3: Launch a Prometheus container within your network
Create a configuration file **prometheus.yml** for Prometheus as the one below:
```yaml
global:
scrape_interval: 5s
# mandatory
# used by Thanos Query to filter out store APIs to touch during query requests
external_labels:
foo: bar
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
```
Use the `docker run` command to launch the Prometheus containers using the arguments below:
- `--network <network>` argument to attach the container to the `thanos-network` network.
- `--volume [host-src:]container-dest[:<options>]` argument to mount the configuration file for Prometheus and a data volume to avoid loss of data. As this is a non-root container, the mounted files and directories must have the proper permissions for the UID `1001`.
```console
$ docker run -d --name "prometheus" \
--network "thanos-network" \
--volume "$(pwd)/prometheus.yml:/opt/bitnami/prometheus/conf/prometheus.yml:ro" \
--volume "prometheus_data:/opt/bitnami/prometheus/data" \
bitnami/prometheus
```
#### Step 4: Launch a Thanos sidecar container within your network
Use the `docker run` command to launch the Thanos sidecar container using the argument below and overwriting the default command:
- `--network <network>` argument to attach the container to the `thanos-network` network.
- `--volume [host-src:]container-dest[:<options>]` argument to mount the Prometheus data volume.
```console
$ docker run -d --name "thanos-sidecar" \
--network "thanos-network" \
--volume "prometheus_data:/data" \
bitnami/thanos sidecar --tsdb.path=/data --prometheus.url=http://prometheus:9090 --grpc-address=0.0.0.0:10901
```
#### Step 5: Launch a Thanos Query container within your network
Use the `docker run` command to launch the Thanos Query container using the argument below and overwriting the default command:
- `--network <network>` argument to attach the container to the `thanos-network` network.
- `--expose [hostPort:containerPort]` argument to expose the port `9090`.
```console
$ docker run -d --name "thanos-query" \
--network "thanos-network" \
--expose "9090:9090" \
bitnami/thanos query --grpc-address=0.0.0.0:10901 --http-address=0.0.0.0:9090 --store=thanos-sidecar:10901
```
Then you can access your Thanos Query UI at `http://localhost:9090/`
### Using Docker Compose
You can use the **docker-compose-cluster.yml** available on this repository to deploy an architecture like the one below:
```
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Node │ │ Thanos │───────────▶ │ Thanos Store │ │ Thanos │
│ Exporter │ │ Query │──┐ │ Gateway │ │ Compactor │
└──────────────┘ └──────────────┘ │ └──────────────┘ └──────────────┘
▲ │ │ │
│ gather hardware │ query │ storages │ Compact & downsample
│ & OS metrics │ metrics │ query metrics │ blocks
│ │ │ │
┌ ── ── ── ── ── ── ── ── ── ── ── ──┐ | | |
│┌──────────────┐ ┌──────────────┐│ │ ▼ │
││ Prometheus │ ─▶ │ Thanos ││ ◀─────────────┘ ┌──────────────┐ │
││ │ ◀─ │ Sidecar ││ │ MinIO │◀─────────────┘
│└──────────────┘ └──────────────┘│ │ │
└ ── ── ── ── ── ── ── ── ── ── ── ──┘ └──────────────┘
```
Under the [configuration section](#configuration) you can find more information about each component's role.
The unique "mandatory" components are Prometheus, Thanos Sidecar and Thanos Query. The rest of components are optional.
To do so, run the commands below:
```console
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-minio/master/docker-compose-cluster.yml > docker-compose.yml
$ docker-compose up -d
```
## Configuration
Thanos can be configured via command-line flags and, depending on them, the same container image can be used to create components with differentes roles:
- Sidecar: connects to Prometheus, reads its data for query and/or uploads it to cloud storage.
- Store Gateway: serves metrics inside of a cloud storage bucket.
- Compactor: compacts, downsamples and applies retention on the data stored in cloud storage bucket.
- Receiver: receives data from Prometheus remote-write WAL, exposes it and/or upload it to cloud storage.
- Ruler/Rule: evaluates recording and alerting rules against data in Thanos for exposition and/or upload.
- Querier/Query: implements Prometheus' v1 API to aggregate data from the underlying components.
For further documentation, please check [Thanos documentation](https://github.com/thanos-io/thanos/tree/master/docs).
## Logging
The Bitnami Thanos Docker image sends the container logs to the `stdout`. To view the logs:
```console
$ docker logs thanos
```
You can configure the containers [logging driver](https://docs.docker.com/engine/admin/logging/overview/) using the `--log-driver` option if you wish to consume the container logs differently. In the default configuration docker uses the `json-file` driver.
## Contributing
We'd love for you to contribute to this container. You can request new features by creating an [issue](https://github.com/bitnami/bitnami-docker-thanos/issues), or submit a [pull request](https://github.com/bitnami/bitnami-docker-thanos/pulls) with your contribution.
## Issues
If you encountered a problem running this container, you can file an [issue](https://github.com/bitnami/bitnami-docker-thanos/issues/new). For us to provide better support, be sure to include the following information in your issue:
- Host OS and version
- Docker version (`docker version`)
- Output of `docker info`
- Version of this container
- The command you used to run the container, and any relevant output you saw (masking any sensitive information)
## License
Copyright &copy; 2022 Bitnami
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,141 @@
version: '2.1'
services:
# Node Exporter
node-exporter:
image: docker.io/bitnami/node-exporter:1
command:
- --web.listen-address=0.0.0.0:9100
# Prepare Prometheus Configuration
prepare-prometheus:
image: docker.io/bitnami/minideb:buster
command:
- /bin/bash
- -ec
- |
cat >'/conf/prometheus.yml'<<'EOF'
global:
scrape_interval: 5s
external_labels:
foo: bar
scrape_configs:
- job_name: node-exporter
static_configs:
- targets:
- node-exporter:9100
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
EOF
volumes:
- 'prom_conf:/conf'
# Prometheus Server
prometheus:
image: docker.io/bitnami/prometheus:2
volumes:
- 'tsdb_data:/opt/bitnami/prometheus/data'
- 'prom_conf:/opt/bitnami/prometheus/conf'
depends_on:
- node-exporter
- prepare-prometheus
# Thanos Sidecar
sidecar:
image: docker.io/bitnami/thanos:0
command:
- sidecar
- --tsdb.path=/data
- --prometheus.url=http://prometheus:9090
- --grpc-address=0.0.0.0:10901
volumes:
- 'tsdb_data:/data'
depends_on:
- query
# MinIO
minio:
image: docker.io/bitnami/minio:2021
ports:
- '9000:9000'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- 'minio_data:/data'
environment:
- MINIO_ROOT_USER=minio
- MINIO_ROOT_PASSWORD=minio123
- MINIO_DEFAULT_BUCKETS=thanos
# Prepare Object Store configuration
prepare-object-store-conf:
image: docker.io/bitnami/minideb:buster
command:
- /bin/bash
- -ec
- |
cat >'/conf/bucket.yml'<<'EOF'
type: s3
config:
bucket: thanos
endpoint: minio:9000
insecure: true
access_key: minio
secret_key: minio123
EOF
volumes:
- 'ojb_store_conf:/conf'
# Thanos Store Gateway
store-gateway:
image: docker.io/bitnami/thanos:0
command:
- store
- --objstore.config-file=/conf/bucket.yml
- --data-dir=/data
- --grpc-address=0.0.0.0:10901
user: "0"
volumes:
- 'ojb_store_conf:/conf'
- 'store_data:/data'
depends_on:
- query
# Thanos Compactor
compactor:
image: docker.io/bitnami/thanos:0
command:
- compact
- --objstore.config-file=/conf/bucket.yml
- --data-dir=/data
user: "0"
volumes:
- 'ojb_store_conf:/conf'
depends_on:
- query
# Thanos Query
query:
image: docker.io/bitnami/thanos:0
command:
- query
- --grpc-address=0.0.0.0:10901
- --http-address=0.0.0.0:9090
- --store=sidecar:10901
- --store=store-gateway:10901
ports:
- '9090:9090'
depends_on:
prepare-object-store-conf:
condition: service_started
prometheus:
condition: service_started
minio:
condition: service_healthy
volumes:
prom_conf:
driver: local
tsdb_data:
driver: local
minio_data:
driver: local
ojb_store_conf:
driver: local
store_data:
driver: local

View File

@@ -0,0 +1,10 @@
version: '2'
services:
thanos:
image: docker.io/bitnami/thanos:0
command:
- query
- --grpc-address=0.0.0.0:10901
- --http-address=0.0.0.0:9090
ports:
- '9090:9090'