Skip to content

Commit 71ea6d2

Browse files
authored
[maintenance] Upgrades webserver's requirements (#1444)
Fully upgrade requirements of packages and webserver to latest version possible Upgraded Dockerfiles for webserver
1 parent cd7e1d8 commit 71ea6d2

File tree

75 files changed

+852
-760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+852
-760
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ services/docker-compose.stack.*.yml
129129

130130
# Any generated output folder (e.g. codegen, build, ...)
131131
out/
132-
tmp/
132+
**/tmp/
133133

134134
# See .vscode-template
135135
pytest.ini
@@ -149,4 +149,3 @@ prof/
149149

150150
# outputs from make
151151
.stack-*.yml
152-
services/web/server/tests/data/static/resource/statics.json

Makefile

+24-24
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ endef
8787

8888
rebuild: build-nc # alias
8989
build build-nc build-kit build-x: .env ## Builds production images and tags them as 'local/{service-name}:production'. For single target e.g. 'make target=webserver build'
90-
ifeq ($(target),)
90+
ifeq ($(target),)
9191
# Compiling front-end
92-
92+
9393
@$(if $(findstring -kit,$@),export DOCKER_BUILDKIT=1;export COMPOSE_DOCKER_CLI_BUILD=1;,) \
9494
$(MAKE_C) services/web/client compile$(if $(findstring -x,$@),-x,)
95-
95+
9696
# Building services
9797
@$(if $(findstring -kit,$@),export DOCKER_BUILDKIT=1;export COMPOSE_DOCKER_CLI_BUILD=1;,) \
9898
$(_docker_compose_build)
@@ -126,7 +126,7 @@ endif
126126

127127

128128
# TODO: should download cache if any??
129-
build-cache build-cache-nc build-cache-kit build-cache-x: .env ## Build cache images and tags them as 'local/{service-name}:cache'
129+
build-cache build-cache-nc build-cache-kit build-cache-x: .env ## Build cache images and tags them as 'local/{service-name}:cache'
130130
ifeq ($(target),)
131131
# Compiling front-end
132132
@$(if $(findstring -kit,$@),export DOCKER_BUILDKIT=1;export COMPOSE_DOCKER_CLI_BUILD=1;,)
@@ -189,13 +189,13 @@ endif
189189

190190

191191
up-devel: .stack-simcore-development.yml .init-swarm $(CLIENT_WEB_OUTPUT) ## Deploys local development stack, qx-compile+watch and ops stack (pass 'make ops_disabled=1 up-...' to disable)
192-
# Start compile+watch front-end container [front-end]
192+
# Start compile+watch front-end container [front-end]
193193
$(MAKE_C) services/web/client compile-dev flags=--watch
194194
# Deploy stack $(SWARM_STACK_NAME) [back-end]
195195
@docker stack deploy -c $< $(SWARM_STACK_NAME)
196196
$(MAKE) .deploy-ops
197197
$(MAKE_C) services/web/client follow-dev-logs
198-
198+
199199

200200
up-prod: .stack-simcore-production.yml .init-swarm ## Deploys local production stack and ops stack (pass 'make ops_disabled=1 up-...' to disable)
201201
# Deploy stack $(SWARM_STACK_NAME)
@@ -297,8 +297,6 @@ push-version: tag-version
297297
## PYTHON -------------------------------
298298
.PHONY: pylint
299299

300-
PY_PIP = $(if $(IS_WIN),cd .venv/Scripts && pip.exe,.venv/bin/pip3)
301-
302300
pylint: ## Runs python linter framework's wide
303301
# See exit codes and command line https://pylint.readthedocs.io/en/latest/user_guide/run.html#exit-codes
304302
# TODO: NOT windows friendly
@@ -315,13 +313,13 @@ pylint: ## Runs python linter framework's wide
315313

316314
.venv:
317315
python3 -m venv $@
318-
$@/bin/pip3 install --upgrade \
316+
$@/bin/pip3 --quiet install --upgrade \
319317
pip \
320318
wheel \
321319
setuptools
322320

323321
devenv: .venv ## create a python virtual environment with dev tools (e.g. linters, etc)
324-
$</bin/pip3 install -r requirements.txt
322+
$</bin/pip3 --quiet install -r requirements.txt
325323
@echo "To activate the venv, execute 'source .venv/bin/activate'"
326324

