diff --git a/.dockerignore b/.dockerignore index f410a4c1f..cce014ace 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,6 @@ deps doc -hslayers +timgen layman* sample test diff --git a/.env.demo b/.env.demo index f0d01287e..227d2c634 100644 --- a/.env.demo +++ b/.env.demo @@ -41,7 +41,7 @@ LAYMAN_SERVER_NAME=layman:8000 LAYMAN_PROXY_SERVER_NAME=localhost # internal settings -LAYMAN_TIMGEN_URL=http://hslayers:8080/ +LAYMAN_TIMGEN_URL=http://timgen:8080/ LAYMAN_CLIENT_URL=http://layman_client:3000/client/ # client diff --git a/.env.dev b/.env.dev index e2f5b1569..a3e27f582 100644 --- a/.env.dev +++ b/.env.dev @@ -42,7 +42,7 @@ LAYMAN_SERVER_NAME=layman_dev:8000 LAYMAN_PROXY_SERVER_NAME=localhost:8000 # internal settings -LAYMAN_TIMGEN_URL=http://hslayers:8080/ +LAYMAN_TIMGEN_URL=http://timgen:8080/ LAYMAN_CLIENT_URL=http://layman_client:3000/client/ # client diff --git a/.env.test b/.env.test index b67bce5b2..056631475 100644 --- a/.env.test +++ b/.env.test @@ -42,7 +42,7 @@ LAYMAN_SERVER_NAME=layman_test_run_1:8000 LAYMAN_PROXY_SERVER_NAME=layman_test_run_1:8000 # internal settings -LAYMAN_TIMGEN_URL=http://hslayers:8080/ +LAYMAN_TIMGEN_URL=http://timgen:8080/ LAYMAN_CLIENT_URL=http://layman_client_test:3000/client/ # client diff --git a/.travis.yml b/.travis.yml index 3c67dc52f..6d617acab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ script: after_failure: - docker logs layman_celery_worker_test_1 -- docker logs hslayers +- docker logs timgen - docker logs micka - git clone https://jirik:${GITHUB_TOKEN}@gist.github.com/3c7f15736f03e8711d5dde8445f6b68d.git travis-artifacts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ecee0d23..39937b0e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Upgrade requirements - Upgrade Micka to [v2020.010](https://github.com/hsrs-cz/Micka/releases/tag/v2020.010). - Add [CSW_PROXY_URL](doc/env-settings.md#CSW_PROXY_URL) to distinguish between internal CSW URL for Layman and public CSW URL for clients. +- Rename host [LAYMAN_TIMGEN_URL](doc/env-settings.md#LAYMAN_TIMGEN_URL) of from `hslayers` to `timgen`. ### Changes - Publish metadata record of [map](doc/models.md#map) to Micka on [POST Maps](doc/rest.md#post-maps). @@ -31,6 +32,7 @@ - Assert version of Micka on startup. - Load data into redis on startup even in Flower. - Better handle Micka's HTTP errors, [#43](https://github.com/jirik/layman/issues/43) +- Rename hslayers container to timgen (Thumbnail Image Generator) ## v1.1.8 2020-03-16 diff --git a/Makefile b/Makefile index c57ceccc5..17b6e3e14 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,19 @@ .PHONY: test start-demo: - docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up --force-recreate postgresql geoserver redis layman celery_worker flower hslayers layman_client nginx + docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up --force-recreate postgresql geoserver redis layman celery_worker flower timgen layman_client nginx start-demo-d: - docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up -d --force-recreate postgresql geoserver redis layman celery_worker flower hslayers layman_client nginx + docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up -d --force-recreate postgresql geoserver redis layman celery_worker flower timgen layman_client nginx start-demo-full: - docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up --force-recreate postgresql geoserver redis layman celery_worker flower hslayers layman_client micka nginx + docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up --force-recreate postgresql geoserver redis layman celery_worker flower timgen layman_client micka nginx start-demo-full-d: - docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up -d --force-recreate postgresql geoserver redis layman celery_worker flower hslayers layman_client micka nginx + docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up -d --force-recreate postgresql geoserver redis layman celery_worker flower timgen layman_client micka nginx start-demo-only-d: - docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up -d --force-recreate --no-deps layman celery_worker flower hslayers layman_client + docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up -d --force-recreate --no-deps layman celery_worker flower timgen layman_client stop-demo: docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml stop @@ -25,7 +25,7 @@ start-demo-full-with-optional-deps-d: docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml up -d --force-recreate build-demo: - docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml build layman layman_client geoserver hslayers + docker-compose -f docker-compose.deps.demo.yml -f docker-compose.demo.yml build layman layman_client geoserver timgen deps-start: docker-compose -f docker-compose.deps.yml up --force-recreate -d @@ -43,15 +43,15 @@ stop-dev: docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml stop start-dev-only: - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml rm -fsv layman_dev celery_worker_dev flower hslayers layman_client - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml up layman_dev celery_worker_dev flower hslayers layman_client + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml rm -fsv layman_dev celery_worker_dev flower timgen layman_client + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml up layman_dev celery_worker_dev flower timgen layman_client start-dev-only-d: - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml rm -fsv layman_dev celery_worker_dev flower hslayers layman_client - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml up -d layman_dev celery_worker_dev flower hslayers layman_client + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml rm -fsv layman_dev celery_worker_dev flower timgen layman_client + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml up -d layman_dev celery_worker_dev flower timgen layman_client stop-dev-only: - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml stop layman_dev celery_worker_dev flower hslayers layman_client + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml stop layman_dev celery_worker_dev flower timgen layman_client restart-dev: docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml up --force-recreate --no-deps -d layman_dev celery_worker_dev @@ -110,15 +110,15 @@ reset-data-directories: clear-python-cache-dev: docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml run --rm --no-deps layman_dev bash /code/src/clear-python-cache.sh -hslayers-build: - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml build hslayers +timgen-build: + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml build timgen -hslayers-restart: - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml build hslayers - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml up --force-recreate --no-deps -d hslayers +timgen-restart: + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml build timgen + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml up --force-recreate --no-deps -d timgen -hslayers-bash: - docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml run --rm hslayers sh +timgen-bash: + docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml run --rm timgen sh client-build: docker-compose -f docker-compose.deps.yml -f docker-compose.dev.yml build layman_client diff --git a/README.md b/README.md index 8380d3ef1..ac5de08e8 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ After providing external dependencies there is time to provide **internal depend Pipenv is recommended tool for installing **python-level** dependencies. Both Pipfile and Pipfile.lock are located in [`docker/`](docker/) directory. -Npm is recommended tool for installing **node.js-level** dependencies. Both package.json and package-lock.json are located in [`hslayers/`](hslayers/) directory. +Npm is recommended tool for installing **node.js-level** dependencies. Both package.json and package-lock.json are located in [`timgen/`](timgen/) directory. Next you need to choose how you deploy Layman. As Layman is Flask application, check Flask's [deployment options](https://flask.palletsprojects.com/en/1.1.x/deploying/). Layman is safe to run with multiple WSGI Flask processes and with multiple Celery worker processes. @@ -167,7 +167,7 @@ Configure Layman using [environment settings](doc/env-settings.md). Demo configu - [LTC_SESSION_SECRET](doc/env-settings.md#LTC_SESSION_SECRET) Last, start layman and necessary services: -- thumbnail image generator (Timgen, also referred to as hslayers) using npm (see startup command of `hslayers` docker-compose service) +- thumbnail image generator (Timgen) using npm (see startup command of `timgen` docker-compose service) - Layman client using npm (see startup command of `layman_client` docker-compose service) - Layman using your deployment server (see startup command of `layman` docker-compose service) - Layman celery worker using python (see startup command of `celery_worker` docker-compose service) diff --git a/doc/dependencies.md b/doc/dependencies.md index 11919a68c..a8d151964 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -23,8 +23,8 @@ | [chromium](https://www.chromium.org/) | 77+ | BSD and others | Dockerfile | prod | bin | for client-side map rendering and integration testing | | [chromedriver](http://chromedriver.chromium.org/) | 77+ | BSD and others | Dockerfile | prod | bin | for client-side map rendering and integration testing | | [pipenv](https://pipenv.kennethreitz.org/en/latest/) | 2018.11.26 | MIT | Dockerfile | prod | bin | to install Python dependencies | -| [node.js](https://pipenv.kennethreitz.org/en/latest/) | 10 | MIT | hslayers/Dockerfile | prod | bin | to run Timgen | -| [npm](https://www.npmjs.com/get-npm) | 6 | Artistic License 2.0 | hslayers/Dockerfile | prod | bin | to install node.js dependencies | +| [node.js](https://pipenv.kennethreitz.org/en/latest/) | 10 | MIT | timgen/Dockerfile | prod | bin | to run Timgen | +| [npm](https://www.npmjs.com/get-npm) | 6 | Artistic License 2.0 | timgen/Dockerfile | prod | bin | to install node.js dependencies | | [node.js](https://pipenv.kennethreitz.org/en/latest/) | 12 | MIT | client/docker/Dockerfile | prod | bin | to run Layman Test Client | | [npm](https://www.npmjs.com/get-npm) | 6 | Artistic License 2.0 | client/docker/Dockerfile | prod | bin | to install node.js dependencies | | [layman-test-client](https://github.com/jirik/layman-test-client) | 1.0.0 | GNU GPL v3 | docker-compose.yml | opt | bin | to demonstrate communication with REST API | @@ -53,10 +53,10 @@ ### Node.js dependencies | name | license | used by | env | bin or src | purpose | | --- | --- | --- | --- | --- | --- | -| [openlayers](https://openlayers.org/) | BSD 2-Clause | hslayers/package.json | prod | bin | for client-side map rendering in Timgen | -| [http-server](https://www.npmjs.com/package/http-server) | MIT | hslayers/package.json | prod | bin | as static HTTP server for Timgen | -| [cors-anywhere](https://www.npmjs.com/package/cors-anywhere) | MIT | hslayers/package.json | prod | bin | for proxying Timgen requests | -| [file-saver](https://www.npmjs.com/package/file-saver) | MIT | hslayers/package.json | prod | bin | for saving images in Timgen | +| [openlayers](https://openlayers.org/) | BSD 2-Clause | timgen/package.json | prod | bin | for client-side map rendering in Timgen | +| [http-server](https://www.npmjs.com/package/http-server) | MIT | timgen/package.json | prod | bin | as static HTTP server for Timgen | +| [cors-anywhere](https://www.npmjs.com/package/cors-anywhere) | MIT | timgen/package.json | prod | bin | for proxying Timgen requests | +| [file-saver](https://www.npmjs.com/package/file-saver) | MIT | timgen/package.json | prod | bin | for saving images in Timgen | ## Other dependencies diff --git a/docker-compose.demo.yml b/docker-compose.demo.yml index f1a6e006c..325cc58f3 100644 --- a/docker-compose.demo.yml +++ b/docker-compose.demo.yml @@ -20,7 +20,7 @@ services: - ./layman_data:/layman_data - ./src/layman_settings_demo.py:/code/src/layman_settings.py depends_on: - - hslayers + - timgen - layman_client - redis - postgresql @@ -60,16 +60,16 @@ services: depends_on: - celery_worker - hslayers: - container_name: hslayers + timgen: + container_name: timgen build: - context: hslayers + context: timgen dockerfile: Dockerfile.production args: - LAYMAN_GS_HOST=${LAYMAN_GS_HOST} - LAYMAN_GS_PORT=${LAYMAN_GS_PORT} - LAYMAN_SERVER_NAME=${LAYMAN_SERVER_NAME} - image: hslayers:latest + image: timgen:latest user: ${UID_GID} command: sh -c "node proxy.js & ./node_modules/.bin/http-server dist/" extra_hosts: diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 58bfe2374..d89d8b7e0 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -20,7 +20,7 @@ services: - ./tmp:/code/tmp - ./start.sh:/code/start.sh depends_on: - - hslayers + - timgen - redis - postgresql - geoserver @@ -63,16 +63,16 @@ services: depends_on: - celery_worker_dev - hslayers: - container_name: hslayers + timgen: + container_name: timgen build: - context: hslayers + context: timgen dockerfile: Dockerfile.production args: - LAYMAN_GS_HOST=${LAYMAN_GS_HOST} - LAYMAN_GS_PORT=${LAYMAN_GS_PORT} - LAYMAN_SERVER_NAME=${LAYMAN_SERVER_NAME} - image: hslayers:latest + image: timgen:latest user: ${UID_GID} command: sh -c "node proxy.js & ./node_modules/.bin/http-server dist/" # ports: diff --git a/docker-compose.test.yml b/docker-compose.test.yml index a2ee89653..f4a50c007 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -17,7 +17,7 @@ services: - ./test.sh:/code/test.sh depends_on: - celery_worker_test - - hslayers + - timgen - layman_client_test celery_worker_test: @@ -40,16 +40,16 @@ services: - geoserver - micka - hslayers: - container_name: hslayers + timgen: + container_name: timgen build: - context: hslayers + context: timgen dockerfile: Dockerfile.production args: - LAYMAN_GS_HOST=${LAYMAN_GS_HOST} - LAYMAN_GS_PORT=${LAYMAN_GS_PORT} - LAYMAN_SERVER_NAME=${LAYMAN_SERVER_NAME} - image: hslayers:latest + image: timgen:latest user: ${UID_GID} command: sh -c "node proxy.js & ./node_modules/.bin/http-server dist/" # ports: diff --git a/src/layman/map/filesystem/thumbnail.py b/src/layman/map/filesystem/thumbnail.py index 4756b0201..5c71f71b2 100644 --- a/src/layman/map/filesystem/thumbnail.py +++ b/src/layman/map/filesystem/thumbnail.py @@ -81,8 +81,8 @@ def generate_map_thumbnail(username, mapname): 'map_def_url': map_file_get_url, # 'file_name': tmp_file_name, }) - hslayers_url = f"{settings.LAYMAN_TIMGEN_URL}?{params}" - # current_app.logger.info(f"HSLayers URL: {hslayers_url}") + timgen_url = f"{settings.LAYMAN_TIMGEN_URL}?{params}" + # current_app.logger.info(f"Timgen URL: {timgen_url}") chrome_options = Options() chrome_options.add_argument("--headless") @@ -95,7 +95,7 @@ def generate_map_thumbnail(username, mapname): ) chrome.set_window_size(500,500) - chrome.get(hslayers_url) + chrome.get(timgen_url) entries = chrome.get_log('browser') max_attempts = 40 attempts = 0 diff --git a/hslayers/.babelrc b/timgen/.babelrc similarity index 100% rename from hslayers/.babelrc rename to timgen/.babelrc diff --git a/hslayers/.gitignore b/timgen/.gitignore similarity index 100% rename from hslayers/.gitignore rename to timgen/.gitignore diff --git a/hslayers/Dockerfile.production b/timgen/Dockerfile.production similarity index 100% rename from hslayers/Dockerfile.production rename to timgen/Dockerfile.production diff --git a/hslayers/config.js b/timgen/config.js similarity index 100% rename from hslayers/config.js rename to timgen/config.js diff --git a/hslayers/index.html b/timgen/index.html similarity index 100% rename from hslayers/index.html rename to timgen/index.html diff --git a/hslayers/index.js b/timgen/index.js similarity index 100% rename from hslayers/index.js rename to timgen/index.js diff --git a/hslayers/package-lock.json b/timgen/package-lock.json similarity index 99% rename from hslayers/package-lock.json rename to timgen/package-lock.json index 0b5da8103..7c315834f 100644 --- a/hslayers/package-lock.json +++ b/timgen/package-lock.json @@ -1,5 +1,5 @@ { - "name": "hslayers", + "name": "timgen", "version": "1.0.0", "lockfileVersion": 1, "requires": true, diff --git a/hslayers/package.json b/timgen/package.json similarity index 96% rename from hslayers/package.json rename to timgen/package.json index 0bc3ce722..ae7e38460 100644 --- a/hslayers/package.json +++ b/timgen/package.json @@ -1,5 +1,5 @@ { - "name": "hslayers", + "name": "timgen", "version": "1.0.0", "description": "", "main": "index.js", diff --git a/hslayers/proxy.js b/timgen/proxy.js similarity index 100% rename from hslayers/proxy.js rename to timgen/proxy.js diff --git a/hslayers/src/map.js b/timgen/src/map.js similarity index 100% rename from hslayers/src/map.js rename to timgen/src/map.js