You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/service-fabric/service-fabric-deploy-existing-app.md
+33-7Lines changed: 33 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,16 +3,18 @@ title: Deploy an existing executable to Azure Service Fabric
3
3
description: Learn how to package an existing application as a guest executable, so it can be deployed to a Service Fabric cluster.
4
4
5
5
ms.topic: conceptual
6
-
ms.date: 07/02/2017
6
+
ms.date: 03/30/2020
7
7
---
8
8
# Package and deploy an existing executable to Service Fabric
9
+
9
10
When packaging an existing executable as a [guest executable](service-fabric-guest-executables-introduction.md), you can choose either to use a Visual Studio project template or to [create the application package manually](#manually). Using Visual Studio, the application package structure and manifest files are created by the new project template for you.
10
11
11
12
> [!TIP]
12
13
> The easiest way to package an existing Windows executable into a service is to use Visual Studio and on Linux to use Yeoman
13
14
>
14
15
15
16
## Use Visual Studio to package and deploy an existing executable
17
+
16
18
Visual Studio provides a Service Fabric service template to help you deploy a guest executable to a Service Fabric cluster.
17
19
18
20
1. Choose **File** > **New Project**, and create a Service Fabric application.
@@ -32,6 +34,13 @@ Visual Studio provides a Service Fabric service template to help you deploy a gu
32
34
33
35
For an example walkthrough, see [Create your first guest executable application using Visual Studio](quickstart-guest-app.md).
34
36
37
+
### Packaging multiple executables with Visual Studio
38
+
39
+
You can use Visual Studio to produce an application package that contains multiple guest executables. After adding the first guest executable, right click on the application project and select the **Add->New Service Fabric service** to add the second guest executable project to the solution.
40
+
41
+
> [!NOTE]
42
+
> If you choose to link the source in the Visual Studio project, building the Visual Studio solution, will make sure that your application package is up to date with changes in the source.
43
+
35
44
## Use Yeoman to package and deploy an existing executable on Linux
36
45
37
46
The procedure for creating and deploying a guest executable on Linux is the same as deploying a csharp or java application.
@@ -42,24 +51,30 @@ The procedure for creating and deploying a guest executable on Linux is the same
42
51
43
52
Yeoman creates an application package with the appropriate application and manifest files along with install and uninstall scripts.
44
53
54
+
### Packaging multiple executables using Yeoman on Linux
55
+
56
+
To add another service to an application already created using `yo`, perform the following steps:
57
+
58
+
1. Change directory to the root of the existing application. For example, `cd ~/YeomanSamples/MyApplication`, if `MyApplication` is the application created by Yeoman.
59
+
2. Run `yo azuresfguest:AddService` and provide the necessary details.
60
+
45
61
<aid="manually"></a>
46
62
47
63
## Manually package and deploy an existing executable
64
+
48
65
The process of manually packaging a guest executable is based on the following general steps:
49
66
50
67
1. Create the package directory structure.
51
68
2. Add the application's code and configuration files.
52
69
3. Edit the service manifest file.
53
70
4. Edit the application manifest file.
54
71
55
-
<!--
56
-
>[AZURE.NOTE] We do provide a packaging tool that allows you to create the ApplicationPackage automatically. The tool is currently in preview. You can download it from [here](https://aka.ms/servicefabricpacktool).
57
-
-->
58
-
59
72
### Create the package directory structure
73
+
60
74
You can start by creating the directory structure, as described in [Package an Azure Service Fabric App](https://docs.microsoft.com/azure/service-fabric/service-fabric-package-apps).
61
75
62
76
### Add the application's code and configuration files
77
+
63
78
After you have created the directory structure, you can add the application's code and configuration files under the code and config directories. You can also create additional directories or subdirectories under the code or config directories.
64
79
65
80
Service Fabric does an `xcopy` of the content of the application root directory, so there is no predefined structure to use other than creating two top directories, code and settings. (You can pick different names if you want. More details are in the next section.)
@@ -70,6 +85,7 @@ Service Fabric does an `xcopy` of the content of the application root directory,
70
85
>
71
86
72
87
### Edit the service manifest file
88
+
73
89
The next step is to edit the service manifest file to include the following information:
74
90
75
91
* The name of the service type. This is an ID that Service Fabric uses to identify a service.
@@ -109,6 +125,7 @@ The following is an example of a `ServiceManifest.xml` file:
109
125
The following sections go over the different parts of the file that you need to update.
@@ -128,6 +145,7 @@ The CodePackage element specifies the location (and version) of the service's co
128
145
The `Name` element is used to specify the name of the directory in the application package that contains the service's code. `CodePackage` also has the `version` attribute. This can be used to specify the version of the code, and can also potentially be used to upgrade the service's code by using the application lifecycle management infrastructure in Service Fabric.
129
146
130
147
#### Optional: Update SetupEntrypoint
148
+
131
149
```xml
132
150
<SetupEntryPoint>
133
151
<ExeHost>
@@ -142,6 +160,7 @@ There is only one SetupEntryPoint, so setup scripts need to be grouped in a sing
142
160
In the preceding example, the SetupEntryPoint runs a batch file called `LaunchConfig.cmd` that is located in the `scripts` subdirectory of the code directory (assuming the WorkingFolder element is set to CodeBase).
143
161
144
162
#### Update EntryPoint
163
+
145
164
```xml
146
165
<EntryPoint>
147
166
<ExeHost>
@@ -166,12 +185,14 @@ The `ExeHost` element specifies the executable (and arguments) that should be us
166
185
The WorkingFolder is useful to set the correct working directory so that relative paths can be used by either the application or initialization scripts.
167
186
168
187
#### Update Endpoints and register with Naming Service for communication
In the preceding example, the `Endpoint` element specifies the endpoints that the application can listen on. In this example, the Node.js application listens on http on port 3000.
176
197
177
198
Furthermore you can ask Service Fabric to publish this endpoint to the Naming Service so other services can discover the endpoint address to this service. This enables you to be able to communicate between services that are guest executables.
@@ -184,9 +205,11 @@ In the following example, once the service is deployed, in Service Fabric Explor
You can use these addresses with [reverse proxy](service-fabric-reverseproxy.md) to communicate between services.
188
210
189
211
### Edit the application manifest file
212
+
190
213
Once you have configured the `Servicemanifest.xml` file, you need to make some changes to the `ApplicationManifest.xml` file to ensure that the correct service type and name are used.
191
214
192
215
```xml
@@ -199,6 +222,7 @@ Once you have configured the `Servicemanifest.xml` file, you need to make some c
199
222
```
200
223
201
224
#### ServiceManifestImport
225
+
202
226
In the `ServiceManifestImport` element, you can specify one or more services that you want to include in the app. Services are referenced with `ServiceManifestName`, which specifies the name of the directory where the `ServiceManifest.xml` file is located.
203
227
204
228
```xml
@@ -208,6 +232,7 @@ In the `ServiceManifestImport` element, you can specify one or more services tha
208
232
```
209
233
210
234
## Set up logging
235
+
211
236
For guest executables, it is useful to be able to see console logs to find out if the application and configuration scripts show any errors.
212
237
Console redirection can be configured in the `ServiceManifest.xml` file using the `ConsoleRedirection` element.
213
238
@@ -236,6 +261,7 @@ Console redirection can be configured in the `ServiceManifest.xml` file using th
236
261
Log files are saved in one of the service's working directories. To determine where the files are located, use Service Fabric Explorer to determine which node the service is running on, and which working directory is being used. This process is covered later in this article.
237
262
238
263
## Deployment
264
+
239
265
The last step is to [deploy your application](service-fabric-deploy-remove-applications.md). The following PowerShell script shows how to deploy your application to the local development cluster, and start a new Service Fabric service.
240
266
241
267
```powershell
@@ -276,14 +302,14 @@ If you navigate to the node and browse to the application, you see the essential
276
302
277
303

278
304
279
-
If you browse to the directory by using Server Explorer, you can find the working directory and the service's log folder, as shown in the following screenshot:
305
+
If you browse to the directory by using Server Explorer, you can find the working directory and the service's log folder, as shown in the following screenshot:
280
306
281
307

282
308
283
309
## Next steps
310
+
284
311
In this article, you have learned how to package a guest executable and deploy it to Service Fabric. See the following articles for related information and tasks.
285
312
286
313
*[Sample for packaging and deploying a guest executable](https://github.com/Azure-Samples/service-fabric-dotnet-getting-started), including a link to the prerelease of the packaging tool
287
314
*[Sample of two guest executables (C# and nodejs) communicating via the Naming service using REST](https://github.com/Azure-Samples/service-fabric-containers)
0 commit comments