Skip to content

Commit

Permalink
Initial checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
joostfaassen committed Dec 17, 2017
0 parents commit 8afc72e
Show file tree
Hide file tree
Showing 19 changed files with 1,125 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.php]
indent_size = 4
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
.DS_Store
vendor/
.env
autotune.json
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 LinkORB B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

41 changes: 41 additions & 0 deletions README.md
@@ -0,0 +1,41 @@
Shift: Framework for Reusable Stateless Functions
=================================================

Inspired by the trends in Serverless / FaaS / Cloud Functions.

## Features:

* Provides a framework to build reusable stateless functions.
* A language agnostic (json) format to define `inputs`, `outputs` and `configs` that your functions need.
* A service.json format to list the Shift functions you'd like to expose.
* Uses JSON Schema to validate all input, output and configs.
* Invokers for your Shift functions, so you can easily call/host them locally or remotely.
* Supports functions implemented in PHP or any other language, including executing external commands.
* An HTTP end-point server to serve your functions.
* A Console tool to help build, test and debug your Shift functions.

## Examples:

The `example/` directory contains an example service with 2 functions, one implemented in PHP, and one generically executing an external CLI tool.

To test it out:

cd example/
../bin/shift invoke:local hello-php -i greeting=Howdy -c color=silver -u joe

This will call the `hello-php` function, passing one input (greeting), a config (color) and a context username.

## Status

Shift is currently in an experimental phase, and some of the features are under construction.

## License

MIT. Please refer to the [license file](LICENSE) for details.

## Brought to you by the LinkORB Engineering team

<img src="http://www.linkorb.com/d/meta/tier1/images/linkorbengineering-logo.png" width="200px" /><br />
Check out our other projects at [linkorb.com/engineering](http://www.linkorb.com/engineering).

Btw, we're hiring!
26 changes: 26 additions & 0 deletions bin/shift
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php

use Symfony\Component\Console\Application;

$loader = __DIR__ . '/../vendor/autoload.php';

if (!file_exists($loader)) {
$loader = __DIR__ . '/../../../autoload.php';
}

if (!file_exists($loader)) {
die(
'You must set up the project dependencies, run the following commands:' . PHP_EOL .
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
'php composer.phar install' . PHP_EOL
);
}

require $loader;

$application = new Application('Shift', '1.0.0');
$application->setCatchExceptions(true);
$application->add(new \Shift\Console\Command\InvokeLocalCommand());
$application->add(new \Shift\Console\Command\ServiceCommand());
$application->run();
36 changes: 36 additions & 0 deletions composer.json
@@ -0,0 +1,36 @@
{
"name": "linkorb/shift",
"description": "Shift: ",
"homepage": "http://www.github.com/linkorb/shift",
"keywords": ["shift", "functions", "faas", "linkorb"],
"type": "library",
"authors": [
{
"name": "Joost Faassen",
"email": "j.faassen@linkorb.com",
"role": "Development"
}
],
"require": {
"php": ">=5.3.0",
"linkorb/boost": "~1.0",
"linkorb/collection": "~1.0",
"symfony/process": "~3.0",
"justinrainbow/json-schema": "~5.0"
},
"require-dev": {
"symfony/dotenv": "~3.0",
"symfony/console": "~3.0"
},
"autoload": {
"psr-4": {
"Shift\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Shift\\Example\\": "example/"
}
},
"license": "MIT"
}

0 comments on commit 8afc72e

Please sign in to comment.