Git Product home page Git Product logo

bbssh's Introduction

bbssh

Babashka pod for SSH support.

CircleCI Babashka docs

Installing

The pod should automatically install on first use.

Using

Here is a simple script that connects over ssh, the runs a command and disconnects, returning the standard output:

(ns test-simple.core
  (:require [babashka.pods :as pods]))

(pods/load-pod 'epiccastle/bbssh "0.1.0")

(require '[pod.epiccastle.bbssh.core :as bbssh])

(-> (bbssh/ssh "remotehost" {:username "remote-user"})
    (bbssh/exec "echo 'I am running remotely'" {:out :string})
    deref
    :out)

API documentation

The full documentation can be found here.

Building

The bbssh pod is distributed as a static binary. Build it with:

$ make

This will generate the file bbssh.

Running

In clojure

$ make run
clj -J-Djava.library.path=resources -m bbssh.core
...

As native image

$ ./bbssh -v

System wide installation

If you would like to install a copy manually, use:

$ curl -O https://raw.githubusercontent.com/epiccastle/bbssh/main/scripts/install
$ bash install

And then refer to the pod:

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

Namespace layout

There are conventions with the namespace layout you should know if you plan to extend this pod.

  • bbssh.impl.*

    These namespaces are internal functions related to implementing the pod itself

  • bbssh.*

    The basic programme mainline (used to setup and run the pod)

  • pod.epiccastle.bbssh.pod.*

    All public functions in these namespaces are exposed in the pod interface and will be called via pod invoke. These all run inside the pod native image. They have full access to the bbssh jvm heap.

  • pod.epiccastle.bbssh.*

    All code in these namespaces is injected into the babashka instance apon pod describe. These namespaces comprise the API you call when using bbssh from babashka.

Running tests

You will need docker installed to run tests.

By default, the tests run against a JVM version of the pod. This is to avoid having to build the native image during the normal dev cycle.

$ make test

In order to test against the native-image compiled version of the pod, use:

$ make test BBSSH_TEST_TARGET=native-image

Copyright

Copyright (c) Crispin Wellington. All rights reserved.

The use and distribution terms for this software are covered by the Eclipse Public License 2.0 which can be found in LICENSE.

bbssh's People

Contributors

retrogradeorbit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.