Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: auto-updater on start, prisma output files on host machine #33

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]