openfaas / faasd

A lightweight & portable faas engine
https://store.openfaas.com/l/serverless-for-everyone-else
MIT License
2.97k stars 213 forks source link

Can docker-compose be used with faasd? #333

Closed hamedgibago closed 1 year ago

hamedgibago commented 1 year ago

Due diligence

My actions before raising this issue

Before you ask for help or support, make sure that you've consulted the manual for faasd. We can't answer questions that are already covered by the manual.

Why do you need this?

I want to run locally some faas-cli functions with faasd.

Who is this for?

I am doing academic research. What company is this for? Are you listed in the ADOPTERS.md file? No. not listed.

Expected Behaviour

Current Behaviour

I cloned faasd code from https://github.com/openfaas/faasd.git and after that ran docker compose build and it downloaded images. When I want to run docker compose up it sticks to Container fassd-prometheus-1 Creating and Container fassd-nats-1 Creating infinitely. I also tried to run list of images it created one by one:

prom/prometheus v2.42.0 8cfcb66f4364 4 months ago 232MB ghcr.io/openfaas/gateway 0.26.3 60d3bd137f7a 5 months ago 33MB ghcr.io/openfaas/queue-worker 0.13.3 2fd59c3f9117 5 months ago 10.3MB nats-streaming 0.25.3 5a48bccf54f8 5 months ago 21.2MB

nats-streaming and prom/prometheus ran successfully, but when I wanted to run ghcr.io/openfaas/gateway it said: You must provide an external provider via 'functions_provider_url' env-var. What steps I did wrong?

List All Possible Solutions and Workarounds

Which Solution Do You Recommend?

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Your Environment

go version

containerd -version

uname -a

cat /etc/os-release

faasd version
nitishkumar71 commented 1 year ago

Are you trying to explore how to create and deploy functions on faasd? README.md already have a section to deploy faasd.

Faasd capabilities with examples should be already covered in "Serverless For Everyone Else"

hamedgibago commented 1 year ago

Yes, I read the documentations. I also tried to download source code of multiple faas projects, such as main faas, faas-cli, faas-nete and faas-provider. I compiled them and run them one by one, but every time at the end reach the error for 127.0.0.1 8080 gateway not found. Is there any solution to run them in order from architecture picture of open-faas and deploy a function locally to it?

nitishkumar71 commented 1 year ago

You don't need to download any project. Script mentioned in deploy faasd section will do everything for you. You can use multipass, if you want to do a fresh installation.

Even if you face issue then paste logs for sudo journalctl -u faasd.service and sudo journalctl -u faasd-provider.service

hamedgibago commented 1 year ago

I start the program and it updated the linux packages. But in the middle of process can not access some text file for configuring. Is it because docker is installed or I tried different ways to install openfaas or faasd?

This is the log output:

