Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alrik11es/metal-functions

A rapid FaaS deployment system for non experts
https://github.com/alrik11es/metal-functions

Last synced: about 1 month ago
JSON representation

A rapid FaaS deployment system for non experts

Awesome Lists containing this project

README

        

# Metal Functions
A.K.A. MF, a CLI for FaaS like deployment in PHP metal servers for non experts.

## Use and intentions
This project aims to deploy multiple different functions in a server with Nginx and PHP. It will create the Nginx virtual hosts just for you. You will only have to know how to use this CLI. A MF could be a directory or a php single file.

This project is also compatible with [Deployer](https://deployer.org/) config files, we share some of the libraries so most of the Host configuration is the same.

## MF System requirements
* Any kind of Debian based system should do
* PHP >=8.0 with Nginx
* 512MB RAM

## CLI System requirements
* PHP >=8.0

## Build from source

Download and decompress this repo on any directory.

```
$ composer install
$ ./mf app:build
$ sudo mv builds/mf /usr/local/bin/mf
```

## Install

* In the remote host you need Nginx and PHP 7.4 installed on any host.
* In your system for the CLI, you require SSH access to a server with Nginx and PHP >=7.3.

First you will need to install MF.
```
$ wget https://github.com/alrik11es/releases/... (Not yet)
$ sudo mv mf /usr/local/bin/mf
```

Download the latest release from releases page.

### ON SERVER (FullStack if needed)
```
$ git clone https://github.com/alrik11es/MetalFunctions.git
$ cd MetalFunctions
$ ./installer.sh
```

### Using Metal Functions
Well, supossing that you already have a PHP >=7.3 with Nginx server then you can get MF.

First you will need to install MF.
```
$ wget https://github.com/alrik11es/releases/mf.phar
$ sudo mv mf.phar /usr/local/bin/mf
```

Create a directory. `$ mkdir hello-world` and create a file called `$ touch metal.php`. This file is going to be your settings file. You can add here the URL of the function and your start script. View the example as follows.

```php
set('remote_user', 'ubuntu')
->set('become', 'root')
->set('identity_file', '~/.ssh/mykey');
```

Once you're done you can start using MF commands in the shell.

```
$ echo " helloworld.php
$ mf deploy
... Function name 89x7tya : http://ip/89x7tya
```

DONE.

Using my own [Basic library standard](https://www.msfsoftware.com/art%C3%ADculos/basic-library-standard)

## TODO

- [X] Host check for PHP and Nginx
- [X] Host check to enable metal functions in disabling default NGINX file
- [X] Deploy function
- [X] Delete function
- [ ] Docker container
- [ ] List functions
- [ ] Rollback a function