• Stars
    star
    698
  • Rank 62,253 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿบ Deploy Databases and Services Easily for Development and Testing Pipelines.

Peanut

Deploy Databases and Services Easily for Development and Testing Pipelines.


Dashboard Screenshots

Peanut provides a REST API, Admin Dashboard and a command line tool to deploy and configure the commonly used services like databases, message brokers, graphing, tracing, caching tools ... etc. It perfectly suited for development, manual testing, automated testing pipelines where mocking is not possible and test drives.

Under the hood, it works with the containerization runtime like docker to deploy and configure the service. Destroy the service if it is a temporary one.

Technically you can achieve the same with a bunch of yaml files or using a configuration management tool or a package manager like helm but peanut is pretty small and fun to use & should speed up your workflow!

Supported Services:

  • MySQL.
  • MariaDB.
  • PostgreSQL.
  • Redis.
  • Etcd.
  • Grafana.
  • Elasticsearch.
  • MongoDB.
  • Graphite.
  • Prometheus.
  • Zipkin.
  • Memcached.
  • Mailhog.
  • Jaeger.
  • RabbitMQ.
  • Consul.
  • Vault.
  • Cassandra.
  • Minio.
  • Docker Registry.
  • Ghost.
  • Httpbin.
  • Nagios.
  • Etherpad.

Documentation

Run Peanut on Ubuntu

To run peanut on ubuntu, You can use the following bash script since it may take a while for a cold start. the script will install etcd, docker, docker-compose and peanut.

