# as administrator#.1 Download the Python 2.7.9 installation package from the browser, choosing the best suitable distribution accordingly to the OShttps://www.python.org/downloads/release/python-279/
#.2 Define the following System Environment VariablesPATH=%PATH%;C:\Python27;C:\Python27\Scripts
PYTHONPATH=.\;C:\Python27;C:\work\RemoteWPS
其他必需的Python包
# as administrator# From a Command Line prompt
$>pipinstallwps-remote==2.11.0
# Edit the file xmpp_data/configs/remote.config[DEFAULT]bus_class_name=xmppBus.XMPPBus
port=5223address=127.0.0.1
domain=geoserver.org
# . Those are the connection parameters to the XMPP Server.# . The user must exists on the Server and its name must be# . equal to the service name.user=default.GdalContour
password=R3m0T3wP5
mucService=conference.%(domain)s
mucServicePassword=admin
resource_file_dir=/share/xmpp_data/resource_dir
# . Configure this option (along with 'backup_on_wps_execution_shared_dir'# . on single outputs of 'service.config') in order to make a copy# . of the results into a shared folder before sending messages to XMPP# . WARNING: this option takes precedence on "UPLOADER" option# wps_execution_shared_dir = /share/xmpp_data/share# . This section is used to configure the uploader class and connection# . parameters.# . This is necessary in order to let the 'upload_data' option work on# . single outputs of 'service.config'[UPLOADER]# There are different implementations of the FTP Uploader available right now:# . Plain standard FTP Protocol (based on ftplib)# ftpUpload.FtpUpload# . FTP over TLS (FTPS) Protocol (based on ftplib)# ftpsUpload.FtpsUpload# . S-FTP Protocol (based on paramiko Python lib)# sftpUpload.SFtpUploaduploader_class_name=ftpUpload.FtpUpload
uploader_host=ftp.<your_host_here>:<your_port_here_default_21>
uploader_username=<ftp_username>
uploader_password=<ftp_password_encrypted>
# . "encryptor" you can use encrypted passwords with a private/public key couple## . To generate a new private key use the following command:# openssl genrsa -out myTestKey.pem -passout pass:"f00bar" -des3 2048## . To generate a new public key use the following command:# openssl rsa -pubout -in myTestKey.pem -passin pass:"f00bar" -out myTestKey.pub## . To encrypt your password use the following utility# python encrypt.py password path/to/rsakey.pub passphrase## . To double check the password is correct use the following utility# python decrypt.py password path/to/rsakey.pem passphraseuploader_private_rsa_key=/share/xmpp_data/ssl/myTestKey.pem
uploader_passphrase=f00bar
# Edit the file xmpp_data/configs/myservice/service.config# This is a INI file to be read with python ConfigParser (https://docs.python.org/2/library/configparser.html)# Is possible to reference another variable in the ini file using the format %(<variable name>)s (note the 's' at the end)# ########################################### ## Default Service Params ## ########################################### #[DEFAULT]service=GdalContour
namespace=default
description=GDALContourRemoteService
executable_path=/share/xmpp_data/configs/myservice/code
executable_cmd=python%(executable_path)s/test.py
output_dir=/share/xmpp_data/output/
unique_execution_id=%(unique_exe_id)s
workdir=%(output_dir)s/%(unique_execution_id)s
active=True
max_running_time_seconds=300# . This option allows you to set the CPU and Memory average load scan time.# . It is espressed in 'minutes' and if disabled here it will be set by default# . to 15 minutes.load_average_scan_minutes=1# . Use this option to completely avoid using this host (and prevent starting a new# . 'processbot') whenever one of the following process names are running.# . In other words, if one of the following processes are currently running on this machine,# . GeoServer won't send any WPS execute request until they are finished.process_blacklist=[resourceconsumingprocessname1,resourceconsumingprocessname2]# ########################################### ## Inputs and Actions Declaration ## ########################################### #[Input1]class=param
name=interval
title=ElevationInterval
type=int
description=Elevationintervalbetweencontours.
min=1max=1default=200[Action1]class=cmdline
input_ref=interval
alias=i
template=-namevalue
[Const1]class=const
name=workdir
type=string
description=Remoteprocesssandboxworkingdirectory
value=%(workdir)s
[Action2]class=cmdline
input_ref=workdir
alias=w
template=-namevalue
# ########################################### ## Output Parameters Declaration ## ########################################### #[Output1]name=result1
type=application/zip
description=WPSResourceBinaryFile
title=SRTM
filepath=%(workdir)s/contour.zip
publish_as_layer=truepublish_default_style=polygon
publish_target_workspace=it.geosolutions
publish_layer_name=contour
# . Enable this option in order to perform a backup of this output# . before sending it to GeoServer.# . WARNING: This option works only along with 'wps_execution_shared_dir'# . option on 'remote.config', and takes precedence on 'upload_data'# backup_on_wps_execution_shared_dir = true# . Enable this option if you want the output to be uploaded on remote host.# . Notice that you must also configure uploader parameters on 'remote.config'# upload_data = true# . Optionally it is possible to specify a root folder if the uploader class supports it.# upload_data_root = /remote-wps/default[Output2]name=result2
type=application/x-netcdf
description=NetCDFBinaryFile
title=flexpart
filepath=%(output_dir)s/flexpart.nc
publish_as_layer=truepublish_default_style=raster
publish_target_workspace=it.geosolutions
publish_layer_name=flexpart
# . Enable this option in order to perform a backup of this output# . before sending it to GeoServer.# . WARNING: This option works only along with 'wps_execution_shared_dir'# . option on 'remote.config', and takes precedence on 'upload_data'# backup_on_wps_execution_shared_dir = true# . Enable this option if you want the output to be uploaded on remote host.# . Notice that you must also configure uploader parameters on 'remote.config'# upload_data = true# . Optionally it is possible to specify a root folder if the uploader class supports it.# upload_data_root = /remote-wps/default[Output3]name=result3
type=application/owc
description=WPSOWCJsonMapContext
layers_to_publish=result2
publish_as_layer=truepublish_layer_name=owc_json_ctx
publish_metadata=/share/xmpp_data/resource_dir/owc_json_ctx.json
# ########################################### ## Logging Options Declaration ## ########################################### #[Logging]stdout_parser=[.*\[DEBUG\](.*),.*\[INFO\]ProgressInfo\:([-+]?[0-9]*\.?[0-9]*)\%,.*\[(INFO)\](.*),.*\[(WARN)\](.*),.*\[(ERROR)\](.*),.*\[(CRITICAL)\](.*)]stdout_action=[ignore,progress,log,log,abort,abort]
[Const1]
class = const
name = workdir
type = string
description = Remote process sandbox working directory
value = %(workdir)s
[Action2]
class = cmdline
input_ref = workdir
alias = w
template = -name value
# ########################################### ## Output Parameters Declaration ## ########################################### ## WARNING: the name must start with the keyword "result"[Output1]name=result1
type=string
description=WPSResourcePlainText
filepath=%(workdir)s/geoserverLayerOutput.xml
[Output2]name=result2
type=image/geotiff
description=WPSResourceBinaryFile
title=SRTM
filepath=%(workdir)s/srtm_39_04_c.tif
backup_on_wps_execution_shared_dir=truepublish_as_layer=truepublish_default_style=raster
publish_target_workspace=it.geosolutions
publish_layer_name=srtm_39_04_c
# Such metadata is a JSON snippet itself (/tmp/resource_dir/result2.json) with a small particularity.# Since you cannot know a-priori some of the final Layer properties,# you can use inside the json (/tmp/resource_dir/result2.json) some keywords which will be updated# automatically by the RemoteWPS which are the following ones:## ${type}# ${name}# ${title}# ${description}# ${lastUpdated}# ${getMapBaseUrl}# ${srs}# ${bbox}# ${workspace}# ${layers}# ${styles}publish_metadata=/<path_to>/resource_dir/result2.json
[Output3]name=result3
type=image/geotiff;stream
description=WPSResourceBinaryStream
title=ThisIsAGeoTIFFLayer
filepath=%(workdir)s/srtm_39_04_c.tif
publish_as_layer=truepublish_default_style=raster
publish_target_workspace=it.geosolutions
publish_layer_name=srtm_39_04_c
[Output4]name=result4
type=application/x-netcdf
description=NetCDFBinaryFile
title=Wind
filepath=%(workdir)s/RS1_STB_1FSCLS20111003_175545_00000018xS2x_16bxx_83066_29447_wind.nc
backup_on_wps_execution_shared_dir=truepublish_as_layer=truepublish_default_style=raster
publish_target_workspace=it.geosolutions
publish_layer_name=wind
# Such metadata is a JSON snippet itself (/tmp/resource_dir/result3.json) with a small particularity.# Since you cannot know a-priori some of the final Layer properties,# you can use inside the json (/tmp/resource_dir/result4.json) some keywords which will be updated# automatically by the RemoteWPS which are the following ones:## ${type}# ${name}# ${title}# ${description}# ${lastUpdated}# ${getMapBaseUrl}# ${srs}# ${bbox}# ${workspace}# ${layers}# ${styles}publish_metadata=/<path_to>/resource_dir/result4.json
# ########################################### ## GML Possible type values are ## text/xml;subtype=gml/3.1.1 ## text/xml;subtype=gml/2.1.2 ## application/gml-3.1.1 ## application/gml-2.1.2 ## ########################################### #[Output5]name=result5
type=text/xml;subtype=gml/3.1.1
description=WPSResourceGML
filepath=%(workdir)s/geoserverLoadLayerOutput.xml
[Output6]name=result6
type=video/mp4
description=VideoMP4BinaryFile
title=Wind
filepath=%(workdir)s/RS1_STB_1FSCLS20111003_175545_00000018xS2x_16bxx_83066_29447_wind.mp4
backup_on_wps_execution_shared_dir=false[Output7]name=result7
type=application/owc
description=WPSOWCJsonMapContext
layers_to_publish=result2;result4
publish_as_layer=truepublish_layer_name=owc_json_ctx
publish_metadata=/<path_to>/resource_dir/owc_json_ctx.json