+ export OWNER=openfaas
+ OWNER=openfaas
+ export REPO=faasd
+ REPO=faasd
+ export ARKADE=/usr/local/bin/arkade
+ ARKADE=/usr/local/bin/arkade
+ '[' -z /root ']'
+ version=
+ echo 'Finding latest version from GitHub'
Finding latest version from GitHub
++ curl -sI https://github.com/openfaas/faasd/releases/latest
++ tr -d '\r'
++ awk -F/ '{ printf "%s", $NF }'
++ grep -i location:
+ version=0.16.9
+ echo 0.16.9
0.16.9
+ '[' '!' 0.16.9 ']'
+ SUDO=sudo
++ id -u
+ '[' 0 -eq 0 ']'
+ SUDO=
+ verify_system
+ '[' -d /run/systemd ']'
+ install_required_packages
++ has_apt_get
+++ command -v apt-get
++ '[' -n /usr/bin/apt-get ']'
+ apt-get update -y
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:2 http://ir.archive.ubuntu.com/ubuntu jammy InRelease                     
Hit:3 https://download.docker.com/linux/ubuntu jammy InRelease                
Hit:4 http://ir.archive.ubuntu.com/ubuntu jammy-updates InRelease             
Hit:5 http://ir.archive.ubuntu.com/ubuntu jammy-backports InRelease           
Ign:6 http://download.pegasus.isi.edu/pegasus/ubuntu bionic InRelease
Hit:7 http://download.pegasus.isi.edu/pegasus/ubuntu bionic Release
Reading package lists... Done
W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11 (stable/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11 (stable/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11-icons-small (stable/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11-icons (stable/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11-icons-hidpi (stable/dep11/icons-64x64@2.tar) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11 (stable/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11 (stable/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11-icons-small (stable/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11-icons (stable/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11-icons-hidpi (stable/dep11/icons-64x64@2.tar) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target CNF (stable/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_ubuntu-jammy.list:1 and /etc/apt/sources.list.d/docker.list:1
+ apt-get install -y curl runc bridge-utils iptables
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
bridge-utils is already the newest version (1.7-1ubuntu3).
curl is already the newest version (7.81.0-1ubuntu1.10).
iptables is already the newest version (1.8.7-1ubuntu5.1).
runc is already the newest version (1.1.4-0ubuntu1~22.04.3).
The following packages were automatically installed and are no longer required:
  docker-ce-rootless-extras libslirp0 pigz slirp4netns
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 252 not upgraded.
+ /sbin/sysctl -w net.ipv4.conf.all.forwarding=1
net.ipv4.conf.all.forwarding = 1
+ echo net.ipv4.conf.all.forwarding=1
+ tee -a /etc/sysctl.conf
net.ipv4.conf.all.forwarding=1
+ install_arkade
+ sh
+ curl -sLS https://get.arkade.dev
x86_64
Downloading package https://github.com/alexellis/arkade/releases/download/0.9.22/arkade as /tmp/arkade
Download complete.

Running with sufficient permissions to attempt to move arkade to /usr/local/bin
New version of arkade installed to /usr/local/bin
There is already a command 'ark' in the path, NOT creating alias
            _             _      
  __ _ _ __| | ____ _  __| | ___ 
 / _` | '__| |/ / _` |/ _` |/ _ \
| (_| | |  |   < (_| | (_| |  __/
 \__,_|_|  |_|\_\__,_|\__,_|\___|

Open Source Marketplace For Developer Tools

Version: 0.9.22
Git Commit: ab3f8aa2a12aa2f3407e8150b5bdea97fd582a6e

 🐳 arkade needs your support: https://github.com/sponsors/alexellis
+ arkade --help
Usage:
  arkade [flags]
  arkade [command]

Available Commands:
  chart       Chart utilities
  completion  Output shell completion for the given shell (bash or zsh)
  get         The get command downloads a tool
  help        Help about any command
  info        Find info about a Kubernetes app
  install     Install Kubernetes apps from helm charts or YAML files
  system      System apps
  uninstall   Uninstall apps installed with arkade
  update      Print update instructions
  version     Print the version

Flags:
  -h, --help   help for arkade

Use "arkade [command] --help" for more information about a command.
+ install_cni_plugins
+ cni_version=v0.9.1
+ /usr/local/bin/arkade system install cni --version v0.9.1 --path /opt/cni/bin --progress=false
Installing CNI to /opt/cni/bin
Installing version: v0.9.1 for: amd64
Downloading from: https://github.com/containernetworking/plugins/releases/download/v0.9.1/cni-plugins-linux-amd64-v0.9.1.tgz
Downloaded to: /tmp/arkade-122701678/cni-plugins-linux-amd64-v0.9.1.tgz
Unpacking CNI Plugins to: /tmp/cni-plugins3367641119
Copying /tmp/cni-plugins3367641119/bandwidth to: /opt/cni/bin/bandwidth
Copying /tmp/cni-plugins3367641119/bridge to: /opt/cni/bin/bridge
Copying /tmp/cni-plugins3367641119/dhcp to: /opt/cni/bin/dhcp
Copying /tmp/cni-plugins3367641119/firewall to: /opt/cni/bin/firewall
Copying /tmp/cni-plugins3367641119/flannel to: /opt/cni/bin/flannel
Copying /tmp/cni-plugins3367641119/host-device to: /opt/cni/bin/host-device
Copying /tmp/cni-plugins3367641119/host-local to: /opt/cni/bin/host-local
Copying /tmp/cni-plugins3367641119/ipvlan to: /opt/cni/bin/ipvlan
Copying /tmp/cni-plugins3367641119/loopback to: /opt/cni/bin/loopback
Copying /tmp/cni-plugins3367641119/macvlan to: /opt/cni/bin/macvlan
Copying /tmp/cni-plugins3367641119/portmap to: /opt/cni/bin/portmap
Copying /tmp/cni-plugins3367641119/ptp to: /opt/cni/bin/ptp
Copying /tmp/cni-plugins3367641119/sbr to: /opt/cni/bin/sbr
Copying /tmp/cni-plugins3367641119/static to: /opt/cni/bin/static
Copying /tmp/cni-plugins3367641119/tuning to: /opt/cni/bin/tuning
Copying /tmp/cni-plugins3367641119/vlan to: /opt/cni/bin/vlan
Copying /tmp/cni-plugins3367641119/vrf to: /opt/cni/bin/vrf
+ install_containerd
+ CONTAINERD_VER=1.7.0
+ systemctl unmask containerd
++ uname -m
+ arch=x86_64
+ '[' x86_64 == armv7l ']'
+ /usr/local/bin/arkade system install containerd --systemd --version v1.7.0 --progress=false
Installing containerd to /usr/local/bin
Downloaded to: /tmp/arkade-2776047496/containerd-1.7.0-Linux-amd64.tar.gz
2023/06/28 13:04:12 extracted tarball into /tmp/containerd: 6 files, 1 dirs (2.200643368s)
Copying containerd binaries to: /usr/local/bin
Error: open /usr/local/bin/containerd-shim-runc-v2: text file busy
nitishkumar71 commented 1 year ago

You have kind of mixed setup steps. Follow uninstall guide and use multipass to create vm. Setup faasd inside vm.

alexellis commented 1 year ago

Please see @nitishkumar71's comment

You should really pay for a copy of the eBook if you're not sure how to use faasd, it covers everything you'd need to know and more.

You'll also find the odd video and tutorial that I've created in the past, but they may be out of date in comparison.

https://store.openfaas.com/l/serverless-for-everyone-else

alexellis commented 1 year ago

/set title: Can docker-compose be used with faasd?

hamedgibago commented 1 year ago

Please see @nitishkumar71's comment

You should really pay for a copy of the eBook if you're not sure how to use faasd, it covers everything you'd need to know and more.

You'll also find the odd video and tutorial that I've created in the past, but they may be out of date in comparison.

https://store.openfaas.com/l/serverless-for-everyone-else

Thank you @alexellis, is there any discounts for academic staff?