$ bash < <(curl -s https://raw.githubusercontent.com/Clivern/Peanut/main/deployment/linux/install.sh)

# Get The Public IP
$ curl https://ipinfo.io/ip
x.x.x.x

Peanut will be running on 80 port and UI on this URL http://x.x.x.x. Please open this file /etc/peanut/config.prod.yml and adjust the following line to be your Public IP or hostname

# App configs
app:
    ...
    # Hostname
    hostname: ${PEANUT_API_HOSTNAME:-127.0.0.1}

Then Restart Peanut

$ systemctl restart peanut

To make sure peanut is running, Run the following from your laptop to run some redis instances for 10 minutes.

# To provision redis services for 10 minutes
$ curl -X POST http://$PUBLIC_IP/api/v1/service -d '{"service":"redis","configs": {},"deleteAfter":"10min"}' -H 'x-api-key: ~api~key~here~'

{
  "createdAt": "2021-07-11T09:58:11.076Z",
  "id": "aadd5741-58c5-43c7-94fd-e6c0171fe8be",
  "service": "a8138f52-3ebb-4a34-b403-1be6ad481daf",
  "status": "PENDING",
  "type": "service.deploy"
}


# To list services including the host and port to use for connection
$ curl -X GET http://$PUBLIC_IP/api/v1/service  -H 'x-api-key: ~api~key~here~'

{
  "services": [
    {
      "id": "9d655cbe-caf1-4104-b8e4-b83fd569b509",
      "service": "redis",
      "configs": {
        "address": "127.0.0.1",
        "password": "",
        "port": "49156"
      },
      "deleteAfter": "10min",
      "createdAt": "2021-07-11T09:58:13Z",
      "updatedAt": "2021-07-11T09:58:13Z"
    },
    {
      "id": "a8138f52-3ebb-4a34-b403-1be6ad481daf",
      "service": "redis",
      "configs": {
        "address": "127.0.0.2",
        "password": "",
        "port": "49155"
      },
      "deleteAfter": "",
      "createdAt": "2021-07-11T09:58:12Z",
      "updatedAt": "2021-07-11T09:58:12Z"
    }
  ]
}

There is also a script to upgrade peanut.

$ bash < <(curl -s https://raw.githubusercontent.com/Clivern/Peanut/main/deployment/linux/upgrade.sh)

Linux Deployment Explained

Download the latest peanut binary. Make it executable from everywhere.

$ export PEANUT_LATEST_VERSION=$(curl --silent "https://api.github.com/repos/Clivern/Peanut/releases/latest" | jq '.tag_name' | sed -E 's/.*"([^"]+)".*/\1/' | tr -d v)

$ curl -sL https://github.com/Clivern/Peanut/releases/download/v{$PEANUT_LATEST_VERSION}/peanut_{$PEANUT_LATEST_VERSION}_Linux_x86_64.tar.gz | tar xz

Then install etcd cluster or a single node! please refer to etcd docs or bin directory inside this repository.

Install the virtualization runtime! By default peanut uses docker & docker-compose

$ apt-get update
$ apt-get install docker.io -y
$ systemctl enable docker

$ apt-get install docker-compose -y

Create the configs file config.yml from config.dist.yml. Something like the following:

# App configs
app:
    # Env mode (dev or prod)
    mode: ${PEANUT_APP_MODE:-dev}
    # HTTP port
    port: ${PEANUT_API_PORT:-8000}
    # Hostname
    hostname: ${PEANUT_API_HOSTNAME:-127.0.0.1}
    # TLS configs
    tls:
        status: ${PEANUT_API_TLS_STATUS:-off}
        pemPath: ${PEANUT_API_TLS_PEMPATH:-cert/server.pem}
        keyPath: ${PEANUT_API_TLS_KEYPATH:-cert/server.key}

    # Containerization runtime (supported docker)
    containerization:
        driver: ${PEANUT_CONTAINERIZATION_DRIVER:-docker}

        # Clean up stale images, volumes and networks
        autoClean: ${PEANUT_CONTAINERIZATION_AUTO_CLEAN:-true}

        # Time to cache docker images tags
        cacheTagsTimeInMinutes: ${PEANUT_CONTAINERIZATION_CACHE_TIME:-10080}

    # App Storage
    storage:
        # Type (only local supported)
        type: ${PEANUT_STORAGE_TYPE:-local}
        # Local Path
        path: ${PEANUT_STORAGE_PATH:-/tmp}

    # API Configs
    api:
        key: ${PEANUT_API_KEY:-6c68b836-6f8e-465e-b59f-89c1db53afca}

    # Async Workers
    workers:
        # Queue max capacity
        buffer: ${PEANUT_WORKERS_CHAN_CAPACITY:-5000}
        # Number of concurrent workers
        count: ${PEANUT_WORKERS_COUNT:-4}

    # Runtime, Requests/Response and Peanut Metrics
    metrics:
        prometheus:
            # Route for the metrics endpoint
            endpoint: ${PEANUT_METRICS_PROM_ENDPOINT:-/metrics}

    # Application Database
    database:
        # Database driver
        driver: ${PEANUT_DB_DRIVER:-etcd}

        # Etcd Configs
        etcd:
            # Etcd database name or prefix
            databaseName: ${PEANUT_DB_ETCD_DB:-peanut}
            # Etcd username
            username: ${PEANUT_DB_ETCD_USERNAME:- }
            # Etcd password
            password: ${PEANUT_DB_ETCD_PASSWORD:- }
            # Etcd endpoints
            endpoints: ${PEANUT_DB_ETCD_ENDPOINTS:-http://127.0.0.1:2379}
            # Timeout in seconds
            timeout: 30

    # Log configs
    log:
        # Log level, it can be debug, info, warn, error, panic, fatal
        level: ${PEANUT_LOG_LEVEL:-info}
        # Output can be stdout or abs path to log file /var/logs/peanut.log
        output: ${PEANUT_LOG_OUTPUT:-stdout}
        # Format can be json
        format: ${PEANUT_LOG_FORMAT:-json}

The run the peanut with systemd

$ peanut api -c /path/to/config.yml

Deploy your first redis server!

$ curl -X POST http://127.0.0.1:8000/api/v1/service -d '{"service":"redis"}' -H 'x-api-key: ~api~key~here~'

To run the Admin Dashboard (Development Only):

Clone the project or your own fork:

$ git clone https://github.com/Clivern/Peanut.git

Create the dashboard config file web/.env from web/.env.dist. Something like the following:

VUE_APP_API_URL=http://localhost:8080

Then you can either build or run the dashboard

# Install npm packages
$ cd web
$ npm install
$ npm install -g npx

# Add api server url to frontend
$ echo "VUE_APP_API_URL=http://127.0.0.1:8000" > .env

$ cd ..

# Validate js code format
$ make check_ui_format

# Format UI
$ make format_ui

# Run Vuejs app
$ make serve_ui

# Build Vuejs app
$ make build_ui

# Build the Vuejs app
$ make package

The command line tool

In order to interact with peanut API server, you can either do basic API calls or use the provided command line tool. It is still not finished yet but it will be ready soon.

Supported Services

Here is a list of all supported services so far and the API call to deploy them.

  • MySQL.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"mysql","configs": {"rootPassword": "root", "database": "peanut", "username": "peanut", "password": "secret"}}' \
    -H 'x-api-key: ~api~key~here~'
  • MariaDB.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"mariadb","configs": {"rootPassword": "root", "database": "peanut", "username": "peanut", "password": "secret"}}' \
    -H 'x-api-key: ~api~key~here~'
  • PostgreSQL.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"postgresql","configs": {"database": "peanut", "username": "peanut", "password": "secret"}}' \
    -H 'x-api-key: ~api~key~here~'
  • Redis.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"redis","configs": {"password": "secret"}}' \
    -H 'x-api-key: ~api~key~here~'
  • Etcd.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"etcd"}' \
    -H 'x-api-key: ~api~key~here~'
  • Grafana.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"grafana","configs": {"username": "admin", "password": "admin", "allowSignup": "false", "anonymousAccess": "true"}}' \
    -H 'x-api-key: ~api~key~here~'
  • Elasticsearch.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"elasticsearch"}' \
    -H 'x-api-key: ~api~key~here~'
  • MongoDB.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"mongodb","configs": {"database": "peanut", "username": "peanut", "password": "secret"}}' \
    -H 'x-api-key: ~api~key~here~'
  • Graphite.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"graphite"}' \
    -H 'x-api-key: ~api~key~here~'
  • Prometheus.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"prometheus"}' \
    -H 'x-api-key: ~api~key~here~'

