https://github.com/ethanngit/simplefaas
Simple functions as a service engine.
https://github.com/ethanngit/simplefaas
Last synced: about 1 year ago
JSON representation
Simple functions as a service engine.
- Host: GitHub
- URL: https://github.com/ethanngit/simplefaas
- Owner: EthanNgit
- Created: 2025-02-08T19:58:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-12T17:23:00.000Z (over 1 year ago)
- Last Synced: 2025-05-07T12:12:16.180Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FaaS (Functions as a Service) Platform
A lightweight, Docker-based Functions as a Service platform that allows you to dynamically create and invoke Python functions.
## Features
✅ Dynamic function creation and registration
✅ Stateless function invocation
✅ Persistent function storage
✅ Supports warm starts
✅ Automatic container lifecycle management
## Limitations
⚠️ No code execution security measures
⚠️ No authentication/authorization system
⚠️ Python-only support
⚠️ Single instance deployment (no load balancing)
⚠️ No api to delete functions
## Prerequisites
- Docker
- Docker Compose
- cURL (for API examples)
## Getting Started
1. Ensure Docker is running on your system
2. Build the base image:
```bash
docker build -t faas-base-image -f ./base/Dockerfile.faas-base ./base
```
3. Build and start the services:
```bash
docker compose build
docker compose up -d
```
## Usage
### Registering a Function
```bash
curl -X POST -H "Content-Type: application/json" -d '{
"name": "hello",
"code": "def user_function(name): return f\"Hello, {name}!\""
}' http://localhost:8080/register
```
Expected response:
```json
{
"result": "hello-1"
}
```
### Invoking a Function
```bash
curl -X POST -H "Content-Type: application/json" -d '{
"name": "hello-1",
"params": {
"name": "World"
}
}' http://localhost:8080/invoke
```
Expected response:
```json
{
"result": "Hello, World!"
}
```
## API Reference
### POST /register
Registers a new function in the system.
**Request Body:**
- `name` (string): Function name
- `code` (string): Python function code
**Response:**
- `result` (string): Unique function identifier
### POST /invoke
Invokes a registered function.
**Request Body:**
- `name` (string): Function identifier
- `params` (object): Function parameters
**Response:**
- `result` (any): Function execution result
## ENV Reference
- `CLEANUP_INTERVAL` (#m, eg 1m): polls the running containers every # minutes
- `DELETE_AFTER` (#m, eg 1m): if a container was ran more than # minutes ago, shut it down
## Contributing
Feel free to open issues and pull requests to help improve this project.
## License
MIT