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
+19-2Lines changed: 19 additions & 2 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.
@@ -45,6 +47,7 @@ Yeoman creates an application package with the appropriate application and manif
45
47
<aid="manually"></a>
46
48
47
49
## Manually package and deploy an existing executable
50
+
48
51
The process of manually packaging a guest executable is based on the following general steps:
49
52
50
53
1. Create the package directory structure.
@@ -57,9 +60,11 @@ The process of manually packaging a guest executable is based on the following g
57
60
-->
58
61
59
62
### Create the package directory structure
63
+
60
64
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
65
62
66
### Add the application's code and configuration files
67
+
63
68
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
69
65
70
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 +75,7 @@ Service Fabric does an `xcopy` of the content of the application root directory,
70
75
>
71
76
72
77
### Edit the service manifest file
78
+
73
79
The next step is to edit the service manifest file to include the following information:
74
80
75
81
* The name of the service type. This is an ID that Service Fabric uses to identify a service.
@@ -109,6 +115,7 @@ The following is an example of a `ServiceManifest.xml` file:
109
115
The following sections go over the different parts of the file that you need to update.
@@ -128,6 +135,7 @@ The CodePackage element specifies the location (and version) of the service's co
128
135
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
136
130
137
#### Optional: Update SetupEntrypoint
138
+
131
139
```xml
132
140
<SetupEntryPoint>
133
141
<ExeHost>
@@ -142,6 +150,7 @@ There is only one SetupEntryPoint, so setup scripts need to be grouped in a sing
142
150
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
151
144
152
#### Update EntryPoint
153
+
145
154
```xml
146
155
<EntryPoint>
147
156
<ExeHost>
@@ -166,12 +175,14 @@ The `ExeHost` element specifies the executable (and arguments) that should be us
166
175
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
176
168
177
#### 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
187
177
188
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 +195,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
200
189
201
### Edit the application manifest file
202
+
190
203
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
204
192
205
```xml
@@ -199,6 +212,7 @@ Once you have configured the `Servicemanifest.xml` file, you need to make some c
199
212
```
200
213
201
214
#### ServiceManifestImport
215
+
202
216
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
217
204
218
```xml
@@ -208,6 +222,7 @@ In the `ServiceManifestImport` element, you can specify one or more services tha
208
222
```
209
223
210
224
## Set up logging
225
+
211
226
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
227
Console redirection can be configured in the `ServiceManifest.xml` file using the `ConsoleRedirection` element.
213
228
@@ -236,6 +251,7 @@ Console redirection can be configured in the `ServiceManifest.xml` file using th
236
251
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
252
238
253
## Deployment
254
+
239
255
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
256
241
257
```powershell
@@ -276,11 +292,12 @@ If you navigate to the node and browse to the application, you see the essential
276
292
277
293

278
294
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:
295
+
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
296
281
297

282
298
283
299
## Next steps
300
+
284
301
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
302
286
303
*[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
0 commit comments