# Configs can be provided as base64 encoded string (use https://www.base64encode.org/)
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"prometheus", "configs": {"configsBase64Encoded": "Z2xvYmFsOgogIGV2YWx1YXRpb25faW50ZXJ2YWw6IDE1cwogIHNjcmFwZV9pbnRlcnZhbDogMTVzCnJ1bGVfZmlsZXM6IH4Kc2NyYXBlX2NvbmZpZ3M6CiAgLQogICAgam9iX25hbWU6IHByb21ldGhlCiAgICBzY3JhcGVfaW50ZXJ2YWw6IDVzCiAgICBzdGF0aWNfY29uZmlnczoKICAgICAgLQogICAgICAgIHRhcmdldHM6CiAgICAgICAgICAtICJsb2NhbGhvc3Q6OTA5MCI="}}' \
    -H 'x-api-key: ~api~key~here~'
  • Zipkin.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"zipkin"}' \
    -H 'x-api-key: ~api~key~here~'
  • Memcached.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"memcached"}' \
    -H 'x-api-key: ~api~key~here~'
  • Mailhog.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"mailhog"}' \
    -H 'x-api-key: ~api~key~here~'
  • Jaeger.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"jaeger"}' \
    -H 'x-api-key: ~api~key~here~'
  • RabbitMQ.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"rabbitmq"}' \
    -H 'x-api-key: ~api~key~here~'
  • Consul.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"consul"}' \
    -H 'x-api-key: ~api~key~here~'
  • Vault.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"vault","configs": {"token": "peanut"}}' \
    -H 'x-api-key: ~api~key~here~'
  • Cassandra.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"cassandra"}' \
    -H 'x-api-key: ~api~key~here~'
  • Minio.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"minio","configs": {"username": "admin12345678", "password": "admin12345678"}}' \
    -H 'x-api-key: ~api~key~here~'
  • Docker Registry.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"registry"}' \
    -H 'x-api-key: ~api~key~here~'
  • Ghost.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"ghost"}' \
    -H 'x-api-key: ~api~key~here~'
  • Httpbin.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"httpbin"}' \
    -H 'x-api-key: ~api~key~here~'
  • Nagios.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"nagios"}' \
    -H 'x-api-key: ~api~key~here~'
  • Etherpad.
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"etherpad"}' \
    -H 'x-api-key: ~api~key~here~'

To create a temporary service, you will need to add extra parameter while creating it.

# It will be deleted after 30 seconds
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"etcd", "deleteAfter": "30sec"}' \
    -H 'x-api-key: ~api~key~here~'

# It will be deleted after 20 minutes
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"etcd", "deleteAfter": "20min"}' \
    -H 'x-api-key: ~api~key~here~'

# It will be deleted after 1 hour
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"etcd", "deleteAfter": "1hours"}' \
    -H 'x-api-key: ~api~key~here~'

# It will be deleted after 3 days
$ curl -X POST http://127.0.0.1:8000/api/v1/service \
    -d '{"service":"etcd", "deleteAfter": "3days"}' \
    -H 'x-api-key: ~api~key~here~'

