$ faas-cli version\n ___ _____ ____\n \/ _ \\ _ __ ___ _ __ | ___|_ _ __ _\/ ___|\n| | | | '_ \\ \/ _ \\ '_ \\| |_ \/ _` |\/ _` \\___ \\\n| |_| | |_) | __\/ | | | _| (_| | (_| |___) |\n \\___\/| .__\/ \\___|_| |_|_| \\__,_|\\__,_|____\/\n |_|\n\nCLI:\n commit: 6b5e7a14a598527063c7c05fb4187739b6eb6d38\n version: 0.13.6\n<\/code><\/pre>\nThe nice thing about multipass is that the instance will be restarted and still use the same IP address.<\/p>\n
$ multipass list\nName State IPv4 Image\nfaasd Running 192.168.64.4 Ubuntu 20.04 LTS\n 10.62.0.1\n<\/code><\/pre>\nYou will need the password for the admin user to use with faas-cli<\/code><\/p>\nFollowing on from yesterday’s configuration I will be using SSH to connect to the instance.<\/p>\n
$ ssh -i ~\/.ssh\/id_rsa -o PreferredAuthentications=publickey ubuntu@192.168.64.4\n<\/code><\/pre>\nCat out the password and save it somewhere locally on your computer. I am saving mine to "~\/Learning\/faasd\/password.txt"<\/p>\n
ubuntu@faasd:~$ sudo cat \/var\/lib\/faasd\/secrets\/basic-auth-password ;echo\nzI24jRLe45DhUPa21S6BoNy5q1DpYUb0FuDwlLfUoBNo6yaDBMZEPTO2W3K\n<\/code><\/pre>\nSet the environment variable OPENFAAS_URL<\/code> so that faas-cli<\/code> knows where the faasd services is located. For now I will just enter this into the current terminal session but will add it to my zsh setup later.<\/p>\nexport OPENFAAS_URL=http:\/\/192.168.64.4:8080\n<\/code><\/pre>\nSetup faas-cli<\/code> to use the password.<\/p>\ncat password.txt | faas-cli login --username admin --password-stdin\n\nCalling the OpenFaaS server to validate the credentials...\nWARNING! You are not using an encrypted connection to the gateway, consider using HTTPS.\ncredentials saved for admin http:\/\/192.168.64.4:8080\n<\/code><\/pre>\nCalling your FaaS<\/h2>\n Yesterday I deployed the ASCII Cows function. So lets see if it is still available and if we can invoke it locally using faas-cli<\/code><\/p>\nFirst I consult the help to see if there is an easy way to list the available functions. Running faas-cli help<\/code> revealed that indeed it is as simple as just using the following.<\/p>\n$ faas-cli list\nFunction \tInvocations \tReplicas\ncows \t0 \t0\n<\/code><\/pre>\nTo get more information about the function<\/p>\n
$ faas-cli describe cows\nName: cows\nStatus: Not Ready\nReplicas: 0\nAvailable replicas: 0\nInvocations: 0\nImage:\nFunction process: node show_cow.js\nURL: http:\/\/192.168.64.4:8080\/function\/cows\nAsync URL: http:\/\/192.168.64.4:8080\/async-function\/cows\nLabels:Annotations:%\n<\/code><\/pre>\nLets invoke it!<\/p>\n
$ echo verbose | faas-cli invoke cows\n (__)\n (oo)\n \/-------\\\/\n \/ \/ \\\n* \/\/------\\\\\n ^ ^\n Cow jogging\n<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"Photo by Filip Baoti\u0107 on Unsplash […]<\/p>\n
Read more →<\/a><\/p>\n","protected":false},"author":2,"featured_media":208,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[37],"tags":[36],"yoast_head":"\n100 Days of Learning: Day 1 \u2013 Notion and faas-cli - Andr\u00e9 Jacobs<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n