• This repository has been archived on 19/Jan/2018
  • Stars
    star
    601
  • Rank 73,997 (Top 2 %)
  • Language
    Ruby
  • License
    GNU General Publi...
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

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

Repository Details

Docker and Ruby based PaaS

Build Status Code Climate Peas

PaaS for the People

Peas is a Heroku-style Platform as a Service written in Ruby using Docker. It is heavily inspired by Deis and Dokku.

Peas' philosophy is to be an accessible and easily hackable PaaS. It doesn't aim to be a complete enterprise solution. Instead it aims to be a relatively unopinionated, but solid starting place using all the goodness of Ruby; Rspec, Bundler, Guard, Rack, Mongoid, Docker-api, Puma, Grape, GLI, Celluloid, and more.

Peas is still beta software. Expect breaking changes.

#Quickstart for live installation on remote server

# Remote VPS commands
ssh root@some_vanilla_server.com
curl -sSL https://raw.githubusercontent.com/tombh/peas/master/contrib/bootstrap.sh | sh
#=> (lots of logs about Peas downloading and booting up)

# Local commands
gem install peas-cli
cd /my/cool/app/folder
peas admin settings peas.domain some_vanilla_server.com
peas create
git push peas master
#=>
# -----> Installing dependencies
# -----> ... lots more lines like this
# -----> Discovering process types
# -----> Scaling process 'web:1'
#        Deployed to http://mycoolapp.some_vanilla_server.com"

#General Installation Instructions There is a universal installation script at contrib/bootstrap.sh, it can be run directly on most vanilla *nix systems with root access;

curl -sSL https://raw.githubusercontent.com/tombh/peas/master/contrib/bootstrap.sh | sh

It works on recent versions of Ubuntu, Debian (>=8), Fedora, Centos and Redhat. It uses pacapt to install the OS's native Docker package (ensuring Docker is managed by an init system). It then runs contrib/peas-dind/run.sh to install the Peas image itself, with a restart policy of 'always', ensuring that Peas starts at boot.

Local development environment
To run on Windows and OSX, please follow the 'vagrant' instructions below.

This is the preferred method for local development, but note that local development is also possible with the Docker installation method. All you will need is; Ruby(>=2.1), Docker(>=1.1) and Mongo DB(>=2.6). All of these are generally installable via your system's package manager, no compiling should be necessary.

docker pull progrium/buildstep # This runs Heroku buildpacks against repos to create deployable app images
git clone https://github.com/tombh/peas.git
bundle install
bundle exec guard

The Peas API will be available at vcap.me:4443.

Docker
This installation method will work anywhere that Docker can be installed, so both locally and on remote servers like AWS and Digital Ocean.

To install and boot just use ./contrib/peas-dind/run.sh (ie. you will need to have cloned the repo first). For a detailed explanation read contrib/peas-dind/README.md.

The Peas API will be available at vcap.me:4443.

Vagrant
Most likely useful to you if you are on Windows. There is a Vagrantfile in the root of the project. All it does is boot a recent VM of Ubuntu and then installs Peas using the Docker method above.

The Peas API will be available at peas.local:4443.

CLI client
To interact with the Peas API you will need to install the command line client: gem install peas-cli

During development you will find it useful to use the peas-dev command. It uses the live code in your local repo as the CLI client. You can put it in your $PATH with something like; sudo ln -s $(pwd)/peas-dev /usr/local/bin/peas-dev

#Usage

Setup
Peas aims to follow the conventions and philosophies of Heroku as closely as possible. So it is worth bearing in mind that a lot of the Heroku documentation is relevant to Peas.

First thing is to set the domain that points to your Peas installation. If you're developing locally you can actually just rely on the default vcap.me which has wildcard DNS records to point all subdomains to 127.0.0.1.

To use a different domain: peas admin settings peas.domain customdomain.com

Users
Peas is currently authenticated by an API key on a per user basis. The first user is automatically created when you first interact with the CLI. It uses your default SSH key and username, so there is no need to register.

At the moment you will need to use the controller's console to add more users:

  1. peas admin run rake console
  2. User.create name: 'newusername', public_key: 'public key string'

Deploying
Next thing is to get into the directory of the git repo for the app you want to deploy.

Then:

