Skip to content

Commit d535968

Browse files
authored
Merge pull request #179882 from sunil-indoria/wsl2devExperience
added documentation for WSL2 Linux Local Cluster Setup
2 parents 6bfe23d + 5096bbf commit d535968

File tree

4 files changed

+133
-0
lines changed

4 files changed

+133
-0
lines changed

articles/service-fabric/service-fabric-get-started-linux.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ms.custom: devx-track-js
1010
# service-fabric-get-started-linux.md
1111
# service-fabric-get-started-mac.md
1212
# service-fabric-local-linux-cluster-windows.md
13+
# service-fabric-local-linux-cluster-windows-wsl2.md
1314
---
1415
# Prepare your development environment on Linux
1516
> [!div class="op_single_selector"]
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: Set up Azure Service Fabric Linux cluster on WSL2 linux distribution inside Windows
3+
description: This article covers how to set up Service Fabric Linux clusters inside WSL2 linux distribution running on Windows development machines. This approach is useful for cross-platform development.
4+
5+
ms.topic: conceptual
6+
ms.date: 10/31/2021
7+
8+
# Maintainer notes: Keep these documents in sync:
9+
# service-fabric-get-started-linux.md
10+
# service-fabric-get-started-mac.md
11+
# service-fabric-local-linux-cluster-windows.md
12+
# service-fabric-local-linux-cluster-windows-wsl2.md
13+
---
14+
# Set up a Linux Service Fabric cluster via WSL2 on your Windows developer machine
15+
16+
This document covers how to set up a local Linux Service Fabric cluster via WSL2 on a Windows development machine. Setting up a local Linux cluster is useful to quickly test applications targeted for Linux clusters but are developed on a Windows machine.
17+
18+
## Prerequisites
19+
Linux based Service Fabric clusters do not run directly on Windows, but to enable cross-platform prototyping we have provided a way to deploy Service Fabric Cluster inside Linux distribution via WSL2 (Windows Subsystem for Linux) for Windows.
20+
21+
Before you get started, you need:
22+
23+
* WSL2 Set up in Windows and ensure WSL 2 as default version
24+
* Set up Ubuntu 18.04 Linux Distribution from Microsoft Store while setting up WSL2
25+
26+
>[!TIP]
27+
> To install WSL2 on your Windows machine, follow the steps in the [WSL documentation](https://docs.microsoft.com/windows/wsl/install). After installing, please ensure installation of Ubuntu-18.04, make it your default distribution and it should be up and running.
28+
>
29+
30+
## Set up Service Fabric SDK inside Linux Distribution
31+
Service Fabric Setup cannot be done in WSL2 Linux Distribution the way it is done in standard linux OS. Because systemd as PID1 is not running inside VM and systemd as PID1 is a prerequisite for SF SDK to work successfully.
32+
To enable systemd as PID1, systemd-genie is used as work-around. More details about systemd-genie can be found at [systemd genie setup](https://github.com/arkane-systems/genie) Script installation and manual installation steps cover installation of systemd-genie and service fabric sdk both.
33+
34+
## Script installation
35+
36+
For convenience, a script is provided to install the Service Fabric common SDK along with the [**sfctl** CLI](service-fabric-cli.md). Running the script assumes you agree to the licenses for all the software that is being installed. Alternatively you may run the [Manual installation](#manual-installation) steps in the next section, which will present associated licenses and the components being installed.
37+
38+
After the script runs successfully, you can skip to [Set up a local cluster](#set-up-a-local-cluster).
39+
40+
```bash
41+
sudo curl -s https://raw.githubusercontent.com/Azure/service-fabric-scripts-and-templates/master/scripts/SetupServiceFabric/SetupServiceFabric.sh | sudo bash
42+
```
43+
44+
## Manual installation
45+
For manual installation of the Service Fabric runtime and common SDK, follow the rest of this guide.
46+
47+
1. Open a terminal.
48+
49+
2. Login into WSL2 Linux Distribution
50+
51+
3. Set up systemd-genie as mentioned in [systemd genie setup](https://github.com/arkane-systems/genie) (if systemd-genie is already set up, you can jump to next step)
52+
53+
4. Enter into genie namespace using genie -s
54+
55+
5. Inside genie namespace, SF SDK can also be installed as mentioned under Script Installation or Manual Installation steps in [Set up a linux local cluster](service-fabric-get-started-linux.md)
56+
57+
6. Provide sudo privileges to current user by making an entry (e.g. <USERNAME> ALL = (ALL) NOPASSWD:ALL) in /etc/sudoers
58+
59+
## Set up a local cluster
60+
Service Fabric inside WSL2 VM is recommended to manage from host windows
61+
62+
1. Install Service Fabric SDK (version 6.0 or above) in Windows host
63+
64+
2. In Windows, cluster can be managed using ServiceFabricLocalClusterManager tool provided as part of SF SDK
65+
66+
3. Option to manage Linux Local Cluster is enabled only when a. WSL2 VM is running, b. Systemd-genie, servicefabricruntime, and servicefabricsdkcommon packages are properly installed inside VM and c. Systemd-genie is in running state. You can set up or switch to Linux Local Cluster from this tool.
67+
68+
4. Another way of setting up linux cluster is to deploy using cluster setup scripts provided as part SF SDK.
69+
70+
5. Open a web browser and go to Service Fabric Explorer ``http://localhost:19080``. When the cluster starts, you see the Service Fabric Explorer dashboard. It might take several minutes for the cluster to be set up.
71+
If your browser fails to open the URL or Service Fabric Explorer doesn't show the cluster, wait for a few minutes and try again. You can also see the cluster in ServiceFabricExplorer provided in SF SDK.
72+
73+
6. Once Cluster is up and running, you can connect to local cluster in PowerShell and Visual Studio.
74+
75+
76+
## Manual installation with custom ServiceFabric and ServieFabricSdkCommon Debian Package
77+
For manual installation of the Service Fabric from custom or downloaded debian packages, follow the rest of this guide.
78+
79+
1. Open a terminal.
80+
81+
2. Login into WSL2 Linux Distribution
82+
83+
3. Clone set up file
84+
85+
```bash
86+
sudo curl -s https://raw.githubusercontent.com/Azure/service-fabric-scripts-and-templates/master/scripts/SetupServiceFabric/SetupServiceFabric.sh > SetupServiceFabric.sh
87+
```
88+
89+
4. Make the file executable
90+
91+
```bash
92+
sudo chmod +x SetupServiceFabric.sh
93+
```
94+
95+
5. Run set up script with local debian packages path. Make sure that paths provided are valid. Below is an example:
96+
97+
```bash
98+
sudo ./SetupServiceFabric.sh --servicefabricruntime=/mnt/c/Users/testuser/Downloads/servicefabric.deb --servicefabricsdk=/mnt/c/Users/testuser/Downloads/servicefabric_sdkcommon.deb
99+
```
100+
101+
102+
### Known Limitations
103+
104+
The following are known limitations of the local cluster running inside Linux Distribution:
105+
106+
* Currently Ubuntu-18.04 distribution is only supported.
107+
* To have a seamless experience with Local Cluster Manager and Visual Studio, it is recommended to manage cluster from PowerShell scripts or LocalClusterManager in Windows host.
108+
109+
### Frequently Asked Questions
110+
111+
1. What linux distributions are supported for SF Local Cluster Set up?
112+
Currently, only Ubuntu-18.04 is supported for linux local cluster.
113+
114+
2. Can Windows and Linux SF Cluster be run in parallel with WSL2 setup?
115+
No, at one time only one local cluster can be run either in host or in guest VM.
116+
117+
3. How to deploy one node linux local cluster?
118+
One node or five node linux local cluster can be deployed from Local Cluster Manager from the menu options. While deploying from setup script, five node cluster is deployed by default and for one node cluster CreateOneNodeCluster should be passed.
119+
120+
4. How to connect to Linux Local Cluster in PowerShell and Visual Studio?
121+
If linux local cluster is up and running, connect-servicefabriccluster cmdlet should automatically connect to this cluster. Similar Visual Studio will automatically detect this local cluster.
122+
This cluster can also be connected by providing cluster endpoint in PowerShell or visual studio.
123+
124+
5. Where is SF Cluster data is located for linux local cluster?
125+
If using Ubuntu-18.04 distribution, SF data is located at \\wsl$\Ubuntu-18.04\home\sfuser\sfdevcluster from Windows host.
126+
127+
## Next steps
128+
* Learn about [Service Fabric support options](service-fabric-support.md)

articles/service-fabric/service-fabric-local-linux-cluster-windows.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ms.date: 10/16/2020
99
# service-fabric-get-started-linux.md
1010
# service-fabric-get-started-mac.md
1111
# service-fabric-local-linux-cluster-windows.md
12+
# service-fabric-local-linux-cluster-windows-wsl2.md
1213
---
1314
# Set up a Linux Service Fabric cluster on your Windows developer machine
1415

@@ -128,6 +129,7 @@ To set up a local Docker container and have a Service Fabric cluster running on
128129
* Running container-based apps requires running SF on a Linux host. Nested container applications are currently not supported.
129130

130131
## Next steps
132+
* [Set up a Linux cluster on Windows via WSL2](service-fabric-local-linux-cluster-windows-wsl2.md)
131133
* [Create and deploy your first Service Fabric Java application on Linux using Yeoman](service-fabric-create-your-first-linux-application-with-java.md)
132134
* Get started with [Eclipse](./service-fabric-get-started-eclipse.md)
133135
* Check out other [Java samples](https://github.com/Azure-Samples/service-fabric-java-getting-started)

articles/service-fabric/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@
473473
href: service-fabric-diagnostics-how-to-monitor-and-diagnose-services-locally.md
474474
- name: Set up a Linux cluster on Windows
475475
href: service-fabric-local-linux-cluster-windows.md
476+
- name: Set up a Linux cluster on Windows via WSL2
477+
href: service-fabric-local-linux-cluster-windows-wsl2.md
476478
- name: Deploy a .NET Core app to a remote Linux cluster from VS
477479
href: service-fabric-how-to-publish-linux-app-vs.md
478480
- name: Work in a Linux/Eclipse dev environment

0 commit comments

Comments
 (0)