Home

Awesome

spire

Pragmatic Provisioning Using Clojure

A Clojure domain specific language tailored to idempotently orchestrate machines in parallel over SSH.

CircleCI project chat

Official Website

Overview

This is a work in progress. Consider everything liable to change at any time.

Spire is a single executable binary you can use to provision and configure remote Unix systems. It runs a Clojure domain specific language that is:

Quickstart

$ curl -O https://raw.githubusercontent.com/epiccastle/spire/master/scripts/install
$ bash install
$ spire -e '(ssh "localhost" (get-fact))'

Installation

For Linux and MacOS:

$ curl -O https://raw.githubusercontent.com/epiccastle/spire/master/scripts/install
$ bash install

Usage

Run a spire script from a file:

$ spire FILE

Evaluate spire expression on the command line:

$ spire -e EXPRESSION

Start a spire nREPL:

$ spire --nrepl-server PORT

Tutorial

Build your own VPS based VPN proxy service with spire and wireguard.

How To

Find examples to solve common problems.

Module Reference

Built in modules.

Discussion

Higher level discussion of the use of spire

Babashka pod usage

Source Code

You can find the source code to Spire on github here.

Build

Install graalvm-ce-java11-20.1.0-dev in your home directory. Add the native image bundle to it. Then:

$ make clean all

Or specify a path to the graal directory to build with a different graal:

$ make clean all GRAALVM=/path/to/my/graal

After a long wait it should write a binary executable spire. Test it.

$ ./spire --help

Install it.

$ mv spire ~/bin/
$ spire --help

Note: graalvm-ce-java8-20.1.0-dev should also work. Earlier versions of graalvm, up to and including 20.0.0 do not work.

Running as a jar

$ make jar
$ java -jar spire-0.1.0-standalone.jar FILE

Running with lein

Use trampoline to run with leiningen so libspire.so can read the correct terminal settings:

$ lein trampoline run -- --help

Running tests

The test suite consists of some unit tests and some module tests that issue a full ssh connection to localhost. These tests will test both the ssh functionality and module functionality just on the running OS. By running this test suite on different architectures, compatability of the modules can be ascertained. The lack of external connections in the test makes setting up test environments easier.

$ lein test

Running as a babashka pod

Load the pod first. Then require the pod.epiccastle.spire namespaces.

(ns my-project.core
  (:require [babashka.pods :as pods]))

(pods/load-pod "spire" {:transport :socket})

(require '[pod.epiccastle.spire.transport :as transport]
         '[pod.epiccastle.spire.module.shell :as shell])

(transport/ssh "user@hostname"
    (prn (shell/shell {:cmd "hostname"})))

Platforms

Native Client

This is the binary spire program you run on your local machine.

Target Systems

This is the operating systems you will be provisioning, that the spire modules and operations will work against.

Bugs

There will be many bugs at this early stage. Especially on different target machines. Please open tickets for any issues you find.

Financial Contributors

Babashka Pod Support

The work to make spire available as a babashka pod was genorously funded by:

<a href="https://www.adgoji.com/"><img src="https://user-images.githubusercontent.com/265500/155489003-fa5d6a6e-1ec5-4c8e-b6b4-9efd81611b89.png"></a>

<a href="https://nextjournal.com/"><img src="https://user-images.githubusercontent.com/265500/155488646-aa40245e-6cd9-4f2d-bf32-478c3a2ccf68.png"></a>

OpenCollective

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

<a href="https://opencollective.com/spire"><img src="https://opencollective.com/spire/individuals.svg?width=890"></a>

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

<a href="https://opencollective.com/spire/organization/0/website"><img src="https://opencollective.com/spire/organization/0/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/1/website"><img src="https://opencollective.com/spire/organization/1/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/2/website"><img src="https://opencollective.com/spire/organization/2/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/3/website"><img src="https://opencollective.com/spire/organization/3/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/4/website"><img src="https://opencollective.com/spire/organization/4/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/5/website"><img src="https://opencollective.com/spire/organization/5/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/6/website"><img src="https://opencollective.com/spire/organization/6/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/7/website"><img src="https://opencollective.com/spire/organization/7/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/8/website"><img src="https://opencollective.com/spire/organization/8/avatar.svg"></a> <a href="https://opencollective.com/spire/organization/9/website"><img src="https://opencollective.com/spire/organization/9/avatar.svg"></a>

License

Copyright © 2019-2022 Crispin Wellington

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.