Skip to content

[-] fix anonymous Grafana access in Docker, fixes #724#725

Merged
pashagolub merged 2 commits intocybertec-postgresql:masterfrom
iuuuuan:patch-1
Apr 17, 2025
Merged

[-] fix anonymous Grafana access in Docker, fixes #724#725
pashagolub merged 2 commits intocybertec-postgresql:masterfrom
iuuuuan:patch-1

Conversation

@iuuuuan
Copy link
Copy Markdown
Contributor

@iuuuuan iuuuuan commented Apr 15, 2025

Add newline for PW_GRAFANANOANONYMOUS

@pashagolub pashagolub self-assigned this Apr 15, 2025
@pashagolub pashagolub added bug Something isn't working docker Docker related issues labels Apr 15, 2025
@iuuuuan
Copy link
Copy Markdown
Contributor Author

iuuuuan commented Apr 15, 2025

Patch is working as expected. File /etc/grafana/grafana.ini contain new line for block [auth.anonymous]

[server]
protocol = http
cert_file = /pgwatch/persistent-config/self-signed-ssl.pem
cert_key = /pgwatch/persistent-config/self-signed-ssl.key

[security]
admin_user = user
admin_password = password

[auth.anonymous]
enabled = true
# Organization name that should be used for unauthenticated users
org_name = Main Org.
# Role for unauthenticated users, other valid values are `Editor` and `Admin`
org_role = Editor

[dashboards]
default_home_dashboard_path = /var/lib/grafana/dashboards/1-global-db-overview.json

[metrics]
enabled = false

[plugins]
preinstall = marcusolsson-treemap-panel

[feature_toggles]
angularDeprecationUI = false
[auth.anonymous]
enabled = false

@ondar
Copy link
Copy Markdown
Contributor

ondar commented Apr 15, 2025

I see it twice once with enabled = true in the middle of the file and then with enabled = false on the end?

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 15, 2025

Pull Request Test Coverage Report for Build 14509920787

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 36.925%

Totals Coverage Status
Change from base Build 14488720037: 0.0%
Covered Lines: 1758
Relevant Lines: 4761

💛 - Coveralls

@iuuuuan
Copy link
Copy Markdown
Contributor Author

iuuuuan commented Apr 16, 2025

I see it twice once with enabled = true in the middle of the file and then with enabled = false on the end?

This is because template file docker/demo/grafana.ini contains first [auth.anonymous] block. Second block is being added with docker/bootstrap/init_persistent_config.sh script which overrides option enabled for block [auth.anonymous].

@ondar
Copy link
Copy Markdown
Contributor

ondar commented Apr 16, 2025

If that is intended behavior then ok 😃

@pashagolub
Copy link
Copy Markdown
Collaborator

I agree with @ondar. Having two entries in config looks weird. I'll prefer changing the value for the first entry, maybe with sed

iuuuuan and others added 2 commits April 16, 2025 10:57
Add newline for PW_GRAFANANOANONYMOUS
@iuuuuan
Copy link
Copy Markdown
Contributor Author

iuuuuan commented Apr 17, 2025

Added new commit - change value with sed for auth.anonymous.

@ondar
Copy link
Copy Markdown
Contributor

ondar commented Apr 17, 2025

Interesting regular. There is a space after enabled = true in the original file?

@iuuuuan
Copy link
Copy Markdown
Contributor Author

iuuuuan commented Apr 17, 2025

Interesting regular. There is a space after enabled = true in the original file?

You mean [[:space:]]* which matches zero or more whitespace characters ? This is just in case if original file line with starts or ends with whitespace character but in current case you are right, it is redundant.

@ondar
Copy link
Copy Markdown
Contributor

ondar commented Apr 17, 2025

Ah, true its * and not +, ok, thanks for clarification. Approving this PR.

@pashagolub pashagolub changed the title Update init_persistent_config.sh [-] fix anonymous Grafana access in Docker, fixes #724 Apr 17, 2025
@pashagolub pashagolub merged commit ab32e3c into cybertec-postgresql:master Apr 17, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working docker Docker related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants