Functions as a Service
Go to file
OpenDev Sysadmins 20a8baf72d OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:49:59 +00:00
devstack Replace openstack.org git:// URLs with https:// 2019-03-24 20:35:35 +00:00
docs docs: fix more broken links 2017-01-18 10:30:41 -07:00
examples Replace openstack.org git:// URLs with https:// 2019-03-24 20:35:35 +00:00
migrations New project name: Picassa 2016-12-07 00:01:44 +02:00
picasso Issue #13: Improve logging in controllers 2016-12-13 09:59:50 +02:00
scripts New project name: Picassa 2016-12-07 00:01:44 +02:00
service Cleanup controllers 2016-12-13 01:31:51 +02:00
.gitignore Issue #17: Introduce Bandit static security checks 2016-12-13 03:48:30 +02:00
.gitreview OpenDev Migration Patch 2019-04-19 19:49:59 +00:00
alembic.ini Simplify migrations automation 2016-11-28 14:56:50 +02:00
Dockerfile New project name: Picassa 2016-12-07 00:01:44 +02:00
Dockerfile.env.example New project name: Picassa 2016-12-07 00:01:44 +02:00
LICENSE update copyright on apache license 2016-12-14 11:39:50 -07:00
MANIFEST.in Initial commit 2016-11-14 17:57:27 +02:00
README.md Add topic related to private and public functions 2017-01-23 14:48:28 -07:00
requirements.txt Use newer version of python-functionsclient v0.0.3 2016-12-14 22:59:22 +02:00
setup.cfg Fixing links from iron-io to openstack GitHub orgs 2017-01-18 11:15:58 +02:00
setup.py Use PBR for setup.py 2016-12-14 12:39:29 +02:00
test-requirements.txt Update test requirement 2017-03-02 16:29:04 +08:00
TESTING.md uppercase dot md 2016-12-15 23:45:05 -07:00
tox.ini docs update (#32) 2016-12-15 15:33:50 -07:00

Picasso

Functions-as-a-Service (FaaS) on OpenStack

Mission

Picasso aims to provide an API abstraction layer for Functions-as-a-Service (FaaS) on OpenStack.

What is FaaS?

Functions as a service is a new paradigm in computing that enables simplicity, efficiency and scalability for both developers and operators. It's important to distinguish the two, because the benefits differ:

Benefits for developers

The main benefits that most people refer to are on the developer side and they include:

  • No servers to manage -- you just upload your code and the platform deals with the infrastructure
  • Super simple coding -- no more monoliths! Just simple little bits of code
  • Pay by the milliseconds your code is executing -- unlike a typical application that runs 24/7, and you're paying 24/7, functions only run when needed

Since you'll be running IronFunctions yourself, the paying part may not apply, but it does apply to cost savings on your infrastructure bills as you'll read below.

Benefits for operators

If you will be operating IronFunctions, then the benefits are different, but related.

  • Extremely efficient use of resources
    • Unlike an app/API/microservice that consumes resources 24/7 whether they are in use or not, functions are time sliced across your infrastructure and only consume resources while they are actually doing something
  • Easy to manage and scale
    • Single system for code written in any language or any technology
    • Single system to monitor
    • Scaling is the same for all functions, you don't scale each app independently
    • Scaling is simply adding more IronFunctions nodes

System requirements

  • Operating system: Linux/MacOS
  • Python version: 3.5 or greater
  • Database: MySQL 5.7 or greater

Quick-start guide

Create a Python3.5 virtualenv

$ virtualenv -p python3.5 .venv
$ source .venv/bin/activate

Install Picasso dependencies

$ pip install -r requirements.txt -r test-requirements.txt

Install Picasso

$ pip install -e .

Install MySQL if you haven't already, and create a new database for functions

$ mysql -uroot -p -e "CREATE DATABASE functions"

Migrations

Once all dependencies are installed it is necessary to run database migrations. First, set the following environment variable:

export PICASSO_MIGRATIONS_DB=mysql+pymysql://root:root@localhost/functions

Then use alembic to apply the migrations

$ alembic upgrade head

Starting the Picasso API server

$ picasso-api --help

Usage: picasso-api [OPTIONS]

  Starts Picasso API service

Options:
  --host TEXT                    API service bind host.
  --port INTEGER                 API service bind port.
  --db-uri TEXT                  Picasso persistence storage URI.
  --keystone-endpoint TEXT       OpenStack Identity service endpoint.
  --functions-url TEXT           IronFunctions API URL
  --log-level TEXT               Logging file
  --log-file TEXT                Log file path
  --help                         Show this message and exit.

The following are the minimum required options to start the Picasso API service:

 --db-uri mysql://root:root@192.168.0.112/functions
 --keystone-endpoint http://192.168.0.112:5000/v3
 --functions-url http://192.168.0.112:8080/v1
 --log-level INFO

Building and Running Picasso in Docker

Install Docker engine if you haven't already.

From the Picasso repo, build a Docker image using the following commands:

export DOCKER_HOST=tcp://<docker-host>:<docker-port>
docker build -t picasso-api -f Dockerfile .

To start the container, pass in the required env vars with --env-file or by entering all required values in -e <KEY>=<VALUE> format to the docker run command.

Example Dockerfile.env

docker run -d -p 10001:10001 --env-file Dockerfile.env picasso-api

Once the container is started, check if the service in running. In your web browser navigate to:

<docker-host>:10001/api

or using the CLI:

curl -X GET http://<docker-host>:10001/api/swagger.json | python -mjson.tool

API docs

API docs are discoverable via Swagger. Just launch the Picasso API and browse to:

http://<picasso-host>:<picasso-port>/api

Picasso provides private and public functions

Using the Picasso API, it is possible to create two type of functions - private and public.

  • Private functions are defined as functions that belong to a specific OpenStack project, and the execution of the function requires passing in authorization headers.
  • Public functions belong to a specific OpenStack project ID, but do not require any authorization headers to execute, allowing the function to be shared with anyone.

Private and public functions are handled by different URL handlers:

<picasso-api-host>:<picasso-api-port>/r/{project}/{app}/{route} for private functions
<picasso-api-host>:<picasso-api-port>/r/{app}/{route} for public functions

See OpenStack alarming example for more details.

Testing Picasso

See Testing.md

Support

Join us on Slack!