peas create
git push peas master

The last line of the deployment output should contain the URL for your deployed app.

You can then scale processes using: peas scale web=3 worker=2

Services
If a service URI is provided to Peas' admin settings then all subsequently created apps will be given an instance of that service. Therefore, by issuing something like;
peas admin settings mongodb.uri mongodb://root:[email protected]
all new apps will get created with a config variable of something like; MONGDB_URI=mongodb://appname:[email protected]/appname

New services can be added by creating a new class in lib/services. You can use any of the existing service classes as a template.

Debugging
You can get a shell to the controller with peas admin run bash. There is no root access at the moment, but you can view logs, run rake console and restart services.

All current CLI commands

admin      - Admin commands:
  run      - Run commands on the Peas Controller
  settings - Set Peas global system settings
apps       - List all apps
config     - Add, remove and list config for an app
create     - Create an app
destroy    - Destroy an app
help       - Shows a list of commands or help for one command
logs       - Show logs for an app
run        - Run one-off commands
scale      - Scale an app

#Roadmap

  • Adding extra users with varying permissions.
  • Auto Pod scaling across servers.

##Video Presentation Given at London Ruby User Group on November 10th 2014 (0h31m) Peas presentation

More Repositories

1

novim-mode

Plugin to make Vim behave more like a 'normal' editor
Vim Script
139
star
2

dharma-api

☸ Crawling the web to provide a canonical source of dharma talks
HTML
30
star
3

total-viewsheds

🏔 Calculating total viewsheds for geographic terrain using an efficient GPU algorithm
C++
19
star
4

jekbox

Automatically deploy Jekyll sites by creating a site folder in your Dropbox
Ruby
16
star
5

human-computer

A computer that uses nothing but human resources
Ruby
16
star
6

mc-turtles

Turtles in Minecraft to help you learn programming
Python
12
star
7

dotfiles

The config I use on my computer
Lua
11
star
8

docker-peerflix-vpn

Run Peerflix (split torrent streaming) in a docker container with its own VPN connection
Shell
10
star
9

bash-args-parser

A quick and convenient way to support arguments in BASH. There are already some other projects that do this, but of course they weren't quite _exactly_ how I want it.
Shell
9
star
10

wrach

GPU-based fluid simulation in pure Rust. With intent to make a game engine inspired by Noita
Rust
9
star
11

super-glass-lsp

Generic Language Server to parse the output of CLI tools, linters, formatters, etc. Also aims to be a reasonable Pygls starting template
Python
8
star
12

arch-in-docker-for-daily-use

For when you want to use Arch Linux in Docker as an end user, for daily tasks such as using the internet, writing code etc
Shell
5
star
13

tweetdeck_image_previews

Better support for image previews, like Instagram, in the Tweetdeck web app
JavaScript
4
star
14

testing-intro-workshop

Resources for Bristol CodeHub Workshop July 2014
JavaScript
3
star
15

openpractice

The actual code used for the #openpractice website
PHP
3
star
16

instaardman

Archiving Instagram photos of Aardman sculptures.
Ruby
3
star
17

streaming

Bits and pieces for my live streams. Docs, bots, notes, etc
2
star
18

roundtable

A node.js socket server to coordinate timing (and perhaps automation) of /r/thebutton pushes
JavaScript
2
star
19

boids

Boids example ported from wgpu to rust-gpu
Rust
2
star
20

Reddit-Drill

Website to visualise reddit comment threads
JavaScript
2
star
21

tweetFactory

Helps you archive and manage large Twitter search queries
PHP
2
star
22

tombh.github.io

This is my website and blog
HTML
1
star
23

deis-cookbook

Chef cookbook for Deis.
Ruby
1
star
24

Pixies

Particle simulator based on the Lennard Jones potential
C
1
star
25

www.beingordinary.org

The website for www.beingordinary.org - podcasting about meditation and non-duality
HTML
1
star
26

Topotatolog

Ultra simple Django-based blog (uses django-nonrel for Google App Engine)
Python
1
star
27

nvim-plugin-installer

Search and install neovim plugins from inside your editor
Python
1
star
28

gcloud_pipe_logger

Log to Google Cloud's Stackdriver logger simply by piping to a single static binary
Go
1
star