Copy Web App Builder Application from one portal to another

1276
4
10-18-2023 11:54 AM
shildebrand
Occasional Contributor

Hi everyone,

I have recently created a web app builder application on our development portal, which includes an underlying web map and services published within the same portal.  Does anyone have any recommendations on how to copy all of this to another portal (our production portal) without having to recreate everything from scratch?  I would assume that I will need to republish the same services I was working with in our development portal to our production portal.  But is there a way to point a copy of the development webmap to the new services and then point a copy of the webapp builder application to the new webmap?  Any help or guidance would be greatly appreciated.

Thanks,

0 Kudos
4 Replies
Scott_Tansley
MVP Regular Contributor

have a look at this blog:

https://www.esri.com/arcgis-blog/products/arcgis-enterprise/administration/moving-content-across-tie...

 

Scott Tansley
https://www.linkedin.com/in/scotttansley/
0 Kudos
shildebrand
Occasional Contributor

Thanks Scott, this is a good place to start.  Any idea on how custom widgets and their configurations could be copied over?  It appears that these are not supported with this tool.

0 Kudos
Scott_Tansley
MVP Regular Contributor

They are more 'global' in nature as they can be used across many apps.  You'd have to install them on your prod web server and create the app registrations.  Beyond that you may need to update the JSON to change the URLs to point to prod.  I am unclear as to if that is automated, but my gut says no.  

This tool - https://assistant.esri-ps.com/signin - should be able to help you do those minor changes.  

Scott Tansley
https://www.linkedin.com/in/scotttansley/
0 Kudos
ArchitSrivastava
Occasional Contributor II

Hello @shildebrand

I understand the concerns you have but as the item is moving from one ArcGIS Enterprise to another ArcGIS Enterprise, the new Web App will need the items from the Development to Production, they would most definitely change.

However, I have another approach which you can try and check if it works for you. I have used ArcGIS API for Python in past to make this and similar this work, kindly find the sample below:

  • Install Required Libraries: Make sure you have the ArcGIS Python API installed. e.g. pip install arcgis
  • Import required modules:
    • from arcgis.gis import GIS
  • Authenticate to the development 
  • Authenticate to the Production 
  • Clone Web Map and Services: Clone the web map and services from the development to the production environment.
    • Clone the web map from development to production
      • web_map_item = dev_gis.content.get("web_map_item_id")
      • web_map_item.clone(copy_data=True, folder="Production")
  • Clone the Web App Configuration: To ensure widget configurations are maintained, clone the Web AppBuilder application's configuration.
    • service_item = dev_gis.content.get("service_item_id")
    • service_item.clone(copy_data=True, folder="Production")
  • Find the Web AppBuilder application in your development environment
    • web_app_item = dev_gis.content.get("web_appbuilder_app_item_id")
    • prod_web_app_item = web_app_item.clone(
      folder="Production",
      copy_data=True,
      search_existing_items=True
      )
  • Update References in the Production Configuration: Since we've cloned the Web AppBuilder application with its original configuration, We will need to update references to the web map and services that we cloned earlier. In our production configuration, find the references to the development environment's items and replace them with the new item IDs generated during the cloning process.
    • Update web map references in the cloned app configuration
      • app_config = prod_web_app_item.get_data()
      • app_config['values']['webmap'] = "<new_web_map_id>"
  • Update service references in the cloned app configuration. Iterate through the widgets and update the relevant widget configurations
    • for widget in app_config['widgets']:
      if 'itemId' in widget:
      widget['itemId'] = "<new_service_item_id>"
  • Update and save the modified configuration
    • prod_web_app_item.update(data=app_config)

Once you do the above steps the new Web Application should be present in Production with reference to production Web Map and Service configuration. I would recommend that after updating the web app's configuration, thoroughly test it in the production environment to ensure that everything is working as expected. Be sure to verify that widget configurations have been correctly transferred.

Furthermore, you can also use https://ago-assistant.esri.com/ to compare the JSON of the Development item and Production item to make sure no reference are there from Development

Additionally, If your application uses custom URLs, ensure that DNS and URL references are updated to point to the production environment.

This preserves the widget configurations while migrating your Web AppBuilder application, web map, and services to the production environment. 

Hope it helps!

-Archit

 

 

0 Kudos