Replicate a service into another ArcGIS server

2308
3
01-20-2021 07:36 PM
by Anonymous User
Not applicable
6 3 2,308

There are normally different stages while implementing a big IT system/project, and those stages always come with its own working environments, e.g development, UAT, Prod etc.  It would be necessary to populate contents produced in one environment into another.

Coming to a gis project built upon on ArcGIS for server in the above scenario, ArcGIS services are undoubtedly are among those contents which needed to move across different environments.

Therefore this article is going to demonstrate an approach we're using quickly to replicate a service(Map/Feature/Gp/Locator) from one environment into another.  In this case, we're going to :

  1. Replicate a service originally published in Dev into Sandpit
  2. Dev and Sandpit has a different database, the replicate service use its own data source
  3. Software: ArcGIS Pro 2.5.1 and ArcGIS Enterprise 10.7.1  

Steps:

1. Publish a service and apply configuration in Dev

This step is a typical step for service publishing.

Opening an ArcGIS Pro project file -> Publish web layers 

Note: In this step, try to set Configuration here(see the screenshot below) as much as you can, as all the Configuration set here will be saved into SD file(.sd) which will be brought automatically into other environments.

Capture.PNG

 
 

2. Generate service definition file 

To replicate the above service, there is no magic but to pack everything necessary for service into the service definition file (.sd). 

After we successfully published the service in Dev,  ArcGIS Pro keeps the interim files i.e Service Definition Draft(.sddraft) for each publishing in the staging folder. However, .sddraft is environment depended and can't be re-used into another environment, but it could be re-used to generated publishing artefacts i.e Service Definition( .sd) .  By default, the .sddraft could be found with the location:

C:\Users\{mjiang}\AppData\Local\ESRI\ArcGISPro\Staging\SharingProcesses\{00001}

The .sddraft can be converted into .sd by using the GP tool Stage Service

3. Register datastore

Now, we got a SD file from Dev but the database connection in this SD is still pointing to the Dev database.  ArcGIS Server provides a mechanism that automatically replaces the publisher database connection with the server database connection when the service starts, as long as the publisher/server database connection registered in the ArcGIS Server of Sandpit in our case: 

Capture.PNG

4. Re-publish the service in Sandpit

With the generated SD file, and the datastore registered, we can replicate service in Sandpit by log into ArcGIS server manager and choose to publish service. 

Capture.PNG

So the service and the configuration settings are picked up automatically in Sandpit. 

Conclusion: 

The above process is simplified, actually in the real scenario, there are other requirements that need to be considered, like: 

1. How to sync the service configuration after service published

2. how to sync the portal items  associated with the services 

 

we ended with developing a bunch of scripts that automate the whole process. 

 

 

 

3 Comments