3

I have a geoprocessing service published from a tool written in Python and contained inside a Python toolbox.

I need to be able to publish this service in multiple environments (production, staging, testing, development) i.e. using different database backends.

I do not want to recreate the service definition package every time I need to move to a different environment.

In particular, I do not have direct access to production and do not want the people deploying the app to need to fire up ArcMap or ArcCatalog and risk some parameter not being set correctly.

Instead, I want to hand them a package and say "Publish this using the connection you created".

How can I accomplish that?

Edit:

Thanks to another question, I've run across this piece of documentation here:

If you are currently disconnected from the server or do not have access to a server connection, you can configure your service definition with no available connection to ArcGIS Server. Selecting this option creates a service definition file that will have to be configured to work with a server connection at the time of publishing.

So it seems to me that ESRI says this is possible, unless I've misinterpreted something.

3

You can open the service definition (SD) and modify the script content by doing the following:

Using 7-zip (note: WinZip won't work)...

  1. Right-click on the SD file and select "Open archive"
  2. In 7-Zip File Manager, go to v101 > arcgis (you will find you python script)
  3. Drag & drop the modified python script
  4. Click "Yes" to the prompt asking "Are you sure you want to copy files to archive"
  5. Close the 7-Zip File Manager (i.e. File > Exit)

Please note that if you try to extract, modify the script, re-compress, and rename the file to .sd you will corrupt the SD file.

  • So you're saying that packages are useless for redistribution when there are any differences between enviornments? – jpmc26 Jun 18 '14 at 9:11
  • 2
    By the way, you can recompress an sd file. You have to use the right compression options. Options that work for me are Format: 7z, Word Size: 16, Solid Block size: Non-solid. I also set Dictionary Size to 64KB, but I don't think that matters. All other options were left to their defaults. (I made some educated guesses based on the fact 7-zip reports the compression method as "LZMA:16" for an sd file.) – jpmc26 Jun 18 '14 at 10:51
  • @jpmc26 I am not saying that packages are useless for redistribution when there are any differences between environment. ArcGIS Help (resources.arcgis.com/en/help/main/10.2/index.html#//…) state "The key to deploying services in multiple environments is to register your folders and databases correctly with ArcGIS Server and use service definitions (SDs) for publishing.". I am just offering a way to simplify the steps for the deployment people. Also, good to know about repackaging. – ericchiasson Jun 18 '14 at 12:25
  • @jpmc26 I am trying to uncompress and recompress both the msd and sd file so as to tweak some things I want. I use 7z from command line like this 7za a -t7z -m0=lzma -md=64k -ms=off %MAP_NAME_MXD%.7z * and then rename my file to myfile.sd and myfile.msd . SInce I have a problem publishing the tweaked service I would kindly request you to provice the zip configuration that you are using – Smalis Nov 18 '14 at 11:16
  • @Smalis That sounds like it warrants another question. Why not post what you're doing and the behavior you're seeing? You can leave me a comment and I'll look at it. – jpmc26 Nov 18 '14 at 17:44
1

Based on my understanding of your question, lets say you, the tool developer have this (I'll assume you're talking enterprise gdb as the data input)

Local machine where you're building your result has a connection to local.sde The AGS machine you want to publish the service to needs to make use of AGS_SDE.sde When you run the tool locally, point it at local.sde. Then your datastore setup is pretty straight forward, local and server connections to those respective SDE repositories.

Now you want to hand off the SD file. These people who will publish your SD just need to match the .SDE connection that you used when creating the .SD file. They setup their datastore to point at the same local.sde that you used and put the Server as whatever SDE is appropriate for their environment. They just need to "match" in their datastore entry where the data came from and tell it how to update the connection paths for the final product to be deployed to Server.

  • 1
    I'm unclear on what exactly has to match. When I specify a connection file locally, it's essential a path, e.g. Database Connections\local.sde. What will ArcGIS look for to replace? The file path in my code? A parameter value (perhaps a workspace parameter)? What will it match on the server side? Additionally, are you saying that I need the data store to have different Publisher and Server database connections? My understanding is that this will trigger a data upload, which is not what I need. Sorry. I'm very lost on how to accomplish this, to the point that it's difficult to ask questions. – jpmc26 Jun 18 '14 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.