Skip to content
A Consul + Vault F# library – service discovery and secret management for your F# apps and services.
F# Ruby Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.paket
src
tools
.editorconfig
.gitignore
.semver
Gemfile
Gemfile.lock
Procfile
README.md
Rakefile
appveyor.yml
build.cmd
paket.dependencies
paket.lock

README.md

Fakta

A Consul and Vault F# API.

The aim is to support both Consul and Vault from the same library, because it's a common deployment scenario. You should be able to use the Consul bits without using the Vault bits.

Fakta is Swedish for 'facts', a fitting name for a library interacting with a CP-oriented fact store.

Sponsored by qvitoo – A.I. bookkeeping.

API

How much has been implemented? This API surface is the same as that of the official Go client.

Those not implemented will throw a correspond TBD-exception.

Justification

The current implementation's use-case (for me) is leader-election and semi- to long-term storage of access keys that need be requested exactly-once or they get invalidated.

Together with Registrator and this library, F# code can participate in micro- service architectures easily.

Compiling and running initial tests

First, run:

./tools/consul.sh agent -dev -bind 127.0.0.1 -config-file=tools/server.json

In another terminal:

./tools/vault.sh server -dev

Finally:

bundle exec rake

Which will call xbuild/msbuild and compile the project, run unit tests and then finally run the integration tests.

References

Consul

Vault

ACL

  • clone
  • create
  • destroy
  • info
  • list
  • update

Agent

  • checkRegister
  • checkDeregister
  • checks
  • enableNodeMaintenance
  • disableNodeMaintenance
  • enableServiceMaintenance
  • disableServiceMaintenance
  • join
  • members
  • self
  • serviceRegister
  • serviceDeregister
  • nodeName
  • services
  • passTTL
  • warnTTL
  • failTTL
  • forceLeave

Catalog

  • datacenters
  • node
  • nodes
  • deregister
  • register
  • service
  • services

Event

  • fire
  • list
  • idToIndex

Health

  • checks
  • node
  • state
  • service

KV

  • acquire
  • CAS
  • delete
  • deleteCAS
  • deleteTree
  • getRaw
  • get
  • keys
  • list
  • put
  • release

Session

  • create
  • createNoChecks
  • destroy
  • info
  • list
  • node
  • renew
  • renewPeriodic

Status

  • leader
  • peers

Service

Helping Out

All development is done on master branch which should always be release-able; write unit tests for your changes and it shall be fine.

Running local instance of Consul

  1. enable ACL support by creating json config file "server.json" looking like this:
{
 "bootstrap": false,
 "server": true,
 "datacenter": "ams1",
 "encrypt": "yJqVBxe12ZfE3z+4QSk8qA==",
 "log_level": "INFO",
 "acl_datacenter": "ams1",
 "acl_default_policy": "allow",
 "acl_master_token": "secret",
 "acl_token": "secret"
}
  1. run consul agent with:
consul agent -dev -bind 127.0.0.1 -config-file=tools/server.json
  1. Open http://localhost:consul_port/ui/#/ams1/acls (typically http://127.0.0.1:8500/ui/#/ams1/acls ) and create token called the same like the master token in config file

Running local instance of Consul

  1. create config file (do not use this in production)
backend "file" {
  path = "vault"
}

listener "tcp" {
  tls_disable = 1
}

disable_cache = true
disable_mlock = true
  1. run vault server with vault server -config=tools/vault.conf
  2. you have to restart your local vault server and delete vault directory contents everytime you want to re-run tests.

Compiling

You compile with Rake/albacore, the best build system for .Net/mono:

bundle
bundle exec rake

Running Tests

The unit tests are run by just running the Tests-executable, or by using rake:

bundle exec rake tests:unit

Running Integration Tests

You'll need to start consul first; in one console:

bundle exec foreman start

...and then running the tests:

bundle exec rake tests:integration

Between vault tests, you have to remove ./vaultData, or you'll get failing tests. This is due to the nature of some Vault operations not being re-doable.

You can’t perform that action at this time.