From ee49692ca17b0d9c5de59472d80c6e3671b7a7d3 Mon Sep 17 00:00:00 2001 From: harmacist Date: Mon, 25 Oct 2021 23:14:24 -0500 Subject: [PATCH] Initial commit --- .gitignore | 3 ++ README.md | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f8b73e7..bd1441e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# ---> PyCharm +.idea/ + # ---> Python # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/README.md b/README.md index a5eb9b9..89d3cbd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,88 @@ # pyPledge +pyPledge is a project aimed at making serverless functions capable of being run in a self-hosted manner, +while maintaining an easy to use UI. -pyPledge is a project aimed at making serverless functions capable of being run in a self-hosted manner, -while maintaining an easy to use UI. \ No newline at end of file +## Features +- [ ] Two different modes of function execution + - [ ] CRON based, scheduled execution + - [ ] Web hook based ad-hoc execution (uuid urls) +- [ ] RESTful JSON API +- [ ] Command Line Interface? +- [ ] Multiple Languages Supported + - [ ] Python + - [ ] JavaScript via Node.js + - [ ] Ruby + - [ ] Bash + - [ ] PHP +- [ ] UI to monitor current status, success and failures of all functions + - [ ] Ability to start, stop or sigterm any function + - [ ] In-browser web editor for direct function creation via the web UI with syntax highlighting + +## Samples + +### Starting the Service + +- Single Docker File + - SQLITE database + - CRON and web service are all running in one container + - If any part fails, the entire container goes down +- Docker Compose/Swarm + - Any sqlalchemy database supported + - CRON runs in a separate and/or scalable container setup + - Webhooks run in a separate and/or scalable container setup + + +### Hello World CRON function + +`POST https://localhost:8080/api/v1/new` +```json +{ + "name": "example_function", + "lang": "py", + "deployment": { + "type": "cron", + "schedule": "0 * * * *" + }, + "content": "print('Hello, World!')" +} +``` +The above post request would return the following: +```json +{ + "status": { + "value": 201, + "message": "CREATED" + }, + "name": "example_function" +} +``` + +### Hello World URL function +`POST https://localhost:8080/api/v1/new` +```json +{ + "name": "example_function", + "lang": "py", + "deployment": { + "type": "url" + }, + "content": "print('Hello, World!')" +} +``` +The above post could return the following: +```json +{ + "status": { + "value": 201, + "message": "CREATED" + }, + "name": "example_function", + "endpoint": "8ca0fbdc-831e-45a9-a9a9-eab896d67811" +} +``` +Once created, navigating to the url `https://localhost:8080/8ca0fbdc-831e-45a9-a9a9-eab896d67811` would result in the following output: +```json +{ + "stdout": "Hello, World!" +} +``` \ No newline at end of file