Skip to content

Commit

Permalink
update to ledgergraph
Browse files Browse the repository at this point in the history
  • Loading branch information
akerl committed Dec 4, 2024
1 parent 4308475 commit 2076056
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 62 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

41 changes: 14 additions & 27 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -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'
) {
Expand Down Expand Up @@ -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',
}
Expand All @@ -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,
}
Expand Down
10 changes: 5 additions & 5 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -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": [

],
Expand Down
6 changes: 2 additions & 4 deletions templates/config.yaml.erb
Original file line number Diff line number Diff line change
@@ -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
11 changes: 0 additions & 11 deletions templates/ledgerdb.service.erb

This file was deleted.

9 changes: 0 additions & 9 deletions templates/ledgerdb.timer.erb

This file was deleted.

10 changes: 10 additions & 0 deletions templates/ledgergraph.service.erb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2076056

Please sign in to comment.