From 5ed57efbdd596b5ba99d1943e0e1688247f36487 Mon Sep 17 00:00:00 2001 From: Joe Matthew Date: Wed, 11 Sep 2024 17:55:48 +0200 Subject: [PATCH 1/6] feat: PAN-2112 development watch mode --- .github/workflows/ci.yaml | 1 + Makefile | 33 ++++++++--- debian/rules | 3 +- docker-compose.override.yml | 4 ++ docker-compose.yml | 74 ++++++++++++++++++++++++ linux/scripts/pantos-service-node-celery | 11 +++- linux/scripts/start-web.py | 5 ++ poetry.lock | 44 +++++++++++++- pyproject.toml | 1 + 9 files changed, 165 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ee40ffb..6763571 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -336,6 +336,7 @@ jobs: sparse-checkout: | docker-compose.yml docker-compose.override.yml + service-node-config.docker.env Makefile - name: Download artifacts diff --git a/Makefile b/Makefile index 50e2096..6e971f7 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ PYTHON_FILES_WITHOUT_TESTS := pantos/servicenode linux/scripts/start-web.py PYTHON_FILES := $(PYTHON_FILES_WITHOUT_TESTS) tests STACK_BASE_NAME=stack-service-node INSTANCE_COUNT ?= 1 +DEV_MODE ?= false .PHONY: check-version check-version: @@ -246,16 +247,34 @@ docker-build: docker buildx bake -f docker-compose.yml --load $(ARGS); \ fi +.PHONY: docker docker: check-swarm-init docker-build @for i in $$(seq 1 $(INSTANCE_COUNT)); do \ - ( \ - STACK_NAME="${STACK_BASE_NAME}-${STACK_IDENTIFIER}-$$i"; \ - export INSTANCE=$$i; \ - echo "Deploying stack $$STACK_NAME"; \ - docker compose -f docker-compose.yml -f docker-compose.override.yml -p $$STACK_NAME $(EXTRA_COMPOSE) up -d --wait $(ARGS); \ - ) & \ + ( \ + export STACK_NAME="${STACK_BASE_NAME}-${STACK_IDENTIFIER}-$$i"; \ + export INSTANCE=$$i; \ + echo "Deploying stack $$STACK_NAME"; \ + if [ "$(DEV_MODE)" = "true" ]; then \ + echo "Running in development mode"; \ + export ARGS="$(ARGS) --watch"; \ + docker compose -f docker-compose.yml -f docker-compose.override.yml -p $$STACK_NAME $$EXTRA_COMPOSE up $$ARGS & \ + COMPOSE_PID=$$!; \ + trap 'echo "Caught SIGINT, killing background processes..."; kill $$COMPOSE_PID; exit 1' SIGINT; \ + else \ + export ARGS="--detach --wait $(ARGS)"; \ + docker compose -f docker-compose.yml -f docker-compose.override.yml -p $$STACK_NAME $$EXTRA_COMPOSE up $$ARGS; \ + fi; \ + trap 'exit 1' SIGINT; \ + echo "Stack $$STACK_NAME deployed"; \ + if [ "$(DEV_MODE)" = "true" ]; then \ + wait $$COMPOSE_PID; \ + fi; \ + ) & \ done; \ - wait + trap 'echo "Caught SIGINT, killing all background processes..."; kill 0; exit 1' SIGINT; \ + wait + # We need to use compose because swarm goes absolutely crazy on MacOS when using cross architecture + # And can't pull the correct images #docker stack deploy -c docker-compose.yml -c docker-compose.override.yml $$STACK_NAME --with-registry-auth --detach=false $(ARGS) & \ .PHONY: docker-remove diff --git a/debian/rules b/debian/rules index 3512a84..aa4a393 100755 --- a/debian/rules +++ b/debian/rules @@ -14,7 +14,7 @@ DH_VERBOSE=1 export DH_VIRTUALENV_INSTALL_ROOT=/opt/pantos export POETRY_VIRTUALENVS_CREATE=false -PYTHON_VERSION ?= 3.12 +PYTHON_VERSION = 3.12.4 SNAKE=debian/$(PACKAGE)$(DH_VIRTUALENV_INSTALL_ROOT)/$(PACKAGE)/bin/python3 EXTRA_REQUIREMENTS=--upgrade-pip --preinstall "setuptools>=38" --preinstall "poetry" --preinstall "dh-poetry" DH_VENV_ARGS=--builtin-venv --python=$(SNAKE) $(EXTRA_REQUIREMENTS) \ @@ -44,6 +44,7 @@ build-arch: override_dh_virtualenv: . $$(conda info --base)/etc/profile.d/conda.sh && \ + conda search --full-name python && \ conda create -y -c defaults -c conda-forge --prefix $(POETRY_VIRTUALENVS_PATH) python=$(PYTHON_VERSION) && \ conda activate $(POETRY_VIRTUALENVS_PATH) && \ dh_virtualenv $(DH_VENV_ARGS) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 6c66d1b..0f91dc2 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -63,6 +63,10 @@ services: source: ./service-node-config.docker.env target: /etc/pantos/service-node-config.env read_only: true + watch: + - action: sync+restart + path: service-node-config.docker.env + target: /root/service-node-config.docker.env volumes: bnb-data: diff --git a/docker-compose.yml b/docker-compose.yml index 2a34c57..68ff4d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: DB_URL: postgresql://pantos-service-node:pantos@db/pantos-service-node CELERY_BROKER: amqp://pantos-service-node:pantos@broker:5672/pantos-service-node CELERY_BACKEND: db+postgresql://pantos-service-node:pantos@db/pantos-service-node-celery + DEV_MODE: ${DEV_MODE} ports: - 808${INSTANCE-0}:8080 healthcheck: @@ -47,6 +48,42 @@ services: condition: service_healthy db: condition: service_healthy + develop: + watch: + - action: sync + path: ./pantos + target: /opt/pantos/pantos-service-node/lib/python3.12/site-packages/pantos + - action: sync+restart + path: ./linux/scripts/start-web.py + target: /opt/pantos/pantos-service-node/bin/start-web.py + - action: sync+restart + path: ./linux/scripts/pantos-service-node-server + target: /opt/pantos/pantos-service-node/bin/pantos-service-node-server + - action: sync+restart + path: service-node-config.yml + target: /opt/pantos/pantos-service-node/service-node-config.yml + - action: sync+restart + path: alembic.ini + target: /opt/pantos/pantos-service-node/alembic.ini + - action: sync+restart + path: service-node-config.env + target: /root/service-node-config.env + - action: sync+restart + path: bids.yml + target: /etc/service-node-bids.yml + - action: rebuild + path: Dockerfile + - action: rebuild + path: debian + - action: rebuild + path: configurator + - action: rebuild + path: linux/etc + - action: rebuild + path: pyproject.toml + - action: rebuild + path: poetry.lock + worker: deploy: restart_policy: @@ -77,6 +114,7 @@ services: DB_URL: postgresql://pantos-service-node:pantos@db/pantos-service-node CELERY_BROKER: amqp://pantos-service-node:pantos@broker:5672/pantos-service-node CELERY_BACKEND: db+postgresql://pantos-service-node:pantos@db/pantos-service-node-celery + DEV_MODE: ${DEV_MODE} healthcheck: test: ["CMD", "/usr/bin/pantos-service-node-celery", "--status"] interval: 5s @@ -87,6 +125,39 @@ services: # Wait for the app to setup the DB app: condition: service_healthy + develop: + watch: + - action: sync + path: ./pantos + target: /opt/pantos/pantos-service-node/lib/python3.12/site-packages/pantos + - action: sync+restart + path: ./linux/scripts/pantos-service-node-celery + target: /opt/pantos/pantos-service-node/bin/pantos-service-node-celery + - action: sync+restart + path: service-node-config.yml + target: /opt/pantos/pantos-service-node/service-node-config.yml + - action: sync+restart + path: alembic.ini + target: /opt/pantos/pantos-service-node/alembic.ini + - action: sync+restart + path: service-node-config.env + target: /root/service-node-config.env + - action: sync+restart + path: bids.yml + target: /etc/service-node-bids.yml + - action: rebuild + path: Dockerfile + - action: rebuild + path: debian + - action: rebuild + path: configurator + - action: rebuild + path: linux/etc + - action: rebuild + path: pyproject.toml + - action: rebuild + path: poetry.lock + db: image: postgres:latest deploy: @@ -112,6 +183,9 @@ services: source: ./db_init.sh target: /docker-entrypoint-initdb.d/init-user-db.sh read_only: true + watch: + - action: rebuild + path: db_init.sh broker: image: rabbitmq:latest deploy: diff --git a/linux/scripts/pantos-service-node-celery b/linux/scripts/pantos-service-node-celery index 626c430..2093955 100644 --- a/linux/scripts/pantos-service-node-celery +++ b/linux/scripts/pantos-service-node-celery @@ -49,9 +49,15 @@ while [ $# -gt 0 ]; do esac done +PROGRAM="./bin/python" +if [ "$DEV_MODE" = "true" ]; then + echo "Running in development mode" + PROGRAM="./bin/python watchmedo autorestart --directory=$APP_DIR --pattern=*.py --recursive -- ./bin/python" +fi + if [ -n "$PANTOS_STATUS_MONITOR" ]; then echo "Starting the status monitor" - exec ./bin/python -m celery -A pantos.servicenode flower & + $PROGRAM -m celery -A pantos.servicenode flower & fi # Check if the current user is not "pantos-service-node" and if so, switch to that user @@ -61,9 +67,10 @@ if [ "$(id -u)" -ne "$(id -u "$APP_NAME")" ]; then EXTRA_ARGS="--uid $(id -u "$APP_NAME")" fi + while true; do echo "Starting the celery worker" - ./bin/python -m celery -A pantos.servicenode worker $EXTRA_ARGS -l INFO -n pantos.servicenode -Q transfers,bids + $PROGRAM -m celery -A pantos.servicenode worker $EXTRA_ARGS -l INFO -n pantos.servicenode -Q transfers,bids PYTHON_EXIT_CODE=$? if [ "$PANTOS_CELERY_AUTORESTART" != "true" ]; then diff --git a/linux/scripts/start-web.py b/linux/scripts/start-web.py index ad81722..2885ba0 100644 --- a/linux/scripts/start-web.py +++ b/linux/scripts/start-web.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Start the service node server.""" +import os import subprocess import sys from importlib import resources @@ -80,5 +81,9 @@ server_run_command = ['runuser', '-u', USER_NAME, '--' ] + gunicorn_command.split() +if os.getenv('DEV_MODE', False) == 'true': + print('Running in development mode') + server_run_command = server_run_command + ['--reload', '--log-level', 'debug'] + print('Starting the server...') subprocess.run(server_run_command, check=True, text=True) diff --git a/poetry.lock b/poetry.lock index 5199387..bcc13d5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3471,6 +3471,48 @@ platformdirs = ">=3.9.1,<5" docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] +[[package]] +name = "watchdog" +version = "5.0.2" +description = "Filesystem events monitoring" +optional = false +python-versions = ">=3.9" +files = [ + {file = "watchdog-5.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d961f4123bb3c447d9fcdcb67e1530c366f10ab3a0c7d1c0c9943050936d4877"}, + {file = "watchdog-5.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72990192cb63872c47d5e5fefe230a401b87fd59d257ee577d61c9e5564c62e5"}, + {file = "watchdog-5.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6bec703ad90b35a848e05e1b40bf0050da7ca28ead7ac4be724ae5ac2653a1a0"}, + {file = "watchdog-5.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:dae7a1879918f6544201d33666909b040a46421054a50e0f773e0d870ed7438d"}, + {file = "watchdog-5.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c4a440f725f3b99133de610bfec93d570b13826f89616377715b9cd60424db6e"}, + {file = "watchdog-5.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f8b2918c19e0d48f5f20df458c84692e2a054f02d9df25e6c3c930063eca64c1"}, + {file = "watchdog-5.0.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:aa9cd6e24126d4afb3752a3e70fce39f92d0e1a58a236ddf6ee823ff7dba28ee"}, + {file = "watchdog-5.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f627c5bf5759fdd90195b0c0431f99cff4867d212a67b384442c51136a098ed7"}, + {file = "watchdog-5.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d7594a6d32cda2b49df3fd9abf9b37c8d2f3eab5df45c24056b4a671ac661619"}, + {file = "watchdog-5.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba32efcccfe2c58f4d01115440d1672b4eb26cdd6fc5b5818f1fb41f7c3e1889"}, + {file = "watchdog-5.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:963f7c4c91e3f51c998eeff1b3fb24a52a8a34da4f956e470f4b068bb47b78ee"}, + {file = "watchdog-5.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:8c47150aa12f775e22efff1eee9f0f6beee542a7aa1a985c271b1997d340184f"}, + {file = "watchdog-5.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:14dd4ed023d79d1f670aa659f449bcd2733c33a35c8ffd88689d9d243885198b"}, + {file = "watchdog-5.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b84bff0391ad4abe25c2740c7aec0e3de316fdf7764007f41e248422a7760a7f"}, + {file = "watchdog-5.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3e8d5ff39f0a9968952cce548e8e08f849141a4fcc1290b1c17c032ba697b9d7"}, + {file = "watchdog-5.0.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:fb223456db6e5f7bd9bbd5cd969f05aae82ae21acc00643b60d81c770abd402b"}, + {file = "watchdog-5.0.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:9814adb768c23727a27792c77812cf4e2fd9853cd280eafa2bcfa62a99e8bd6e"}, + {file = "watchdog-5.0.2-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:901ee48c23f70193d1a7bc2d9ee297df66081dd5f46f0ca011be4f70dec80dab"}, + {file = "watchdog-5.0.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:638bcca3d5b1885c6ec47be67bf712b00a9ab3d4b22ec0881f4889ad870bc7e8"}, + {file = "watchdog-5.0.2-py3-none-manylinux2014_aarch64.whl", hash = "sha256:5597c051587f8757798216f2485e85eac583c3b343e9aa09127a3a6f82c65ee8"}, + {file = "watchdog-5.0.2-py3-none-manylinux2014_armv7l.whl", hash = "sha256:53ed1bf71fcb8475dd0ef4912ab139c294c87b903724b6f4a8bd98e026862e6d"}, + {file = "watchdog-5.0.2-py3-none-manylinux2014_i686.whl", hash = "sha256:29e4a2607bd407d9552c502d38b45a05ec26a8e40cc7e94db9bb48f861fa5abc"}, + {file = "watchdog-5.0.2-py3-none-manylinux2014_ppc64.whl", hash = "sha256:b6dc8f1d770a8280997e4beae7b9a75a33b268c59e033e72c8a10990097e5fde"}, + {file = "watchdog-5.0.2-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:d2ab34adc9bf1489452965cdb16a924e97d4452fcf88a50b21859068b50b5c3b"}, + {file = "watchdog-5.0.2-py3-none-manylinux2014_s390x.whl", hash = "sha256:7d1aa7e4bb0f0c65a1a91ba37c10e19dabf7eaaa282c5787e51371f090748f4b"}, + {file = "watchdog-5.0.2-py3-none-manylinux2014_x86_64.whl", hash = "sha256:726eef8f8c634ac6584f86c9c53353a010d9f311f6c15a034f3800a7a891d941"}, + {file = "watchdog-5.0.2-py3-none-win32.whl", hash = "sha256:bda40c57115684d0216556671875e008279dea2dc00fcd3dde126ac8e0d7a2fb"}, + {file = "watchdog-5.0.2-py3-none-win_amd64.whl", hash = "sha256:d010be060c996db725fbce7e3ef14687cdcc76f4ca0e4339a68cc4532c382a73"}, + {file = "watchdog-5.0.2-py3-none-win_ia64.whl", hash = "sha256:3960136b2b619510569b90f0cd96408591d6c251a75c97690f4553ca88889769"}, + {file = "watchdog-5.0.2.tar.gz", hash = "sha256:dcebf7e475001d2cdeb020be630dc5b687e9acdd60d16fea6bb4508e7b94cf76"}, +] + +[package.extras] +watchmedo = ["PyYAML (>=3.10)"] + [[package]] name = "wcwidth" version = "0.2.13" @@ -3752,4 +3794,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "e1ae7ec498bdf9b8d9693828441d974fd394ebbf5ce24c10387dd7f7bbd8ebc5" +content-hash = "98b08fcd038fa7d76d89a1a8d3d007698c3d7b90f8eb707c9ef1fe6606e88768" diff --git a/pyproject.toml b/pyproject.toml index 6ee646e..f9cb1d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,7 @@ requests = "^2.32.3" flower = "^2.0.1" types-requests = "^2.32.0.20240622" types-sqlalchemy = "^1.4.53.38" +watchdog = "^5.0.2" [build-system] requires = ["poetry-core"] From 083d7cfc95297ac91d9c6154c8dff9df6ec2ee96 Mon Sep 17 00:00:00 2001 From: Joe Matthew Date: Wed, 11 Sep 2024 18:01:27 +0200 Subject: [PATCH 2/6] fix: linting --- linux/scripts/start-web.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux/scripts/start-web.py b/linux/scripts/start-web.py index 2885ba0..58a3e41 100644 --- a/linux/scripts/start-web.py +++ b/linux/scripts/start-web.py @@ -83,7 +83,9 @@ if os.getenv('DEV_MODE', False) == 'true': print('Running in development mode') - server_run_command = server_run_command + ['--reload', '--log-level', 'debug'] + server_run_command = server_run_command + [ + '--reload', '--log-level', 'debug' + ] print('Starting the server...') subprocess.run(server_run_command, check=True, text=True) From afac7c33ae00dc1c1d5fcc3c4ed23bf8539d9d08 Mon Sep 17 00:00:00 2001 From: Joe Matthew Date: Wed, 11 Sep 2024 18:02:52 +0200 Subject: [PATCH 3/6] fix: missing entry --- docker-compose.override.yml | 14 ++++++++++---- docker-compose.yml | 8 +++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 0f91dc2..fa116c2 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -32,6 +32,11 @@ services: source: ./service-node-config.docker.env target: /etc/pantos/service-node-config.env read_only: true + develop: + watch: + - action: sync+restart + path: service-node-config.docker.env + target: /root/service-node-config.docker.env worker: networks: @@ -63,10 +68,11 @@ services: source: ./service-node-config.docker.env target: /etc/pantos/service-node-config.env read_only: true - watch: - - action: sync+restart - path: service-node-config.docker.env - target: /root/service-node-config.docker.env + develop: + watch: + - action: sync+restart + path: service-node-config.docker.env + target: /root/service-node-config.docker.env volumes: bnb-data: diff --git a/docker-compose.yml b/docker-compose.yml index 68ff4d1..367861b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -183,9 +183,11 @@ services: source: ./db_init.sh target: /docker-entrypoint-initdb.d/init-user-db.sh read_only: true - watch: - - action: rebuild - path: db_init.sh + develop: + watch: + - action: rebuild + path: db_init.sh + broker: image: rabbitmq:latest deploy: From 3a16c6dd76954a11a578036aa2130870cd7aacf5 Mon Sep 17 00:00:00 2001 From: Joe Matthew Date: Fri, 13 Sep 2024 08:34:42 +0200 Subject: [PATCH 4/6] fix: readme fixes --- README.md | 18 ++++++++++++++++++ docker-compose.override.yml | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0e8a996..01527cf 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,24 @@ You can run a local setup with docker by doing the following steps: - Ensure you have a `signer_key` file located in the same directory. If you don't, you can create one with `make signer-key` - Run `make docker` +##### Local development with Docker + +You can do local development with Docker by enabling dev mode (Docker watch mode). To do so, set the environment variable `DEV_MODE` to true, like this: + +`DEV_MODE=true make docker` + +#### Multiple local deployments + +We support multiple local deployments, for example for testing purposes, you can run the stacks like this: + +`make docker INSTANCE_COUNT=` + +To remove all the stacks, run the following: + +`make docker-remove` + +Please note that this mode uses an incremental amount of resources and that Docker Desktop doesn't fully support displaying it, but it should be good enough to test multi-sig locally. + ##### Production Setup The production setup is slightly different, for convenience we provide a separate `.env` file and `make` method. diff --git a/docker-compose.override.yml b/docker-compose.override.yml index fa116c2..adb8c5d 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -9,7 +9,7 @@ services: networks: pantos-service-node: pantos-ethereum: - entrypoint: sh -c 'set -a; . /etc/pantos/eth-data/ETHEREUM.env && . /etc/pantos/bnb-data/BNB.env; set +a; exec /usr/bin/pantos-service-node-server' + entrypoint: sh -c 'set -a; . /etc/pantos/eth-data/ETHEREUM.env && . /etc/pantos/bnb-data/BNB_CHAIN.env; set +a; exec /usr/bin/pantos-service-node-server' environment: PANTOS_ENV_FILE: /etc/pantos/service-node-config.env APP_URL: http://localhost:808${INSTANCE-1} @@ -42,7 +42,7 @@ services: networks: pantos-service-node: pantos-ethereum: - entrypoint: sh -c 'set -a; . /etc/pantos/eth-data/ETHEREUM.env && . /etc/pantos/bnb-data/BNB.env; set +a; exec /usr/bin/pantos-service-node-celery' + entrypoint: sh -c 'set -a; . /etc/pantos/eth-data/ETHEREUM.env && . /etc/pantos/bnb-data/BNB_CHAIN.env; set +a; exec /usr/bin/pantos-service-node-celery' environment: PANTOS_ENV_FILE: /etc/pantos/service-node-config.env APP_URL: http://localhost:808${INSTANCE-1} From e58926cbfc75411d4085727df4524c05b017e182 Mon Sep 17 00:00:00 2001 From: Joe Matthew Date: Fri, 13 Sep 2024 08:37:01 +0200 Subject: [PATCH 5/6] fix: typo --- linux/scripts/pantos-service-node-celery | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/scripts/pantos-service-node-celery b/linux/scripts/pantos-service-node-celery index 2093955..65a1fd2 100644 --- a/linux/scripts/pantos-service-node-celery +++ b/linux/scripts/pantos-service-node-celery @@ -52,7 +52,7 @@ done PROGRAM="./bin/python" if [ "$DEV_MODE" = "true" ]; then echo "Running in development mode" - PROGRAM="./bin/python watchmedo autorestart --directory=$APP_DIR --pattern=*.py --recursive -- ./bin/python" + PROGRAM="./bin/python -m watchme autorestart --directory=$APP_DIR --pattern=*.py --recursive -- ./bin/python" fi if [ -n "$PANTOS_STATUS_MONITOR" ]; then From 170d570a3f966062acb089dadc7c94b581a9e710 Mon Sep 17 00:00:00 2001 From: Joe Matthew Date: Thu, 19 Sep 2024 15:48:09 +0200 Subject: [PATCH 6/6] fix: comments --- README.md | 2 +- linux/scripts/pantos-service-node-celery | 3 +- poetry.lock | 44 +----------------------- pyproject.toml | 1 - 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 01527cf..37c8068 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ To remove all the stacks, run the following: `make docker-remove` -Please note that this mode uses an incremental amount of resources and that Docker Desktop doesn't fully support displaying it, but it should be good enough to test multi-sig locally. +Please note that this mode uses an incremental amount of resources and that Docker Desktop doesn't fully support displaying it, but it should be good enough to test multiple service nodes locally. ##### Production Setup diff --git a/linux/scripts/pantos-service-node-celery b/linux/scripts/pantos-service-node-celery index 65a1fd2..18e92dd 100644 --- a/linux/scripts/pantos-service-node-celery +++ b/linux/scripts/pantos-service-node-celery @@ -52,7 +52,8 @@ done PROGRAM="./bin/python" if [ "$DEV_MODE" = "true" ]; then echo "Running in development mode" - PROGRAM="./bin/python -m watchme autorestart --directory=$APP_DIR --pattern=*.py --recursive -- ./bin/python" + ./bin/pip install watchdog[watchmedo] + PROGRAM="./bin/watchme autorestart --directory=$APP_DIR --pattern=*.py --recursive -- ./bin/python" fi if [ -n "$PANTOS_STATUS_MONITOR" ]; then diff --git a/poetry.lock b/poetry.lock index bcc13d5..5199387 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3471,48 +3471,6 @@ platformdirs = ">=3.9.1,<5" docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] -[[package]] -name = "watchdog" -version = "5.0.2" -description = "Filesystem events monitoring" -optional = false -python-versions = ">=3.9" -files = [ - {file = "watchdog-5.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d961f4123bb3c447d9fcdcb67e1530c366f10ab3a0c7d1c0c9943050936d4877"}, - {file = "watchdog-5.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72990192cb63872c47d5e5fefe230a401b87fd59d257ee577d61c9e5564c62e5"}, - {file = "watchdog-5.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6bec703ad90b35a848e05e1b40bf0050da7ca28ead7ac4be724ae5ac2653a1a0"}, - {file = "watchdog-5.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:dae7a1879918f6544201d33666909b040a46421054a50e0f773e0d870ed7438d"}, - {file = "watchdog-5.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c4a440f725f3b99133de610bfec93d570b13826f89616377715b9cd60424db6e"}, - {file = "watchdog-5.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f8b2918c19e0d48f5f20df458c84692e2a054f02d9df25e6c3c930063eca64c1"}, - {file = "watchdog-5.0.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:aa9cd6e24126d4afb3752a3e70fce39f92d0e1a58a236ddf6ee823ff7dba28ee"}, - {file = "watchdog-5.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f627c5bf5759fdd90195b0c0431f99cff4867d212a67b384442c51136a098ed7"}, - {file = "watchdog-5.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d7594a6d32cda2b49df3fd9abf9b37c8d2f3eab5df45c24056b4a671ac661619"}, - {file = "watchdog-5.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba32efcccfe2c58f4d01115440d1672b4eb26cdd6fc5b5818f1fb41f7c3e1889"}, - {file = "watchdog-5.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:963f7c4c91e3f51c998eeff1b3fb24a52a8a34da4f956e470f4b068bb47b78ee"}, - {file = "watchdog-5.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:8c47150aa12f775e22efff1eee9f0f6beee542a7aa1a985c271b1997d340184f"}, - {file = "watchdog-5.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:14dd4ed023d79d1f670aa659f449bcd2733c33a35c8ffd88689d9d243885198b"}, - {file = "watchdog-5.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b84bff0391ad4abe25c2740c7aec0e3de316fdf7764007f41e248422a7760a7f"}, - {file = "watchdog-5.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3e8d5ff39f0a9968952cce548e8e08f849141a4fcc1290b1c17c032ba697b9d7"}, - {file = "watchdog-5.0.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:fb223456db6e5f7bd9bbd5cd969f05aae82ae21acc00643b60d81c770abd402b"}, - {file = "watchdog-5.0.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:9814adb768c23727a27792c77812cf4e2fd9853cd280eafa2bcfa62a99e8bd6e"}, - {file = "watchdog-5.0.2-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:901ee48c23f70193d1a7bc2d9ee297df66081dd5f46f0ca011be4f70dec80dab"}, - {file = "watchdog-5.0.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:638bcca3d5b1885c6ec47be67bf712b00a9ab3d4b22ec0881f4889ad870bc7e8"}, - {file = "watchdog-5.0.2-py3-none-manylinux2014_aarch64.whl", hash = "sha256:5597c051587f8757798216f2485e85eac583c3b343e9aa09127a3a6f82c65ee8"}, - {file = "watchdog-5.0.2-py3-none-manylinux2014_armv7l.whl", hash = "sha256:53ed1bf71fcb8475dd0ef4912ab139c294c87b903724b6f4a8bd98e026862e6d"}, - {file = "watchdog-5.0.2-py3-none-manylinux2014_i686.whl", hash = "sha256:29e4a2607bd407d9552c502d38b45a05ec26a8e40cc7e94db9bb48f861fa5abc"}, - {file = "watchdog-5.0.2-py3-none-manylinux2014_ppc64.whl", hash = "sha256:b6dc8f1d770a8280997e4beae7b9a75a33b268c59e033e72c8a10990097e5fde"}, - {file = "watchdog-5.0.2-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:d2ab34adc9bf1489452965cdb16a924e97d4452fcf88a50b21859068b50b5c3b"}, - {file = "watchdog-5.0.2-py3-none-manylinux2014_s390x.whl", hash = "sha256:7d1aa7e4bb0f0c65a1a91ba37c10e19dabf7eaaa282c5787e51371f090748f4b"}, - {file = "watchdog-5.0.2-py3-none-manylinux2014_x86_64.whl", hash = "sha256:726eef8f8c634ac6584f86c9c53353a010d9f311f6c15a034f3800a7a891d941"}, - {file = "watchdog-5.0.2-py3-none-win32.whl", hash = "sha256:bda40c57115684d0216556671875e008279dea2dc00fcd3dde126ac8e0d7a2fb"}, - {file = "watchdog-5.0.2-py3-none-win_amd64.whl", hash = "sha256:d010be060c996db725fbce7e3ef14687cdcc76f4ca0e4339a68cc4532c382a73"}, - {file = "watchdog-5.0.2-py3-none-win_ia64.whl", hash = "sha256:3960136b2b619510569b90f0cd96408591d6c251a75c97690f4553ca88889769"}, - {file = "watchdog-5.0.2.tar.gz", hash = "sha256:dcebf7e475001d2cdeb020be630dc5b687e9acdd60d16fea6bb4508e7b94cf76"}, -] - -[package.extras] -watchmedo = ["PyYAML (>=3.10)"] - [[package]] name = "wcwidth" version = "0.2.13" @@ -3794,4 +3752,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "98b08fcd038fa7d76d89a1a8d3d007698c3d7b90f8eb707c9ef1fe6606e88768" +content-hash = "e1ae7ec498bdf9b8d9693828441d974fd394ebbf5ce24c10387dd7f7bbd8ebc5" diff --git a/pyproject.toml b/pyproject.toml index f9cb1d6..6ee646e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,6 @@ requests = "^2.32.3" flower = "^2.0.1" types-requests = "^2.32.0.20240622" types-sqlalchemy = "^1.4.53.38" -watchdog = "^5.0.2" [build-system] requires = ["poetry-core"]