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

faasd and faasd provider in different ports #350

Closed jbonadiman closed 9 months ago

jbonadiman commented 9 months ago

Hello! I've followed the examples in the book/website and installed faasd using this command:

(git clone https://github.com/openfaas/faasd --depth=1
cd faasd
./hack/install.sh)

faasd started running in :8080 as it should. But when I tried to login using:

sudo -E cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login -s --gateway localhost:8080

I got this error: Calling the OpenFaaS server to validate the credentials... Server returned unexpected status code: 502 -

I checked the faasd.service and faasd-provider.service and understood that something else was listening on port :8081 (I'm guessing the provider), so I used that port to login and it worked. I continued to follow the examples and manage to successfully deploy a function using the CLI. But then, when I tried to see it in the UI (localhost:8080/ui), it wasn't there. I tried to do the opposite and deploy the function using the UI, and I could see the 502 again in the browser. From what I understood, faasd is deployed in two separate components and so they require different ports, but I guess it was supposed to have some sort of redirection? All the examples I see in the website/book uses just one port to access the UI/API/gateway (:8080). I don't know what happened in my installation (tried to uninstall and install again also), but somehow this is not happening. Can someone help me diagnose this and make it work properly?

Your Environment

containerd github.com/containerd/containerd v1.7.0 1fbd70374134b891f97ce19c70b6e50c7b9f4e0d

Linux instance-20231104-0043 5.15.0-1047-oracle #53-Ubuntu SMP Wed Oct 18 09:56:06 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

  __                     _
 / _| __ _  __ _ ___  __| |
| |_ / _` |/ _` / __|/ _` |
|  _| (_| | (_| \__ \ (_| |
|_|  \__,_|\__,_|___/\__,_|

faasd version: 0.18.2   commit: 078043b168d8e18fa2671de9cc1f9aca27d4e9ba
alexellis commented 9 months ago

Hi @jbonadiman

We've made no changes to faasd recently that would affect the installation or how it works.

faasd is only to be installed in a fresh VM, or a dedicated host.

If you have something else running on your machine then you've already broken the prerequisites, this is explained in the book.

There's currently no issue with faasd and its provider.

The best troubleshooting you could do is to use a completely fresh Ubuntu VM or bare-metal host, and not to install anything else inside of it. After that, there is a detailed chapter in the book on troubleshooting, and we have a weekly call every Wednesday where you're welcome to drop in and talk to us.

https://docs.openfaas.com/community/

multipass launch --name faasd --disk 16G --cpus 2 --mem 4G

multipass exec faasd /bin/bash

+ sudo /usr/local/bin/faasd install
2023/11/20 09:30:00 Writing to: "/var/lib/faasd/secrets/basic-auth-password"
2023/11/20 09:30:00 Writing to: "/var/lib/faasd/secrets/basic-auth-user"
Check status with:
  sudo journalctl -u faasd --lines 100 -f

Login with:
  sudo -E cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login -s
+ install_caddy
+ '[' '!' -z '' ']'
+ echo 'Skipping caddy installation as FAASD_DOMAIN.'
Skipping caddy installation as FAASD_DOMAIN.
ubuntu@faasd:~$ sudo -E cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login -s --gateway localhost:8080
Calling the OpenFaaS server to validate the credentials...
credentials saved for admin http://localhost:8080
ubuntu@faasd:~$ faas-cli version
  ___                   _____           ____
 / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
 \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
      |_|

CLI:
 commit:  f72db8de657001a2967582c535fe8351c259c5f6
 version: 0.16.17
ubuntu@faasd:~$ 

Alex