mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-20 04:56:37 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
3d0adec851 | |||
b475aa8884 | |||
123ce3b849 | |||
17d09bb185 | |||
789e9a29fe | |||
b575c02338 | |||
cd4add32e1 |
7
.github/ISSUE_TEMPLATE.md
vendored
7
.github/ISSUE_TEMPLATE.md
vendored
@ -8,10 +8,13 @@
|
|||||||
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||||
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||||
|
|
||||||
## Possible Solution
|
## List all Possible Solutions
|
||||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||||
<!--- or ideas how to implement the addition or change -->
|
<!--- or ideas how to implement the addition or change -->
|
||||||
|
|
||||||
|
## List the one solution that you would recommend
|
||||||
|
<!--- If you were to be on the hook for this change. -->
|
||||||
|
|
||||||
## Steps to Reproduce (for bugs)
|
## Steps to Reproduce (for bugs)
|
||||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
||||||
@ -38,4 +41,6 @@ containerd -version
|
|||||||
uname -a
|
uname -a
|
||||||
|
|
||||||
cat /etc/os-release
|
cat /etc/os-release
|
||||||
|
|
||||||
|
faasd version
|
||||||
```
|
```
|
||||||
|
59
README.md
59
README.md
@ -28,6 +28,38 @@ faasd does not create the same maintenance burden you'll find with maintaining,
|
|||||||
|
|
||||||
> Demo of faasd running in KVM
|
> Demo of faasd running in KVM
|
||||||
|
|
||||||
|
|
||||||
|
## "Serverless For Everyone Else" is the official handbook for faasd
|
||||||
|
|
||||||
|
<a href="https://gumroad.com/l/serverless-for-everyone-else">
|
||||||
|
<img src="https://static-2.gumroad.com/res/gumroad/2028406193591/asset_previews/714aad765f8246463fafb64fcd3be4ea/retina/104810333-b628f280-57eb-11eb-8be9-a2f6c773346b.png" width="40%"></a>
|
||||||
|
|
||||||
|
You'll learn how to deploy code in any language, lift and shift Dockerfiles, run requests in queues, write background jobs and to integrate with databases. faasd packages the same code as OpenFaaS, so you get built-in metrics for your HTTP endpoints, a user-friendly CLI, pre-packaged functions and templates from the store and a UI.
|
||||||
|
|
||||||
|
Topics include:
|
||||||
|
|
||||||
|
* Should you deploy to a VPS or Raspberry Pi?
|
||||||
|
* Deploying your server with bash, cloud-init or terraform
|
||||||
|
* Using a private container registry
|
||||||
|
* Finding functions in the store
|
||||||
|
* Building your first function with Node.js
|
||||||
|
* Using environment variables for configuration
|
||||||
|
* Using secrets from functions, and enabling authentication tokens
|
||||||
|
* Customising templates
|
||||||
|
* Monitoring your functions with Grafana and Prometheus
|
||||||
|
* Scheduling invocations and background jobs
|
||||||
|
* Tuning timeouts, parallelism, running tasks in the background
|
||||||
|
* Adding TLS to faasd and custom domains for functions
|
||||||
|
* Adding a database for storage with InfluxDB
|
||||||
|
* Troubleshooting and logs
|
||||||
|
* CI/CD with GitHub Actions and multi-arch
|
||||||
|
* Taking things further, community and case-studies
|
||||||
|
|
||||||
|
View sample pages, reviews and testimonials on Gumroad:
|
||||||
|
|
||||||
|
["Serverless For Everyone Else"](https://gumroad.com/l/serverless-for-everyone-else)
|
||||||
|
|
||||||
|
|
||||||
## Try faasd for the first time
|
## Try faasd for the first time
|
||||||
|
|
||||||
faasd is OpenFaaS, so many things you read in the docs or in blog posts will work the same way.
|
faasd is OpenFaaS, so many things you read in the docs or in blog posts will work the same way.
|
||||||
@ -54,7 +86,7 @@ For trying out fasad on MacOS or Windows, we recommend using multipass.
|
|||||||
If you don't use cloud-init, or have already created your Linux server you can use the installation script as per below:
|
If you don't use cloud-init, or have already created your Linux server you can use the installation script as per below:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/openfaas/faasd
|
git clone https://github.com/openfaas/faasd --depth=1
|
||||||
cd faasd
|
cd faasd
|
||||||
|
|
||||||
./hack/install.sh
|
./hack/install.sh
|
||||||
@ -90,31 +122,6 @@ Automate everything within < 60 seconds and get a public URL and IP address back
|
|||||||
|
|
||||||
* [Provision faasd on DigitalOcean with built-in TLS support](docs/bootstrap/digitalocean-terraform/README.md)
|
* [Provision faasd on DigitalOcean with built-in TLS support](docs/bootstrap/digitalocean-terraform/README.md)
|
||||||
|
|
||||||
## faasd handbook - everything you need to know to run functions without Kubernetes (early access)
|
|
||||||
|
|
||||||
faasd is a portable, and open source serverless engine. It runs a number of core services for its REST API, for background processing, and for metrics. The project schedules functions with containerd directly, and supports scale to and from zero, but without the need for clustering or Kubernetes.
|
|
||||||
|
|
||||||
It makes for a quick and easy way to start hosting APIs and websites, benefiting from containers and cloud native technology without having to manage Kubernetes, or pay significant hosting costs.
|
|
||||||
|
|
||||||
This handbook is written for those deploying faasd to self-hosted or cloud infrastructure. Whilst OpenFaaS has reference documentation, here we focus on everything you need to know about faasd itself.
|
|
||||||
|
|
||||||
Topics include:
|
|
||||||
|
|
||||||
* Should you deploy to a VPS or Raspberry Pi?
|
|
||||||
* Deploying your server with bash, cloud-init or terraform
|
|
||||||
* Using a private container registry
|
|
||||||
* Building your first function, and customising templates
|
|
||||||
* Monitoring your functions with Grafana and Prometheus
|
|
||||||
* Scheduling invocations and background jobs
|
|
||||||
* Tuning timeouts, parallelism, running tasks in the background
|
|
||||||
* Upgrading faasd
|
|
||||||
* Setting memory limits for functions
|
|
||||||
* Exposing the core services like Prometheus and NATS
|
|
||||||
|
|
||||||
> faasd users can upgrade to Kubernetes when the need presents itself and can bring their functions with them.
|
|
||||||
|
|
||||||
* [Find out more on Gumroad](https://gumroad.com/l/serverless-for-everyone-else)
|
|
||||||
|
|
||||||
## Finding logs
|
## Finding logs
|
||||||
|
|
||||||
### Logs for functions
|
### Logs for functions
|
||||||
|
@ -93,7 +93,10 @@ func runInstall(_ *cobra.Command, _ []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(`Login with:
|
fmt.Println(`Check status with:
|
||||||
|
sudo journalctl -u faasd --lines 100 -f
|
||||||
|
|
||||||
|
Login with:
|
||||||
sudo cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login -s`)
|
sudo cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login -s`)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -41,7 +41,7 @@ services:
|
|||||||
- "127.0.0.1:9090:9090"
|
- "127.0.0.1:9090:9090"
|
||||||
|
|
||||||
gateway:
|
gateway:
|
||||||
image: ghcr.io/openfaas/gateway:0.20.5
|
image: ghcr.io/openfaas/gateway:0.20.7
|
||||||
environment:
|
environment:
|
||||||
- basic_auth=true
|
- basic_auth=true
|
||||||
- functions_provider_url=http://faasd-provider:8081/
|
- functions_provider_url=http://faasd-provider:8081/
|
||||||
@ -55,6 +55,7 @@ services:
|
|||||||
- auth_proxy_pass_body=false
|
- auth_proxy_pass_body=false
|
||||||
- secret_mount_path=/run/secrets
|
- secret_mount_path=/run/secrets
|
||||||
- scale_from_zero=true
|
- scale_from_zero=true
|
||||||
|
- function_namespace=openfaas-fn
|
||||||
volumes:
|
volumes:
|
||||||
# we assume cwd == /var/lib/faasd
|
# we assume cwd == /var/lib/faasd
|
||||||
- type: bind
|
- type: bind
|
||||||
|
44
docs/DEV.md
44
docs/DEV.md
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
If you're using multipass, then allocate sufficient resources:
|
If you're using multipass, then allocate sufficient resources:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
multipass launch \
|
multipass launch \
|
||||||
--mem 4G \
|
--mem 4G \
|
||||||
-c 2 \
|
-c 2 \
|
||||||
@ -34,7 +34,7 @@ multipass shell faasd
|
|||||||
|
|
||||||
### Get runc
|
### Get runc
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
sudo apt update \
|
sudo apt update \
|
||||||
&& sudo apt install -qy \
|
&& sudo apt install -qy \
|
||||||
runc \
|
runc \
|
||||||
@ -58,7 +58,7 @@ curl -sLS https://cli.openfaas.com | sudo sh
|
|||||||
|
|
||||||
Then run:
|
Then run:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
export ARCH=amd64
|
export ARCH=amd64
|
||||||
export CNI_VERSION=v0.8.5
|
export CNI_VERSION=v0.8.5
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ You have three options - binaries for PC, binaries for armhf, or build from sour
|
|||||||
|
|
||||||
* Install containerd `x86_64` only
|
* Install containerd `x86_64` only
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
export VER=1.3.5
|
export VER=1.3.5
|
||||||
curl -sSL https://github.com/containerd/containerd/releases/download/v$VER/containerd-$VER-linux-amd64.tar.gz > /tmp/containerd.tar.gz \
|
curl -sSL https://github.com/containerd/containerd/releases/download/v$VER/containerd-$VER-linux-amd64.tar.gz > /tmp/containerd.tar.gz \
|
||||||
&& sudo tar -xvf /tmp/containerd.tar.gz -C /usr/local/bin/ --strip-components=1
|
&& sudo tar -xvf /tmp/containerd.tar.gz -C /usr/local/bin/ --strip-components=1
|
||||||
@ -95,13 +95,13 @@ containerd -version
|
|||||||
|
|
||||||
Building `containerd` on armhf is extremely slow, so I've provided binaries for you.
|
Building `containerd` on armhf is extremely slow, so I've provided binaries for you.
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
curl -sSL https://github.com/alexellis/containerd-armhf/releases/download/v1.3.5/containerd.tgz | sudo tar -xvz --strip-components=2 -C /usr/local/bin/
|
curl -sSL https://github.com/alexellis/containerd-armhf/releases/download/v1.3.5/containerd.tgz | sudo tar -xvz --strip-components=2 -C /usr/local/bin/
|
||||||
```
|
```
|
||||||
|
|
||||||
* Or clone / build / install [containerd](https://github.com/containerd/containerd) from source:
|
* Or clone / build / install [containerd](https://github.com/containerd/containerd) from source:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
export GOPATH=$HOME/go/
|
export GOPATH=$HOME/go/
|
||||||
mkdir -p $GOPATH/src/github.com/containerd
|
mkdir -p $GOPATH/src/github.com/containerd
|
||||||
cd $GOPATH/src/github.com/containerd
|
cd $GOPATH/src/github.com/containerd
|
||||||
@ -118,7 +118,7 @@ containerd -version
|
|||||||
|
|
||||||
#### Ensure containerd is running
|
#### Ensure containerd is running
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
curl -sLS https://raw.githubusercontent.com/containerd/containerd/v1.3.5/containerd.service > /tmp/containerd.service
|
curl -sLS https://raw.githubusercontent.com/containerd/containerd/v1.3.5/containerd.service > /tmp/containerd.service
|
||||||
|
|
||||||
# Extend the timeouts for low-performance VMs
|
# Extend the timeouts for low-performance VMs
|
||||||
@ -134,7 +134,7 @@ sudo systemctl restart containerd
|
|||||||
|
|
||||||
Or run ad-hoc. This step can be useful for exploring why containerd might fail to start.
|
Or run ad-hoc. This step can be useful for exploring why containerd might fail to start.
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
sudo containerd &
|
sudo containerd &
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -142,13 +142,13 @@ sudo containerd &
|
|||||||
|
|
||||||
> This is required to allow containers in containerd to access the Internet via your computer's primary network interface.
|
> This is required to allow containers in containerd to access the Internet via your computer's primary network interface.
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
sudo /sbin/sysctl -w net.ipv4.conf.all.forwarding=1
|
sudo /sbin/sysctl -w net.ipv4.conf.all.forwarding=1
|
||||||
```
|
```
|
||||||
|
|
||||||
Make the setting permanent:
|
Make the setting permanent:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
echo "net.ipv4.conf.all.forwarding=1" | sudo tee -a /etc/sysctl.conf
|
echo "net.ipv4.conf.all.forwarding=1" | sudo tee -a /etc/sysctl.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ echo "net.ipv4.conf.all.forwarding=1" | sudo tee -a /etc/sysctl.conf
|
|||||||
|
|
||||||
#### Get build packages
|
#### Get build packages
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
sudo apt update \
|
sudo apt update \
|
||||||
&& sudo apt install -qy \
|
&& sudo apt install -qy \
|
||||||
runc \
|
runc \
|
||||||
@ -168,7 +168,7 @@ You may find alternative package names for CentOS and other Linux distributions.
|
|||||||
|
|
||||||
#### Install Go 1.13 (x86_64)
|
#### Install Go 1.13 (x86_64)
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
curl -sSLf https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz > /tmp/go.tgz
|
curl -sSLf https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz > /tmp/go.tgz
|
||||||
sudo rm -rf /usr/local/go/
|
sudo rm -rf /usr/local/go/
|
||||||
sudo mkdir -p /usr/local/go/
|
sudo mkdir -p /usr/local/go/
|
||||||
@ -182,14 +182,14 @@ go version
|
|||||||
|
|
||||||
You should also add the following to `~/.bash_profile`:
|
You should also add the following to `~/.bash_profile`:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
echo "export GOPATH=\$HOME/go/" | tee -a $HOME/.bash_profile
|
echo "export GOPATH=\$HOME/go/" | tee -a $HOME/.bash_profile
|
||||||
echo "export PATH=\$PATH:/usr/local/go/bin/" | tee -a $HOME/.bash_profile
|
echo "export PATH=\$PATH:/usr/local/go/bin/" | tee -a $HOME/.bash_profile
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Or on Raspberry Pi (armhf)
|
#### Or on Raspberry Pi (armhf)
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
curl -SLsf https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz > go.tgz
|
curl -SLsf https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz > go.tgz
|
||||||
sudo rm -rf /usr/local/go/
|
sudo rm -rf /usr/local/go/
|
||||||
sudo mkdir -p /usr/local/go/
|
sudo mkdir -p /usr/local/go/
|
||||||
@ -203,7 +203,7 @@ go version
|
|||||||
|
|
||||||
#### Clone faasd and its systemd unit files
|
#### Clone faasd and its systemd unit files
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
mkdir -p $GOPATH/src/github.com/openfaas/
|
mkdir -p $GOPATH/src/github.com/openfaas/
|
||||||
cd $GOPATH/src/github.com/openfaas/
|
cd $GOPATH/src/github.com/openfaas/
|
||||||
git clone https://github.com/openfaas/faasd
|
git clone https://github.com/openfaas/faasd
|
||||||
@ -211,7 +211,7 @@ git clone https://github.com/openfaas/faasd
|
|||||||
|
|
||||||
#### Build `faasd` from source (optional)
|
#### Build `faasd` from source (optional)
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
cd $GOPATH/src/github.com/openfaas/faasd
|
cd $GOPATH/src/github.com/openfaas/faasd
|
||||||
cd faasd
|
cd faasd
|
||||||
make local
|
make local
|
||||||
@ -222,7 +222,7 @@ sudo cp bin/faasd /usr/local/bin
|
|||||||
|
|
||||||
#### Or, download and run `faasd` (binaries)
|
#### Or, download and run `faasd` (binaries)
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
# For x86_64
|
# For x86_64
|
||||||
export SUFFIX=""
|
export SUFFIX=""
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ sudo mv /tmp/faasd /usr/local/bin/
|
|||||||
|
|
||||||
This step installs faasd as a systemd unit file, creates files in `/var/lib/faasd`, and writes out networking configuration for the CNI bridge networking plugin.
|
This step installs faasd as a systemd unit file, creates files in `/var/lib/faasd`, and writes out networking configuration for the CNI bridge networking plugin.
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
sudo faasd install
|
sudo faasd install
|
||||||
|
|
||||||
2020/02/17 17:38:06 Writing to: "/var/lib/faasd/secrets/basic-auth-password"
|
2020/02/17 17:38:06 Writing to: "/var/lib/faasd/secrets/basic-auth-password"
|
||||||
@ -256,13 +256,13 @@ You can now log in either from this machine or a remote machine using the OpenFa
|
|||||||
|
|
||||||
Check that faasd is ready:
|
Check that faasd is ready:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
sudo journalctl -u faasd
|
sudo journalctl -u faasd
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see output like:
|
You should see output like:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
Feb 17 17:46:35 gold-survive faasd[4140]: 2020/02/17 17:46:35 Starting faasd proxy on 8080
|
Feb 17 17:46:35 gold-survive faasd[4140]: 2020/02/17 17:46:35 Starting faasd proxy on 8080
|
||||||
Feb 17 17:46:35 gold-survive faasd[4140]: Gateway: 10.62.0.5:8080
|
Feb 17 17:46:35 gold-survive faasd[4140]: Gateway: 10.62.0.5:8080
|
||||||
Feb 17 17:46:35 gold-survive faasd[4140]: 2020/02/17 17:46:35 [proxy] Wait for done
|
Feb 17 17:46:35 gold-survive faasd[4140]: 2020/02/17 17:46:35 [proxy] Wait for done
|
||||||
@ -271,7 +271,7 @@ Feb 17 17:46:35 gold-survive faasd[4140]: 2020/02/17 17:46:35 [proxy] Begin list
|
|||||||
|
|
||||||
To get the CLI for the command above run:
|
To get the CLI for the command above run:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
curl -sSLf https://cli.openfaas.com | sudo sh
|
curl -sSLf https://cli.openfaas.com | sudo sh
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ faasd provider
|
|||||||
|
|
||||||
Look in `hosts` in the current working folder or in `/var/lib/faasd/` to get the IP for the gateway or Prometheus
|
Look in `hosts` in the current working folder or in `/var/lib/faasd/` to get the IP for the gateway or Prometheus
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
127.0.0.1 localhost
|
127.0.0.1 localhost
|
||||||
10.62.0.1 faasd-provider
|
10.62.0.1 faasd-provider
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ This issue appears to happen sporadically and only for some users.
|
|||||||
If you get a non 200 HTTP code from the gateway, or caddy after installing faasd, check the logs of faasd:
|
If you get a non 200 HTTP code from the gateway, or caddy after installing faasd, check the logs of faasd:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo journalctl -t faasd
|
sudo journalctl -u faasd
|
||||||
```
|
```
|
||||||
|
|
||||||
If you see the following error:
|
If you see the following error:
|
||||||
|
Reference in New Issue
Block a user