From e4b4672e8a5ffb4e5dde7cb34b6f2784de8e9184 Mon Sep 17 00:00:00 2001 From: codebender <167290009+codebender37@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:24:05 +0700 Subject: [PATCH 1/2] fix: added bug fixes - fixed autoupdate need trigger docker-compose up initially - added generate prisma file and shared to validator service --- auto_update.py | 6 +++++- docker-compose.validator.yaml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/auto_update.py b/auto_update.py index 1b5195d..aa686b9 100755 --- a/auto_update.py +++ b/auto_update.py @@ -252,6 +252,7 @@ def main(service_name): config = CONFIG[service_name] pull_docker_images(config["images"]) + restart_docker(service_name) try: # Start the periodic check loop @@ -259,6 +260,10 @@ def main(service_name): logger.info("Checking for updates...") current_dojo_version = get_current_version() new_dojo_version = get_latest_remote_tag() + + logger.info(f"Current version: {current_dojo_version}") + logger.info(f"Latest version: {new_dojo_version}") + has_image_updates = check_for_image_updates(config["images"]) # Check if either the version has changed or there are image updates @@ -271,7 +276,6 @@ def main(service_name): # Restart Docker if there are any updates restart_docker(service_name) - logger.info(f"Sleeping for {CHECK_INTERVAL} seconds.") time.sleep(CHECK_INTERVAL) except KeyboardInterrupt: diff --git a/docker-compose.validator.yaml b/docker-compose.validator.yaml index 4ae20f3..e80c254 100644 --- a/docker-compose.validator.yaml +++ b/docker-compose.validator.yaml @@ -7,6 +7,7 @@ volumes: redis-validator-volume: prisma-pip-cache: prisma-binary: + prisma-data: networks: dojo-validator: @@ -98,6 +99,7 @@ services: volumes: - prisma-pip-cache:/root/.cache/pip - prisma-binary:/root/prisma-python + - prisma-data:/app/database/prisma - ./:/app networks: - dojo-validator @@ -115,6 +117,7 @@ services: - ./.env.validator:/app/.env - $HOME/.bittensor:/root/.bittensor - prisma-binary:/root/prisma-python + - prisma-data:/app/database/prisma command: ["validator"] networks: - dojo-validator From 769c79521b032c4aeba9d2a881782baa7b4c9e56 Mon Sep 17 00:00:00 2001 From: codebender <167290009+codebender37@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:33:08 +0700 Subject: [PATCH 2/2] chore: fixed prisma service not generating database/prisma on host machine --- docker-compose.validator.yaml | 5 ++--- docker/Dockerfile.validator.prisma | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docker-compose.validator.yaml b/docker-compose.validator.yaml index e80c254..e6fe966 100644 --- a/docker-compose.validator.yaml +++ b/docker-compose.validator.yaml @@ -7,7 +7,6 @@ volumes: redis-validator-volume: prisma-pip-cache: prisma-binary: - prisma-data: networks: dojo-validator: @@ -93,13 +92,14 @@ services: build: context: . dockerfile: ./docker/Dockerfile.validator.prisma + command: > + sh -c "prisma migrate deploy && prisma generate" env_file: - .env.validator working_dir: /app volumes: - prisma-pip-cache:/root/.cache/pip - prisma-binary:/root/prisma-python - - prisma-data:/app/database/prisma - ./:/app networks: - dojo-validator @@ -117,7 +117,6 @@ services: - ./.env.validator:/app/.env - $HOME/.bittensor:/root/.bittensor - prisma-binary:/root/prisma-python - - prisma-data:/app/database/prisma command: ["validator"] networks: - dojo-validator diff --git a/docker/Dockerfile.validator.prisma b/docker/Dockerfile.validator.prisma index 15daff8..1c94813 100644 --- a/docker/Dockerfile.validator.prisma +++ b/docker/Dockerfile.validator.prisma @@ -21,9 +21,5 @@ ENV PRISMA_BINARY_CACHE_DIR=/root/prisma-python COPY ./schema.prisma /app/schema.prisma RUN pip install prisma -RUN prisma generate RUN [ -n "$$DATABASE_URL" ] - -# Push Prisma schema to the database -CMD ["prisma", "migrate", "deploy"]