327325
devenv-all: devenv ## sets up extra development tools (everything else besides python)
@@ -335,7 +333,7 @@ devenv-all: devenv ## sets up extra development tools (everything else besides p
335333

336334
.PHONY: new-service
337335
new-service: .venv ## Bakes a new project from cookiecutter-simcore-pyservice and drops it under services/ [UNDER DEV]
338-
$</bin/pip3 install cookiecutter
336+
$</bin/pip3 --quiet install cookiecutter
339337
.venv/bin/cookiecutter gh:itisfoundation/cookiecutter-simcore-pyservice --output-dir $(CURDIR)/services
340338

341339
# TODO: NOT windows friendly
@@ -422,39 +420,40 @@ ifneq ($(SWARM_HOSTS), )
422420
endif
423421

424422

425-
.PHONY: clean clean-images clean-venv clean-all
426-
427-
git_clean_args := -dxf -e .vscode -e TODO.md -e .venv
423+
.PHONY: clean clean-images clean-venv clean-all clean-ps
428424

425+
_git_clean_args := -dxf -e .vscode -e TODO.md -e .venv
426+
_running_containers = $(shell docker ps -aq)
429427

430428
.check-clean:
431-
@git clean -n $(git_clean_args)
429+
@git clean -n $(_git_clean_args)
432430
@echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ]
433431
@echo -n "$(shell whoami), are you REALLY sure? [y/N] " && read ans && [ $${ans:-N} = y ]
434432

435-
clean-venv: ## Purges .venv into original configuration
433+
clean-venv: devenv ## Purges .venv into original configuration
436434
# Cleaning your venv
437-
pip-sync $(CURDIR)/requirements.txt
435+
.venv/bin/pip-sync --quiet $(CURDIR)/requirements.txt
438436
@pip list
439437

440-
clean: .check-clean clean-venv ## cleans all unversioned files in project and temp files create by this makefile
438+
clean: .check-clean ## cleans all unversioned files in project and temp files create by this makefile
441439
# Cleaning unversioned
442-
@git clean $(git_clean_args)
440+
@git clean $(_git_clean_args)
443441
# Cleaning web/client
444-
@$(MAKE_C) services/web/client clean
445-
# Cleaning postgres maintenance
446-
@$(MAKE_C) packages/postgres-database/docker clean
442+
@$(MAKE_C) services/web/client clean-files
443+
444+
clean-ps: ## stops and deletes running containers
445+
$(if $(_running_containers), docker rm -f $(_running_containers),)
447446

448447
clean-images: ## removes all created images
449448
# Cleaning all service images
450449
-$(foreach service,$(SERVICES_LIST)\
451450
,docker image rm -f $(shell docker images */$(service):* -q);)
452451
# Cleaning webclient
453-
@$(MAKE_C) services/web/client clean
452+
@$(MAKE_C) services/web/client clean-images
454453
# Cleaning postgres maintenance
455454
@$(MAKE_C) packages/postgres-database/docker clean
456455

457-
clean-all: clean clean-images # Deep clean including .venv and produced images
456+
clean-all: clean clean-ps clean-images # Deep clean including .venv and produced images
458457
-rm -rf .venv
459458

460459

@@ -463,6 +462,7 @@ postgres-upgrade: ## initalize or upgrade postgres db to latest state
463462
@$(MAKE_C) packages/postgres-database/docker build
464463
@$(MAKE_C) packages/postgres-database/docker upgrade
465464

465+
466466
.PHONY: reset
467467
reset: ## restart docker daemon (LINUX ONLY)
468468
sudo systemctl restart docker

docs/python-dependencies.md

