Skip to content

Commit

Permalink
Rename hslayers container to timgen
Browse files Browse the repository at this point in the history
  • Loading branch information
jirik committed Mar 18, 2020
1 parent 26123b8 commit 7b82d94
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
deps
doc
hslayers
timgen
layman*
sample
test
Expand Down
2 changes: 1 addition & 1 deletion .env.demo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
Expand Down
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions doc/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions docker-compose.demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- ./tmp:/code/tmp
- ./start.sh:/code/start.sh
depends_on:
- hslayers
- timgen
- redis
- postgresql
- geoserver
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
- ./test.sh:/code/test.sh
depends_on:
- celery_worker_test
- hslayers
- timgen
- layman_client_test

celery_worker_test:
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/layman/map/filesystem/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion hslayers/package-lock.json → timgen/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hslayers/package.json → timgen/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "hslayers",
"name": "timgen",
"version": "1.0.0",
"description": "",
"main": "index.js",
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7b82d94

Please sign in to comment.