To list all services running on a single or multi nodes.

$ curl -X GET http://127.0.0.1:8000/api/v1/service \
    -H 'x-api-key: ~api~key~here~'

To delete a service.

$ curl -X DELETE http://127.0.0.1:8000/api/v1/service/:serviceId \
    -H 'x-api-key: ~api~key~here~'

To get async job status like a deployment status.

$ curl -X DELETE http://127.0.0.1:8000/api/v1/job/:serviceId/:jobId \
    -H 'x-api-key: ~api~key~here~'

To get service versions.

$ curl -X GET http://127.0.0.1:8000/api/v1/tag/$serviceType/$fromCacheStatus \
    -H 'x-api-key: ~api~key~here~'

$ curl -X GET http://127.0.0.1:8000/api/v1/tag/mysql/true \
    -H 'x-api-key: ~api~key~here~'

Versioning

For transparency into our release cycle and in striving to maintain backward compatibility, Peanut is maintained under the Semantic Versioning guidelines and release process is predictable and business-friendly.

See the Releases section of our GitHub project for changelogs for each release version of Peanut. It contains summaries of the most noteworthy changes made in each release.

Bug tracker

If you have any suggestions, bug reports, or annoyances please report them to our issue tracker at https://github.com/clivern/peanut/issues

Security Issues

If you discover a security vulnerability within Peanut, please send an email to [email protected]

Contributing

We are an open source, community-driven project so please feel free to join us. see the contributing guidelines for more details.

License

ยฉ 2021, Clivern. Released under MIT License.

Peanut is authored and maintained by @clivern.

More Repositories

1

Beaver

๐Ÿ’จ A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps.
Go
1,439
star
2

Walrus

๐Ÿ”ฅ Fast, Secure and Reliable System Backup, Set up in Minutes.
Go
458
star
3

Gauntlet

๐Ÿ”– Guides, Articles, Podcasts, Videos and Notes to Build Reliable Large-Scale Distributed Systems.
430
star
4

Rabbit

โšก๏ธ A lightweight service that will build and store your go projects binaries, Integrated with Github, Gitlab, Bitbucket and Bitbucket Server.
Go
197
star
5

Beetle

๐Ÿ”ฅ Kubernetes multi-cluster deployment automation service.
Go
163
star
6

Hippo

๐Ÿ’จA well crafted go packages that help you build robust, reliable, maintainable microservices.
Go
143
star
7

Poodle

๐Ÿ”ฅ A fast and beautiful command line tool to build API requests.
Go
135
star
8

Cattle

๐Ÿบ Platform to Run and Share Code. It Supports PHP, Python, Ruby, Elixir, Java, Go, Rust, C and C++.
Python
60
star
9

Buzzard

๐Ÿฆ€ Learning Rust by Examples.
Rust
57
star
10

Hamster

๐Ÿ€ A Bot toolkit for github that supports OAuth, Events, API, Custom Commands and Check Runs.
Go
41
star
11

Chunk

๐Ÿบ Asynchronous Task Queue Based on Distributed Message Passing for PHP.
PHP
36
star
12

Rhino

โ„๏ธ HTTP Mocking & Debugging Service.
Go
31
star
13

Imap

๐Ÿ“ฌ Access Mailbox Using PHP IMAP.
PHP
29
star
14

Racter

๐ŸŠ A Java Framework for Building Bots on Facebook's Messenger Platform.
Java
18
star
15

terraform-provider-boilerplate

๐Ÿ„Terraform Provider Boilerplate.
Go
17
star
16

Cluster

Golang Package for System Clustering.
Go
15
star
17

Laravel-CSV-Export

๐Ÿ”Ž Export a Large Dataset in CSV Format.
PHP
13
star
18

PyLogging

๐Ÿ‰ Python Logging Library
Python
12
star
19

file_uploader

๐Ÿ—ฟ PHP File Uploader Package
PHP
12
star
20

Chaos

๐Ÿบ A Server Chaos Maker, Set up in Minutes.
Go
11
star
21

wit-java

๐Ÿ—ฟJava Library For Wit.ai
Java
11
star
22

generator-goapi

๐Ÿ™ Yeoman Generator for Golang Microservices.
Go
6
star
23

Observability-php-sdk

๐Ÿบ Observability SDK for PHP Applications.
PHP
6
star
24

