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

feat: add stats page to vega_caddy_server role #9

Merged
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
2 changes: 2 additions & 0 deletions roles/vega_caddy_server/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ vega_caddy_server_with_data_node_api: false
vega_caddy_server_with_block_explorer_ui: false
vega_caddy_server_with_governance_ui: false
vega_caddy_server_with_trading_ui: false
vega_caddy_server_with_stats: false

vega_caddy_server_block_explorer_api_domains: []
vega_caddy_server_data_node_api_domains: []
vega_caddy_server_block_explorer_ui_domains: []
vega_caddy_server_governance_ui_domains: []
vega_caddy_server_trading_ui_domains: []
vega_caddy_server_stats_domains: []
10 changes: 10 additions & 0 deletions roles/vega_caddy_server/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@
mode: "0644"
when: vega_caddy_server_with_trading_ui and vega_caddy_server_trading_ui_domains | length > 0
notify: "Restart caddy"

- name: Enable stats config
ansible.builtin.template:
src: "etc/caddy/sites/stats.caddy.j2"
dest: "/etc/caddy/sites/stats.caddy"
owner: "caddy"
group: "caddy"
mode: "0644"
when: vega_caddy_server_with_stats and vega_caddy_server_stats_domains | length > 0
notify: "Restart caddy"
14 changes: 14 additions & 0 deletions roles/vega_caddy_server/templates/etc/caddy/sites/stats.caddy.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- vega_caddy_server_stats_domains | map('ansible.builtin.regex_replace', '$', ':443') | join(', ') }} {
root * /var/www/stats
encode gzip

file_server {
hide .git
index index.html
}

handle_errors {
rewrite * /index.html
file_server
}
}