Select to view content in your preferred language

Correct way to automate publishing of services to portal or portal federated servers?

2704
2
03-04-2021 06:40 AM
LorenzMeyer1
Regular Contributor

Hi

I'm currently looking for "the correct way" on how to publish services to portal or to a portal federated servers (like an imageserver).

For example I have a mosaic dataset and I would like to create a service with it on my imageserver, which is federated with my portal. In ArcGIS Pro there I select my mosaic dataset and then I click "Share as weblayer". The connection is then read from the active portal (manage portals in ArcGIS Pro). I can then select my image server to host the service.

What is the "correct" way to automate this process with python (arcpy or python api for arcgis)? What I have so far:

  • Create an *.ags connection file to the arcgis server (imageserver) - This I had to do manually. There seems no function to create a connection file with python 3.x (ArcGIS Pro)
  • arcpy.CreateImageSDDraft --> Create service draft file with connection file created above
  • arcpy.StageService --> Create service definition file from sddraft
  • arcpy.UploadServiceDefinition_server --> Upload the service to the imageserver. An item in portal is automatically created, but I don't get the itemId in return of this function. I have to search the content of the portal to find the newly created item by title. Is there a better way to upload it to portal?
  • Use the GIS object from the python api for arcgis an establish a portal connection
  • Search portal content for newly created item
  • Update the found item with tags, description and so on..
  • Share the item to public or to the organisation

The whole process is mix between arcpy and python api for arcgis and I don't know if this is the way to go? And not all necessary function are available (CreateServer Connection File) in python 3.x .

When to use arcpy and when to use the new python api for arcgis?

Any ideas or tipps? Searching the examples didn't really help.

 

0 Kudos
2 Replies
Todd_Metzler
Frequent Contributor

Hello,

My Environment:  ArcGIS Enterprise 10.8.1 single stack full, Windows server 2012R2.

It's difficult to define "correct".  Many options.  Can you lay out your environment to help define solutions that might work for you.

But 1st, based on your single scenario, why automate service publishing?  Once you've published an image service type, if you add or subtract content from the source Mosaic Data Set (MDS) and rebuild statistics and overviews without any other changes, then the service doesn't need to be republished.  At most, if you don't want to wait for recycle time, you may have to stop and restart the service.  The scenario changes, of course if you chose to publish a Map service type and you selected the option to copy data to the Data Store.

 

0 Kudos
LorenzMeyer1
Regular Contributor

ArcGIS Enterprise 10.8.1, Windows Server 2016

  • 1 Server with Apache Tomcat and Java WebAdaptor for portal, portalsite (arcgis server HOSTING), imagesite (arcgis server)
  • 1 Server with portal (ArcGIS Portal, ArcGIS Server, ArcGIS Data Store (Relational + TileCache)
  • 1 Server (ArcGIS Server) licensed with ImageServer and federated as RasterAnalytics function into portal

The scenario is easy:

We have 4 environments running the architecture described above and we have a lot of drone flights to process (raster files) and therefore we need an automated process to process those files and automatically publish them as service. Doing it manually is no option and error-prone. 

 

0 Kudos