Bull

๐Ÿ“ฆMicroservices Playground with Symfony 4.
PHP
5
star
25

Apes

๐Ÿ’จChaos and Resiliency Testing Service.
Go
5
star
26

ghbot

๐Ÿค– Github Follow Bot in Python.
Python
5
star
27

Kraven

๐Ÿ’ฎ A SaaS docker management dashboard to manage your docker containers, images, volumes, networks and much more!
Python
5
star
28

Pindo

๐Ÿบ Securely Build and Run Code in Docker.
Python
5
star
29

arduino_exporter

๐Ÿบ Arduino Prometheus Exporter.
Python
4
star
30

Mammal

๐Ÿบ A Sample Microservice.
Go
3
star
31

PyArchiver

Python Compression and Archiving Library
Python
3
star
32

Glove

๐Ÿบ Prometheus Exporter Boilerplate.
Go
3
star
33

Kevin

๐Ÿบ Web Application to Inspect HTTP Requests & Build Custom Endpoints.
Python
3
star
34

Bucket

Consistent Hashing Algorithm Package for Scalable Data Distribution
Java
3
star
35

pushover-actions

๐Ÿงฌ Push notifications for github repository changes through pushover.
Go
3
star
36

Jarvis

๐Ÿ‘ปThe Hitchhiker's Guide To Go Language
Go
3
star
37

Redis-PubSub

Build Realtime Apps With Redis PubSub
HTML
2
star
38

Koala

๐Ÿงฌ Kubernetes Playground for Testing Purposes.
Go
2
star
39

Snippets

๐Ÿซ Sublime Text Snippets.
Shell
2
star
40

Toad

โ„๏ธ Containerized Application for Testing Purposes.
Go
2
star
41

MongoPlaybook

๐Ÿ“š It's worth to give it a try
2
star
42

Memcached

Memcached Client for PHP.
PHP
2
star
43

Monkey

๐Ÿต Apache CloudStack SDK in PHP that supports sync calls, async calls and multiple dependent calls.
PHP
2
star
44

fast-yt-videos

A WordPress Plugin That Increase Youtube Videos Loading Time
PHP
2
star
45

generator-gopkg

๐Ÿ™ Yeoman Generator for Golang Packages.
JavaScript
2
star
46

Walnut

๐Ÿ“ง Async Transactional Email Service.
PHP
1
star
47

Dunk

How to Create a Facebook Messenger Bot With Java
Java
1
star
48

Mantis

A Minimalist ORM for Python
Python
1
star
49

Beagle

Symfony Applications Boilerplate.
PHP
1
star
50

modern-js-cheatsheet

Cheatsheet for the JavaScript knowledge you will frequently encounter in modern projects.
1
star
51

Thanos

๐Ÿ”ฅ53 77 69 73 73 20 4b 6e 69 66 65 21
Python
1
star
52

Events

ES tryout with Symfony 5
PHP
1
star
53

Kemet

My dotfiles.
Shell
1
star
54

PyHusky

๐Ÿบ Python Role Based Permissions Library.
Python
1
star
55

Weasel

๐Ÿบ Modern Command Line Tool for Apache Kafka.
Go
1
star
56

Oxygen

๐Ÿบ Ansible Collection to Deploy A Reliable PHP Services.
Jinja
1
star
57

Polars

A Ruby SDK for Different Linux Operating System Distributions.
Ruby
1
star
58

Fred

๐Ÿ‰ A Java Framework for Building Slack Bots.
Java
1
star
59

Trent

Experimental Chatbots With Java & Play Framework
Java
1
star
60

beaver.js

A JavaScript client for beaver, the real time messaging system.
TypeScript
1
star
61

LWT

๐Ÿบ Simple ERP Application Skeleton In Symfony 3.3.9.
PHP
1
star
62

Bear

A WordPress Themes Boilerplate.
PHP
1
star
63

Minion

Single Page Application Boilerplate.
TypeScript
1
star
64

Kevin-Cookbook

๐Ÿ™A Chef Cookbook To Deploy Kevin on Linux Servers.
Ruby
1
star
65

Frog

๐Ÿธ A Java Framework for Social Sign In.
Java
1
star
66

terraform-provider-beetle

๐Ÿ”ฅ Beetle Terraform Provider.
Go
1
star
67

Alligator

๐ŸŠ Golang Package Boilerplate.
Makefile
1
star