From 2076056ebe3390561dc65d4237e991ff484ca266 Mon Sep 17 00:00:00 2001 From: Les Aker Date: Tue, 3 Dec 2024 22:06:27 -0500 Subject: [PATCH] update to ledgergraph --- README.md | 12 ++++----- manifests/init.pp | 41 +++++++++++-------------------- metadata.json | 10 ++++---- templates/config.yaml.erb | 6 ++--- templates/ledgerdb.service.erb | 11 --------- templates/ledgerdb.timer.erb | 9 ------- templates/ledgergraph.service.erb | 10 ++++++++ 7 files changed, 37 insertions(+), 62 deletions(-) delete mode 100644 templates/ledgerdb.service.erb delete mode 100644 templates/ledgerdb.timer.erb create mode 100644 templates/ledgergraph.service.erb diff --git a/README.md b/README.md index 3a5f0a8..74befcb 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -puppet-ledgerdb +puppet-ledgergraph =========== -[![Puppet Forge](https://img.shields.io/puppetforge/v/halyard/ledgerdb.svg)](https://forge.puppetlabs.com/halyard/ledgerdb) -[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/halyard/puppet-ledgerdb/build.yml?branch=main)](https://github.com/halyard/puppet-ledgerdb/actions) +[![Puppet Forge](https://img.shields.io/puppetforge/v/halyard/ledgergraph.svg)](https://forge.puppetlabs.com/halyard/ledgergraph) +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/halyard/puppet-ledgergraph/build.yml?branch=main)](https://github.com/halyard/puppet-ledgergraph/actions) [![MIT Licensed](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://tldrlegal.com/license/mit-license) -Module to configure ledgerdb +Module to configure ledgergraph ## Usage ```puppet -include ledgerdb +include ledgergraph ``` ## License -ledgerdb is released under the MIT License. See the bundled LICENSE file for details. +ledgergraph is released under the MIT License. See the bundled LICENSE file for details. diff --git a/manifests/init.pp b/manifests/init.pp index 4692198..b0242d2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,28 +1,20 @@ -# @summary Configure Ledger DB instance +# @summary Configure Ledgergraph instance # # @param datadir sets where the data is persisted -# @param influx_url sets the InfluxDB hostname -# @param influx_org sets the InfluxDB Organization -# @param influx_token sets the credential to use for metric submission -# @param influx_bucket sets the InfluxDB bucket # @param ledger_repo is the git repo for ledger data # @param ledger_ssh_key is the ssh key to use to update the repo # @param ledger_file is the main ledger file to load, relative to the repo root -# @param version sets the ledgerdb tag to use -# @param user sets the user to run ledgerdb as +# @param version sets the ledgergraph tag to use +# @param user sets the user to run ledgergraph as # @param bootdelay sets how long to wait before first run # @param frequency sets how often to run updates -class ledgerdb ( +class ledgergraph ( String $datadir, - String $influx_url, - String $influx_org, - String $influx_token, - String $influx_bucket, String $ledger_repo, String $ledger_ssh_key, String $ledger_file = 'core.ldg', - String $version = 'v0.0.13', - String $user = 'ledgerdb', + String $version = 'v0.1.0', + String $user = 'ledgergraph', String $bootdelay = '300', String $frequency = '300' ) { @@ -64,7 +56,7 @@ file { "${datadir}/config.yaml": ensure => file, - content => template('ledgerdb/config.yaml.erb'), + content => template('ledgergraph/config.yaml.erb'), group => $user, mode => '0640', } @@ -77,26 +69,21 @@ default => 'error', } - $binfile = '/usr/local/bin/ledgerdb' - $filename = "ledgerdb_${downcase($facts['kernel'])}_${arch}" - $url = "https://github.com/akerl/ledgerdb/releases/download/${version}/${filename}" + $binfile = '/usr/local/bin/ledgergraph' + $filename = "ledgergraph_${downcase($facts['kernel'])}_${arch}" + $url = "https://github.com/akerl/ledgergraph/releases/download/${version}/${filename}" - exec { 'download ledgerdb': + exec { 'download ledgergraph': command => "/usr/bin/curl -sLo '${binfile}' '${url}' && chmod a+x '${binfile}'", unless => "/usr/bin/test -f ${binfile} && ${binfile} version | grep '${version}'", } - file { '/etc/systemd/system/ledgerdb.service': + file { '/etc/systemd/system/ledgergraph.service': ensure => file, - content => template('ledgerdb/ledgerdb.service.erb'), + content => template('ledgergraph/ledgergraph.service.erb'), } - file { '/etc/systemd/system/ledgerdb.timer': - ensure => file, - content => template('ledgerdb/ledgerdb.timer.erb'), - } - - ~> service { 'ledgerdb.timer': + ~> service { 'ledgergraph': ensure => running, enable => true, } diff --git a/metadata.json b/metadata.json index bcd917b..2001012 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,12 @@ { - "name": "halyard-ledgerdb", + "name": "halyard-ledgergraph", "version": "0.0.28", "author": "Les Aker", "license": "MIT", - "summary": "Configure ledgerdb instance", - "source": "https://github.com/halyard/puppet-ledgerdb", - "project_page": "https://github.com/halyard/puppet-ledgerdb", - "issues_url": "https://github.com/halyard/puppet-ledgerdb/issues", + "summary": "Configure ledgergraph instance", + "source": "https://github.com/halyard/puppet-ledgergraph", + "project_page": "https://github.com/halyard/puppet-ledgergraph", + "issues_url": "https://github.com/halyard/puppet-ledgergraph/issues", "dependencies": [ ], diff --git a/templates/config.yaml.erb b/templates/config.yaml.erb index 0b56fc6..3118ad6 100644 --- a/templates/config.yaml.erb +++ b/templates/config.yaml.erb @@ -1,6 +1,4 @@ data_dir: <%= @datadir %>/data data_file: <%= @ledger_file %> -influx_url: <%= @influx_url %> -influx_org: <%= @influx_org %> -influx_token: <%= @influx_token %> -influx_bucket: <%= @influx_bucket %> +host: 127.0.0.1 +port: 8080 diff --git a/templates/ledgerdb.service.erb b/templates/ledgerdb.service.erb deleted file mode 100644 index 9bec3ac..0000000 --- a/templates/ledgerdb.service.erb +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Update ledger database export -StartLimitBurst=2 -StartLimitIntervalSec=271 - -[Service] -Type=simple -User=<%= @user %> -ExecStart=/usr/local/bin/ledgerdb sync <%= @datadir %>/config.yaml -Restart=on-failure -RestartSec=90 diff --git a/templates/ledgerdb.timer.erb b/templates/ledgerdb.timer.erb deleted file mode 100644 index 6398504..0000000 --- a/templates/ledgerdb.timer.erb +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Schedule ledger SQL sync - -[Timer] -OnBootSec=<%= @bootdelay %> -OnUnitActiveSec=<%= @frequency %> - -[Install] -WantedBy=multi-user.target diff --git a/templates/ledgergraph.service.erb b/templates/ledgergraph.service.erb new file mode 100644 index 0000000..e31d5a7 --- /dev/null +++ b/templates/ledgergraph.service.erb @@ -0,0 +1,10 @@ +[Unit] +Description=ledger web UI + +[Service] +User=<%= @user %> +ExecStart=/usr/local/bin/ledgergraph serve <%= @datadir %>/config.yaml +Restart=always + +[Install] +WantedBy=multi-user.target