+30
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,36 @@ TODO: finish!
1717
- The dependencies have to be kept up-to-date regularly (e.g. due to security patches; new feature in our package might add new direct dependencies to our requirements)
1818
- Inter-dependent libraries typically have different release cycles creating in time version conflicts (e.g. package A and B strictly depend on different versions of C)
1919
20+
21+
- packages uses input requirements as install-requirements (i.e. entry in setup and in requirements/ci.txt) NOT compiled ones
22+
- services use compiled requirements
23+
24+
25+
26+
- tests packages with the latest (i.e. compile requirements to lastest version)
27+
- if tests fails, then add constraints in input requirements
28+
- try adding tests that check inter-library compatibility
29+
- if tests succeed, you can use them in services
30+
- if at least one service has a problem, we need to decide whether to add a constraint:
31+
a) at the package level => will ensure is tested but is constraining all services
32+
b) at the service level => only affects service but cannot do isolate tests against latests upgrades
33+
34+
35+
### How to purge unused requirements?
36+
37+
38+
### Propagation of constraints
39+
40+
- Situation: upgrading one package the developer finds an issue, e.g.
41+
```
42+
coverage==5.0.3 # TODO: Downgraded because of a bug https://github.com/nedbat/coveragepy/issues/716
43+
44+
pytest~=5.3.5 # Bug in pytest-sugar https://github.com/Teemu/pytest-sugar/issues/187
45+
pytest-aiohttp # incompatible with pytest-asyncio. See https://github.com/pytest-dev/pytest-asyncio/issues/76
46+
```
47+
- Question: how to make sure this is also taken into account in other places?
48+
49+
2050
!-->
2151

2252
## Rationale

packages/postgres-database/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include ../../scripts/common.Makefile
66

77
.PHONY: requirements
88
requirements: ## compiles pip requirements (.in -> .txt)
9-
@$(MAKE) --directory requirements reqs
9+
@$(MAKE_C) requirements reqs
1010

1111

1212
.PHONY: install-dev install-prod install-ci

packages/postgres-database/requirements/_base.in

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
# Specifies third-party dependencies for 'simcore-postgres-database'
33
#
44
sqlalchemy[postgresql_psycopg2binary]>=1.3.3 # binary + Vulnerability
5-
65
yarl

packages/postgres-database/requirements/_base.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#
55
# pip-compile --output-file=_base.txt _base.in
66
#
7-
idna==2.8 # via yarl
8-
multidict==4.5.2 # via yarl
9-
psycopg2-binary==2.8.4 # via sqlalchemy
10-
sqlalchemy[postgresql_psycopg2binary]==1.3.5 # via -r requirements/_base.in
11-
yarl==1.4.2 # via -r requirements/_base.in
7+
idna==2.9 # via yarl
8+
multidict==4.7.5 # via yarl
9+
psycopg2-binary==2.8.5 # via sqlalchemy
10+
sqlalchemy[postgresql_psycopg2binary]==1.3.16 # via -r _base.in
11+
yarl==1.4.2 # via -r _base.in

packages/postgres-database/requirements/_migration.txt

+16-16
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
#
55
# pip-compile --output-file=_migration.txt _migration.in
66
#
7-
alembic==1.4.2 # via -r requirements/_migration.in
8-
certifi==2019.11.28 # via -r requirements/_migration.in, requests
7+
alembic==1.4.2 # via -r _migration.in
8+
certifi==2019.11.28 # via -r _migration.in, requests
99
chardet==3.0.4 # via requests
10-
click==7.1.1 # via -r requirements/_migration.in
11-
docker==4.2.0 # via -r requirements/_migration.in
12-
idna==2.8 # via -r requirements/_base.txt, requests, yarl
13-
mako==1.0.12 # via alembic
10+
click==7.1.2 # via -r _migration.in
11+
docker==4.2.0 # via -r _migration.in
12+
idna==2.9 # via -r _base.txt, requests, yarl
13+
mako==1.1.2 # via alembic
1414
markupsafe==1.1.1 # via mako
15-
multidict==4.5.2 # via -r requirements/_base.txt, yarl
16-
psycopg2-binary==2.8.4 # via -r requirements/_base.txt, sqlalchemy
17-
python-dateutil==2.8.0 # via alembic
15+
multidict==4.7.5 # via -r _base.txt, yarl
16+
psycopg2-binary==2.8.5 # via -r _base.txt, sqlalchemy
17+
python-dateutil==2.8.1 # via alembic
1818
python-editor==1.0.4 # via alembic
19-
requests==2.22.0 # via docker
20-
six==1.12.0 # via docker, python-dateutil, tenacity, websocket-client
21-
sqlalchemy[postgresql_psycopg2binary]==1.3.5 # via -r requirements/_base.txt, alembic
22-
tenacity==6.1.0 # via -r requirements/_migration.in
23-
urllib3==1.25.8 # via -r requirements/_migration.in, requests
24-
websocket-client==0.56.0 # via docker
25-
yarl==1.4.2 # via -r requirements/_base.txt
19+
requests==2.23.0 # via docker
20+
six==1.14.0 # via docker, python-dateutil, tenacity, websocket-client
21+
sqlalchemy[postgresql_psycopg2binary]==1.3.16 # via -r _base.txt, alembic
22+
tenacity==6.1.0 # via -r _migration.in
23+
urllib3==1.25.9 # via -r _migration.in, requests
24+
websocket-client==0.57.0 # via docker
25+
yarl==1.4.2 # via -r _base.txt

