diff --git a/data/deployments/admin/common.yaml b/data/deployments/admin/common.yaml --- a/data/deployments/admin/common.yaml +++ b/data/deployments/admin/common.yaml @@ -2,17 +2,22 @@ swh::deploy::reverse_proxy::services: - hedgedoc + - grafana swh::postgresql::shared_buffers: 4GB swh::deploy::hedgedoc::reverse_proxy::backend_http_host: bardo.internal.admin.swh.network swh::deploy::hedgedoc::reverse_proxy::backend_http_port: "3000" swh::deploy::hedgedoc::reverse_proxy::websocket_support: true - swh::deploy::hedgedoc::base_url: hedgedoc.softwareheritage.org swh::deploy::hedgedoc::vhost::letsencrypt_cert: hedgedoc +swh::deploy::grafana::vhost::letsencrypt_cert: "%{lookup('grafana::vhost::name')}" +swh::deploy::grafana::reverse_proxy::backend_http_host: grafana0.internal.admin.swh.network +swh::deploy::grafana::reverse_proxy::backend_http_port: "3000" +swh::deploy::grafana::reverse_proxy::websocket_support: true +swh::deploy::grafana::base_url: "%{lookup('grafana::vhost::name')}" + hitch::frontend: "[*]:443" hitch::proxy_support: true varnish::http_port: 80 - diff --git a/data/hostname/grafana0.internal.admin.swh.network.yaml b/data/hostname/grafana0.internal.admin.swh.network.yaml new file mode 100644 --- /dev/null +++ b/data/hostname/grafana0.internal.admin.swh.network.yaml @@ -0,0 +1,22 @@ + +swh::postgresql::version: '13' + +swh::postgresql::port: 5432 +swh::postgresql::cluster_name: "%{lookup('swh::postgresql::version')}/main" +swh::postgresql::datadir_base: "/var/lib/postgres" +swh::postgresql::datadir: "%{lookup('swh::postgresql::datadir_base')}/%{lookup('swh::postgresql::cluster_name')}" +swh::postgresql::listen_addresses: + - 127.0.01 +# swh::postgresql::network_accesses: +# - 192.168.100.0/24 # Monitoring +# - 192.168.130.0/24 # Staging services + +swh::dbs: + storage: + name: "%{lookup('grafana::db::database')}" + user: "%{lookup('grafana::db::username')}" + +swh::deploy::storage::db::password: "%{lookup('grafana::db::password')}" + +prometheus::sql::config_snippets: + - grafana diff --git a/data/subnets/vagrant.yaml b/data/subnets/vagrant.yaml --- a/data/subnets/vagrant.yaml +++ b/data/subnets/vagrant.yaml @@ -81,6 +81,8 @@ host: rp1.internal.admin.swh.network aliases: - hedgedoc.softwareheritage.org + 10.168.50.30: + host: grafana0.internal.admin.swh.network 10.168.100.18: host: banco.internal.softwareheritage.org aliases: diff --git a/manifests/site.pp b/manifests/site.pp --- a/manifests/site.pp +++ b/manifests/site.pp @@ -12,6 +12,10 @@ include role::swh_sysadmin } +node 'grafana0.internal.admin.swh.network' { + include role::swh_grafana +} + node 'tate.softwareheritage.org' { include role::swh_forge } diff --git a/site-modules/profile/manifests/grafana/backend.pp b/site-modules/profile/manifests/grafana/backend.pp new file mode 100644 --- /dev/null +++ b/site-modules/profile/manifests/grafana/backend.pp @@ -0,0 +1,24 @@ +# install the grafana stack +class profile::grafana::backend { + $db = lookup('grafana::db::database') + $db_username = lookup('grafana::db::username') + $db_password = lookup('grafana::db::password') + + $config = lookup('grafana::config') + + include profile::postgresql + include profile::postgresql::server + + class {'::grafana': + install_method => 'repo', + cfg => $config + { + database => { + type => 'postgres', + host => '127.0.0.1:5432', + name => $db, + user => $db_username, + password => $db_password + } + } + } +} diff --git a/site-modules/role/manifests/swh_grafana.pp b/site-modules/role/manifests/swh_grafana.pp new file mode 100644 --- /dev/null +++ b/site-modules/role/manifests/swh_grafana.pp @@ -0,0 +1,3 @@ +class role::swh_grafana inherits role::swh_server { + include profile::grafana::backend +}