Web administrator for mapproxy configurations
MapProxy is an open source proxy and caching service for WMS, WMTS, TMS and other geospatial data services.
The MapProxy configuration is defined in yaml files. This project, MapProxyAdmin, provides a Web-UI for some common use cases:
- create a new configuration from scratch, based on WMS capabilities
- list the available MapProxy configurations and layers within configurations
- clear the cache for a given layer
- delete configurations
- mapproxy, configured as MultiMapProxy
- git
- unzip
- node (version 10 or higher) and npm
It is assumed that the MapProxy configuration resides within the bounds of a single configuration root directory: /path/to/your/mapproxy/config. The directories for the caches and the MultiMapProxy configurations are assumed to be subdirectories of this root directory.
-
Get a copy of this repository
git clone https://github.com/this/repo
-
copy public/config.json.example to public/config.json and edit the following settings to match your system configuration:
"adminserver" : "http://host.example.com:8083/", "mapproxydir" : "/path/to/root/of/mapproxy", "mapproxy_projects": "projects", "mapproxy_cache": "mp"
adminserver should point to the URL of the mapproxyadmin service, port 8083 is the default port,
mapproxydir should point to the root of your mapproxy configuration directory,
mapproxy_projects defines the name of the subdirectory for the MultiMapProxy configuration,
mapproxy_cache defines the subdirectory that is the root directory for the caches. -
unzip public/dist.zip, the resulting files and folders should go to public/
-
install dependencies for MapProxyAdmin (index.js)
npm install
-
start the MapProxyAdmin service
node index.js
-
open http://host.example.com:8083 in your browser
For MapProxyAdmin to function properly, it should have permissions to alter files in the cache directories and the MultiMapProxy config directory. This can be achieved by letting node run under the same account as MapProxy. For instance, if MapProxy is running as a wsgi service under Linux Apache, then node should run under account www-data:
sudo -u www-data node index.js
For security, it is strongly advised to thoroughly restrict access to MapProxyAdmin. Users can easily destroy your MapProxy configuration or may find ways to change files on your file system (although some basic measures were taken to try to prevent this).
The MapProxyAdmin source code for both client and server are JavaScript. The server uses Node and some node modules (Express, WMSCapabilities and JSYaml to name some), the client is based on WebComponents using Polymer LitElement and LitHtml. Client development requires installation of polymer-cli
The server code is in index.js. Use a debugger to set breakpoints and step through the code.
-
start node in debug mode:
node --inpect index.js
-
To open the debugger in the (Chrome) browser, type
chrome://inspect
in the address bar. Set breakpoints to step through the code
The source code for the browser client resides in directory /client. The code is built using polymer-cli and the build output is copied to the /public directory where it can run indepently of polymer. During development, client and server are separated. The server runs under node (see Server development above), the client runs under polymer, listening on a different port.
-
copy public/confg.json to client/config.json, edit client/config.json and set "adminserver" to http://localhost:8083
-
install polymer-cli
npm install -g polymer-cli
-
install client dependencies, run the following command in the client directory:
npm install
-
start the client under polymer
polymer serve
-
point your browser to http://localhost:8081 (the client runs on port 8081, the server on port 8083)
Run the following commands in the /client directory:
polymer build
cd build/es5-bundled
zip -r dist.zip *
cp dist.zip ../../../public