Skip to content

Commit 43e9089

Browse files
committed
Sunday hacking.
Signed-off-by: Bartek Plotka <[email protected]>
1 parent 14b2df0 commit 43e9089

27 files changed

+327
-69
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ data/
1717

1818
/.idea
1919
/*.iml
20+
2021
website/public/
22+
website/docs-pre-processed/

CODE_OF_CONDUCT.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,4 @@ face temporary or permanent repercussions as determined by other members of the
5858

5959
## Attribution
6060

61-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
62-
63-
[homepage]: http://contributor-covenant.org
64-
[version]: http://contributor-covenant.org/version/1/4/
61+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.4, available at [http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4/)

Makefile

+9-4
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,21 @@ else
200200
@echo >&2 "No bzr binary found."; exit 1
201201
endif
202202

203+
.PHONY: web-pre-process
204+
web-pre-process:
205+
@echo ">> running documentation website pre processing"
206+
@bash scripts/websitepreprocess.sh
207+
203208
.PHONY: web
204-
web: $(HUGO)
209+
web: web-pre-process $(HUGO)
205210
@echo ">> building documentation website"
206211
# TODO(bwplotka): Make it --gc
207-
@HUGO_ENV=production $(HUGO) --config $(WEB_DIR)/hugo.yaml --minify -v
212+
@cd $(WEB_DIR) && HUGO_ENV=production $(HUGO) --config hugo.yaml --minify -v
208213

209214
.PHONY: web-serve
210-
web-serve: $(HUGO)
215+
web-serve: web-pre-process $(HUGO)
211216
@echo ">> serving documentation website"
212-
@$(HUGO) --config $(WEB_DIR)/hugo.yaml -v server
217+
@cd $(WEB_DIR) && $(HUGO) --config hugo.yaml -v server
213218

214219
.PHONY: web-deploy
215220
web-deploy:

docs/components/bucket.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Bucket
33
type: docs
4-
menu: "components"
4+
menu: components
55
---
66

77
# Bucket

docs/components/compact.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Compact
33
type: docs
4-
menu: "components"
4+
menu: components
55
---
66

77
# Compact

docs/components/query.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Query
33
type: docs
4-
menu: "components"
4+
menu: components
55
---
66

77
# Query

docs/components/rule.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Rule
33
type: docs
4-
menu: "components"
4+
menu: components
55
---
66

77
# Rule

docs/components/sidecar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Sidecar
33
type: docs
4-
menu: "components"
4+
menu: components
55
---
66

77
# Sidecar

docs/components/store.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Store
33
type: docs
4-
menu: "components"
4+
menu: components
55
---
66

77
# Store

docs/contributing/CODE_OF_CONDUCT.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Code of Conduct
3+
type: docs
4+
menu: contributing
5+
---
6+
7+
<-- Copy from CODE_OF_CONDUCT.md -->
8+
9+
## Our Pledge
10+
11+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to
12+
making participation in our project and our community a harassment-free experience for everyone,
13+
regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience,
14+
nationality, personal appearance, race, religion, or sexual identity and orientation.
15+
16+
## Our Standards
17+
18+
Examples of behavior that contributes to creating a positive environment include:
19+
20+
* Using welcoming and inclusive language
21+
* Being respectful of differing viewpoints and experiences
22+
* Gracefully accepting constructive criticism
23+
* Focusing on what is best for the community
24+
* Showing empathy towards other community members
25+
26+
Examples of unacceptable behavior by participants include:
27+
28+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
29+
* Trolling, insulting/derogatory comments, and personal or political attacks
30+
* Public or private harassment
31+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
32+
* Other conduct which could reasonably be considered inappropriate in a professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable behavior and
37+
are expected to take appropriate and fair corrective action in response to any instances of
38+
unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or reject comments,
41+
commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct,
42+
or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate,
43+
threatening, offensive, or harmful.
44+
45+
## Scope
46+
47+
This Code of Conduct applies both within project spaces and in public spaces when an individual
48+
is representing the project or its community. Examples of representing a project or community
49+
include using an official project e-mail address, posting via an official social media account,
50+
or acting as an appointed representative at an online or offline event. Representation of a project
51+
may be further defined and clarified by project maintainers.
52+
53+
## Enforcement
54+
55+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting
56+
the project team members (e.g @bplotka @domgreen, @Fabian Reinartz) at Thanos slack workspace.
57+
The project team will review and investigate all complaints,
58+
and will respond in a way that it deems appropriate to the circumstances.
59+
The project team is obligated to maintain confidentiality with regard to the
60+
reporter of an incident. Further details of specific enforcement policies may be posted separately.
61+
62+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may
63+
face temporary or permanent repercussions as determined by other members of the project's leadership.
64+
65+
## Attribution
66+
67+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.4, available at [http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4/)

docs/contributing/CONTRIBUTING.md

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: Contributing
3+
type: docs
4+
menu: contributing
5+
---
6+
7+
<-- Copy from CONTRIBUTING.md -->
8+
9+
When contributing not obvious change to Thanos repository, please first
10+
discuss the change you wish to make via issue or slack, or any other
11+
method with the owners of this repository before making a change.
12+
13+
Please follow the [code of conduct](CODE_OF_CONDUCT.md) in all your interactions with the project.
14+
15+
## Thanos Philosophy
16+
17+
The philosophy of Thanos and our community is borrowing much from UNIX philosophy and the golang programming language.
18+
19+
* Each sub command should do one thing and do it well
20+
* eg. thanos query proxies incoming calls to known store API endpoints merging the result
21+
* Write components that work together
22+
* e.g. blocks should be stored in native prometheus format
23+
* Make it easy to read, write, and, run components
24+
* e.g. reduce complexity in system design and implementation
25+
26+
## Adding New Features / Components
27+
28+
Adding large new features and components to Thanos should be done by first creating a [proposal](docs/proposals) document outlining the design decisions of the change, motivations for the change, and any alternatives that might have been considered.
29+
30+
## Prerequisites
31+
32+
* It is strongly recommended that you use OSX or popular Linux distributions systems e.g. Ubuntu, Redhat, or OpenSUSE for development.
33+
34+
## Pull Request Process
35+
36+
1. Read [getting started docs](docs/getting_started.md) and prepare Thanos.
37+
2. Familiarize yourself with [Makefile](Makefile) commands like `format`, `build`, `proto` and `test`.
38+
3. Fork improbable-eng/thanos.git and start development from your own fork. Here are sample steps to setup your development environment:
39+
```console
40+
$ mkdir -p $GOPATH/src/github.com/improbable-eng
41+
$ cd $GOPATH/src/github.com/improbable-eng
42+
$ git clone https://github.com/<your_github_id>/thanos.git
43+
$ cd thanos
44+
$ git remote add upstream https://github.com/improbable-eng/thanos.git
45+
$ git remote update
46+
$ git merge upstream/master
47+
$ make build
48+
$ ./thanos -h
49+
```
50+
4. Keep PRs as small as possible. For each of your PR, you create one branch based on the latest master. Chain them if needed (base PR on other PRs). Here are sample steps you can follow. You can get more details about the workflow from [here](https://gist.github.com/Chaser324/ce0505fbed06b947d962).
51+
```console
52+
$ git checkout master
53+
$ git remote update
54+
$ git merge upstream/master
55+
$ git checkout -b <your_branch_for_new_pr>
56+
$ make build
57+
$ <Iterate your development>
58+
$ git push origin <your_branch_for_new_pr>
59+
```
60+
5. If you don't have a live object store ready add these envvars to skip tests for these:
61+
- THANOS_SKIP_GCS_TESTS to skip GCS tests.
62+
- THANOS_SKIP_S3_AWS_TESTS to skip AWS tests.
63+
- THANOS_SKIP_AZURE_TESTS to skip Azure tests.
64+
- THANOS_SKIP_SWIFT_TESTS to skip SWIFT tests.
65+
- THANOS_SKIP_TENCENT_COS_TESTS to skip Tencent COS tests.
66+
67+
If you skip all of these, the store specific tests will be run against memory object storage only.
68+
CI runs GCS and inmem tests only for now. Not having these variables will produce auth errors against GCS, AWS, Azure or COS tests.
69+
70+
6. If your change affects users (adds or removes feature) consider adding the item to [CHANGELOG](CHANGELOG.md)
71+
7. You may merge the Pull Request in once you have the sign-off of at least one developers with write access, or if you
72+
do not have permission to do that, you may request the second reviewer to merge it for you.
73+
8. If you feel like your PR waits too long for a review, feel free to ping [`#thanos-dev`](https://join.slack.com/t/improbable-eng/shared_invite/enQtMzQ1ODcyMzQ5MjM4LWY5ZWZmNGM2ODc5MmViNmQ3ZTA3ZTY3NzQwOTBlMTkzZmIxZTIxODk0OWU3YjZhNWVlNDU3MDlkZGViZjhkMjc) channel on our slack for review!
74+
75+
## Dependency management
76+
77+
The Thanos project uses [Go modules](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more) to manage dependencies on external packages. This requires a working Go environment with version 1.11 or greater, git and [bzr](http://wiki.bazaar.canonical.com/Download) installed.
78+
79+
To add or update a new dependency, use the `go get` command:
80+
81+
```bash
82+
# Pick the latest tagged release.
83+
go get example.com/some/module/pkg
84+
85+
# Pick a specific version.
86+
go get example.com/some/module/[email protected]
87+
```
88+
89+
Tidy up the `go.mod` and `go.sum` files:
90+
91+
```bash
92+
make go-mod-tidy
93+
git add go.mod go.sum
94+
git commit
95+
```
96+
97+
You have to commit the changes to `go.mod` and `go.sum` before submitting the pull request.

docs/help/contribute.md renamed to docs/contributing/dev.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Troubleshooting for dev workflow
33
type: doc
4-
menu: help
4+
menu: contributing
55
---
66

77
## Dep `grouped write of manifest, lock and vendor: scratch directory ... already exists, please remove it`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Contribute to docs
3+
type: docs
4+
menu: contributing
5+
---
6+
7+
# How to contribute to Docs/Website
8+
9+
`./docs` directory is used as markdown source files using [blackfriday](https://github.com/russross/blackfriday) to render Thanos website resources.
10+
11+
However the aim for those is to also have those `*.md` files renderable and useable (including links) via GitHub.
12+
13+
To make that happen we use following rules and helpers that are listed here
14+
15+
## Font Matter
16+
17+
[Font Matter](https://gohugo.io/content-management/front-matter/) is essential on top of every md file if
18+
you want to link this file into any menu/submenu option. We use YAML formatting. This will render
19+
in GitHub as markdown just fine:
20+
21+
```md
22+
23+
---
24+
title: <titke>
25+
type: ...
26+
weight: <weight>
27+
menu: <where to link files in> # This also is refered in permalinks.
28+
---
29+
30+
```
31+
32+
## Links
33+
34+
Aim is to match linking behaviour in website being THE SAME as Github. This means:
35+
36+
* For files in Hugo <content> dir (so `./docs`). Put `slug: /<filename with extension>`
37+
* For any sub dir add to `website/hugo.yaml` new dir as key `permalinks:` with `<dir>: /<dir>/:filname.md`
38+
39+
Then everywhere use native markdown *relative* symbolic links if you want to reference some md file from `docs`:
40+
41+
`[title](relative path to .md file)`
42+
43+
Or absolute path to the project repo if you want to link to exact commit e.g:
44+
45+
`[title](/Makefile)`
46+
47+
Small [post processing script](/scripts/websitepreprocess.sh) adjusts link for Hugo rendering.
48+
49+
Why?
50+
51+
* Links works on GitHub
52+
* Links works on website
53+
* Markdown plugins works as expected (e.g IDE integrations)
54+
55+
## Sections/Menu
56+
57+
New menus `.Site.Menus` are added as soon as some file has Font Matter with certain `menu`.
58+
59+
Keep `menu` the same as subdirectory the file is in. This will help to manage all docs.
60+
61+
Show new menu section in main page by changing `website/layouts/_default/baseof.html` file.

docs/intro/design.md renamed to docs/design.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: Design
33
type: docs
4-
menu: "thanos"
4+
menu: thanos
5+
slug: /design.md
56
---
67

78
# Design

0 commit comments

Comments
 (0)