You can run the Fn client on Windows 10 Professional and connect to a remote Fn server. This document provides the steps to make that happen.
To install Fn on Windows, you need the following software:
- Windows 10 Professional 64 bit Enterprise, or Education (Build 15063 or later)
- This is a requirement for Docker
- Docker Desktop for Windows (2.1.0.1 +)
- Microsoft Hyper-V and Containers support installed
Links to the get all this installed are provided below.
Fn client requires Docker Desktop for Windows to run. Here are some links to for installing Docker.
To install Docker, you have to have all of the following.
- Virtualization enabled in your laptop's BIOS. See the documentation from your manufacturer for this step.
- Windows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later).
- Enable the Hyper-V and Containers features for Windows 10 Professional.
These are the steps to install Docker.
- Make sure Virtualization is enabled on your laptop.
- Enable Hyper-V and Containers features for Windows 10. See: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
- Perform the Docker install. See: https://docs.docker.com/docker-for-windows/install/.
- Setup a DockerHub account. This is required to store Docker images on the net.
With Docker installed, you are ready to install the Fn client.
There are three ways to install the Fn client on Windows.
- Go to: https://github.com/fnproject/cli/releases
- Download the latest
fn.exe
. - Copy the file into the
C:\Windows
directory.
The Fn client is now in your PATH
and ready to go.
If your IT department has locked you out of your system directories, then there are more steps for you to do.
- Go to: https://github.com/fnproject/cli/releases
- Download the latest
fn.exe
. - Create a directory for Fn.
cd c:\
mkdir fn
- Copy
fn.exe
to that directory. - Add your new directory to the path.
- Right-click the Start menu.
- Select System.
- Scroll down in the main window and Click on the link System Info.
- In the System dialog box, click Advanced system settings.
- On the Advanced tab of the System Properties dialog box, click Environment Variables.
- In the System Variables box of the Environment Variables dialog box, scroll to Path and select it.
- Click the lower of the two Edit buttons in the dialog box.
- Click the New button.
- Enter in your directory name
c:\fn
. - Click the OK button.
- Click OK in three successive dialog boxes, and the System dialog box closes.
Now when you open a Windows Command Prompt, the Fn client should be in the path.
The Linux subsystem for Windows is now a standard feature of Windows as of build 16215. The Linux Fn client runs fine in the subsystem. To install the Fn client do the following:
- Install the Linux subsystem for Windows. See: https://docs.microsoft.com/en-us/windows/wsl/install-win10
- After your distribution is installed, perform the Fn installation as normal.
Fn should work just like it does on Linux or MacOS.
Next you need to setup an Fn server on another machine or virtual machine. See the fn tutorials for information on starting the server. The machine must be accessible on the network from your client machine.
Next you need to configure your Fn client to connect to the machine running Fn server.
You need to configure you context to point at DockerHub and your Fn server.
(1) Look at your context: fn list context
CURRENT NAME PROVIDER API URL REGISTRY
default default http://localhost:8080
(2) Select the default context: fn use context default
Response: Now using context: default
(3) Change your API context to point to your sever machine:
fn update context api-url http://host.example.com:8080
Response: Current context updated api-url with http://host.example.com:8080
(4) Set your DockerHub user id: fn update context registry <your-dockerhub-id>
Response: Current context updated registry with <your-dockerhub-id>
(5) Check your context: fn list context
CURRENT NAME PROVIDER API URL REGISTRY
* default default http://host.example.com:8080 <your-dockerhub-id>
(6) You are all Set. You should be able to make apps, and invoke and deploy functions just like normal. Just open a Command Prompt window rather than a Terminal window. Just follow the tutorial of your choice at: https://fnproject.io/tutorials/.
Text quoting is different in Windows. For example, from a Command Prompt window to pass JSON data to your function the command looks like this:
echo {"name":"bob"} | fn invoke nodeapp nodefn
You have installed Docker on Windows and the Fn client. You can now connect your Windows machine to an Fn server running on a different machine.