88 lines
2.1 KiB
Markdown
88 lines
2.1 KiB
Markdown
# 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.
|
|
|
|
## 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!"
|
|
}
|
|
``` |