Skip to content

Commit

Permalink
fix: auto-updater on start, prisma output files on host machine (#33)
Browse files Browse the repository at this point in the history
* fix: added bug fixes

- fixed autoupdate need trigger docker-compose up initially
- added generate prisma file and shared to validator service

* chore: fixed prisma service not generating database/prisma on host machine
  • Loading branch information
codebender37 authored Oct 24, 2024
1 parent 4366017 commit 0448f6c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 5 additions & 1 deletion auto_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,18 @@ def main(service_name):
config = CONFIG[service_name]

pull_docker_images(config["images"])
restart_docker(service_name)

try:
# Start the periodic check loop
while True:
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
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ services:
build:
context: .
dockerfile: ./docker/Dockerfile.validator.prisma
command: >
sh -c "prisma migrate deploy && prisma generate"
env_file:
- .env.validator
working_dir: /app
Expand Down
4 changes: 0 additions & 4 deletions docker/Dockerfile.validator.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 0448f6c

Please sign in to comment.