packages/postgres-database/requirements/_test.in

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ aiopg[sa]
1111
faker
1212

1313
# testing
14-
coverage==5.0.3 # TODO: Downgraded because of a bug https://github.com/nedbat/coveragepy/issues/716
14+
coverage
1515
pytest~=5.3.5 # Bug in pytest-sugar https://github.com/Teemu/pytest-sugar/issues/187
1616
pytest-cov
1717
pytest-aiohttp # incompatible with pytest-asyncio. See https://github.com/pytest-dev/pytest-asyncio/issues/76
1818
pytest-instafail
1919
pytest-runner
2020
pytest-docker
2121

22-
# tools
23-
-r ../../../requirements.txt
22+
# CI
2423
pylint
2524
coveralls

packages/postgres-database/requirements/_test.txt

+39-46
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,58 @@
22
# This file is autogenerated by pip-compile
33
# To update, run:
44
#
5-
# pip-compile requirements/_test.in
5+
# pip-compile --output-file=_test.txt _test.in
66
#
77
aiohttp==3.6.2 # via pytest-aiohttp
8-
aiopg[sa]==1.0.0 # via -r requirements/_test.in
9-
alembic==1.4.2 # via -r requirements/_migration.txt
10-
appdirs==1.4.3 # via black
11-
astroid==2.3.3 # via pylint
8+
aiopg[sa]==1.0.0 # via -r _test.in
9+
alembic==1.4.2 # via -r _migration.txt
10+
astroid==2.4.0 # via pylint
1211
async-timeout==3.0.1 # via aiohttp
13-
attrs==19.3.0 # via aiohttp, black, pytest, pytest-docker
14-
black==19.10b0 # via -r requirements/../../../requirements.txt
15-
bump2version==1.0.0 # via -r requirements/../../../requirements.txt
16-
certifi==2019.11.28 # via -r requirements/_migration.txt, requests
17-
chardet==3.0.4 # via -r requirements/_migration.txt, aiohttp, requests
18-
click==7.1.1 # via -r requirements/_migration.txt, black, pip-tools
19-
coverage==5.0.3 # via -r requirements/_test.in, coveralls, pytest-cov
20-
coveralls==1.11.1 # via -r requirements/_test.in
21-
docker==4.2.0 # via -r requirements/_migration.txt
12+
attrs==19.3.0 # via aiohttp, pytest, pytest-docker
13+
certifi==2019.11.28 # via -r _migration.txt, requests
14+
chardet==3.0.4 # via -r _migration.txt, aiohttp, requests
15+
click==7.1.2 # via -r _migration.txt
16+
coverage==5.1 # via -r _test.in, coveralls, pytest-cov
17+
coveralls==2.0.0 # via -r _test.in
18+
docker==4.2.0 # via -r _migration.txt
2219
docopt==0.6.2 # via coveralls
23-
faker==4.0.2 # via -r requirements/_test.in
20+
faker==4.0.3 # via -r _test.in
2421
idna-ssl==1.1.0 # via aiohttp
25-
idna==2.8 # via -r requirements/_migration.txt, requests, yarl
22+
idna==2.9 # via -r _migration.txt, requests, yarl
2623
importlib-metadata==1.6.0 # via pluggy, pytest
2724
isort==4.3.21 # via pylint
2825
lazy-object-proxy==1.4.3 # via astroid
29-
mako==1.0.12 # via -r requirements/_migration.txt, alembic
30-
markupsafe==1.1.1 # via -r requirements/_migration.txt, mako
26+
mako==1.1.2 # via -r _migration.txt, alembic
27+
markupsafe==1.1.1 # via -r _migration.txt, mako
3128
mccabe==0.6.1 # via pylint
3229
more-itertools==8.2.0 # via pytest
33-
multidict==4.5.2 # via -r requirements/_migration.txt, aiohttp, yarl
30+
multidict==4.7.5 # via -r _migration.txt, aiohttp, yarl
3431
packaging==20.3 # via pytest
35-
pathspec==0.7.0 # via black
36-
pip-tools==4.5.1 # via -r requirements/../../../requirements.txt
3732
pluggy==0.13.1 # via pytest
38-
psycopg2-binary==2.8.4 # via -r requirements/_migration.txt, aiopg, sqlalchemy
33+
psycopg2-binary==2.8.5 # via -r _migration.txt, aiopg, sqlalchemy
3934
py==1.8.1 # via pytest
40-
pylint==2.4.4 # via -r requirements/../../../requirements.txt, -r requirements/_test.in
41-
pyparsing==2.4.6 # via packaging
42-
pytest-aiohttp==0.3.0 # via -r requirements/_test.in
43-
pytest-cov==2.8.1 # via -r requirements/_test.in
44-
pytest-docker==0.7.2 # via -r requirements/_test.in
45-
pytest-instafail==0.4.1.post0 # via -r requirements/_test.in
46-
pytest-runner==5.2 # via -r requirements/_test.in
47-
pytest==5.3.5 # via -r requirements/_test.in, pytest-aiohttp, pytest-cov, pytest-instafail
48-
python-dateutil==2.8.0 # via -r requirements/_migration.txt, alembic, faker
49-
python-editor==1.0.4 # via -r requirements/_migration.txt, alembic
50-
pyyaml==5.3.1 # via -r requirements/_test.in
51-
regex==2020.2.20 # via black
52-
requests==2.22.0 # via -r requirements/_migration.txt, coveralls, docker
53-
rope==0.16.0 # via -r requirements/../../../requirements.txt
54-
six==1.12.0 # via -r requirements/_migration.txt, astroid, docker, packaging, pip-tools, python-dateutil, tenacity, websocket-client
55-
sqlalchemy[postgresql_psycopg2binary]==1.3.5 # via -r requirements/_migration.txt, aiopg, alembic
56-
tenacity==6.1.0 # via -r requirements/_migration.txt
35+
pylint==2.5.0 # via -r _test.in
36+
pyparsing==2.4.7 # via packaging
37+
pytest-aiohttp==0.3.0 # via -r _test.in
38+
pytest-cov==2.8.1 # via -r _test.in
39+
pytest-docker==0.7.2 # via -r _test.in
40+
pytest-instafail==0.4.1.post0 # via -r _test.in
41+
pytest-runner==5.2 # via -r _test.in
42+
pytest==5.3.5 # via -r _test.in, pytest-aiohttp, pytest-cov, pytest-instafail
43+
python-dateutil==2.8.1 # via -r _migration.txt, alembic, faker
44+
python-editor==1.0.4 # via -r _migration.txt, alembic
45+
pyyaml==5.3.1 # via -r _test.in
46+
requests==2.23.0 # via -r _migration.txt, coveralls, docker
47+
six==1.14.0 # via -r _migration.txt, astroid, docker, packaging, python-dateutil, tenacity, websocket-client
48+
sqlalchemy[postgresql_psycopg2binary]==1.3.16 # via -r _migration.txt, aiopg, alembic
49+
tenacity==6.1.0 # via -r _migration.txt
5750
text-unidecode==1.3 # via faker
58-
toml==0.10.0 # via black
59-
typed-ast==1.4.1 # via astroid, black
51+
toml==0.10.0 # via pylint
52+
typed-ast==1.4.1 # via astroid
6053
typing-extensions==3.7.4.2 # via aiohttp
61-
urllib3==1.25.8 # via -r requirements/_migration.txt, requests
62-
wcwidth==0.1.8 # via pytest
63-
websocket-client==0.56.0 # via -r requirements/_migration.txt, docker
64-
wrapt==1.11.2 # via astroid
65-
yarl==1.4.2 # via -r requirements/_migration.txt, aiohttp
54+
urllib3==1.25.9 # via -r _migration.txt, requests
55+
wcwidth==0.1.9 # via pytest
56+
websocket-client==0.57.0 # via -r _migration.txt, docker
57+
wrapt==1.12.1 # via astroid
58+
yarl==1.4.2 # via -r _migration.txt, aiohttp
6659
zipp==3.1.0 # via importlib-metadata

packages/postgres-database/requirements/dev.txt

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111

1212
# current module
1313
-e .[migration]
14+
15+
# basic dev tools
16+
-r ../../../requirements.txt

0 commit comments

Comments
 (0)