mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 20:38:32 +02:00
Add retries (#2358)
* Add retries * fix * add * remove --build * Remove cache-to * Don't push * Add back push * Add newline * Remove alembic logs
This commit is contained in:
76
.github/actions/custom-build-and-push/action.yml
vendored
Normal file
76
.github/actions/custom-build-and-push/action.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: 'Build and Push Docker Image with Retry'
|
||||||
|
description: 'Attempts to build and push a Docker image, with a retry on failure'
|
||||||
|
inputs:
|
||||||
|
context:
|
||||||
|
description: 'Build context'
|
||||||
|
required: true
|
||||||
|
file:
|
||||||
|
description: 'Dockerfile location'
|
||||||
|
required: true
|
||||||
|
platforms:
|
||||||
|
description: 'Target platforms'
|
||||||
|
required: true
|
||||||
|
pull:
|
||||||
|
description: 'Always attempt to pull a newer version of the image'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
push:
|
||||||
|
description: 'Push the image to registry'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
load:
|
||||||
|
description: 'Load the image into Docker daemon'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
tags:
|
||||||
|
description: 'Image tags'
|
||||||
|
required: true
|
||||||
|
cache-from:
|
||||||
|
description: 'Cache sources'
|
||||||
|
required: false
|
||||||
|
cache-to:
|
||||||
|
description: 'Cache destinations'
|
||||||
|
required: false
|
||||||
|
retry-wait-time:
|
||||||
|
description: 'Time to wait before retry in seconds'
|
||||||
|
required: false
|
||||||
|
default: '5'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Build and push Docker image (First Attempt)
|
||||||
|
id: buildx1
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
context: ${{ inputs.context }}
|
||||||
|
file: ${{ inputs.file }}
|
||||||
|
platforms: ${{ inputs.platforms }}
|
||||||
|
pull: ${{ inputs.pull }}
|
||||||
|
push: ${{ inputs.push }}
|
||||||
|
load: ${{ inputs.load }}
|
||||||
|
tags: ${{ inputs.tags }}
|
||||||
|
cache-from: ${{ inputs.cache-from }}
|
||||||
|
cache-to: ${{ inputs.cache-to }}
|
||||||
|
|
||||||
|
- name: Wait to retry
|
||||||
|
if: steps.buildx1.outcome != 'success'
|
||||||
|
run: |
|
||||||
|
echo "First attempt failed. Waiting ${{ inputs.retry-wait-time }} seconds before retry..."
|
||||||
|
sleep ${{ inputs.retry-wait-time }}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Build and push Docker image (Retry Attempt)
|
||||||
|
if: steps.buildx1.outcome != 'success'
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ${{ inputs.context }}
|
||||||
|
file: ${{ inputs.file }}
|
||||||
|
platforms: ${{ inputs.platforms }}
|
||||||
|
pull: ${{ inputs.pull }}
|
||||||
|
push: ${{ inputs.push }}
|
||||||
|
load: ${{ inputs.load }}
|
||||||
|
tags: ${{ inputs.tags }}
|
||||||
|
cache-from: ${{ inputs.cache-from }}
|
||||||
|
cache-to: ${{ inputs.cache-to }}
|
38
.github/workflows/run-it.yml
vendored
38
.github/workflows/run-it.yml
vendored
@@ -28,30 +28,20 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
- name: Build Web Docker image
|
# NOTE: we don't need to build the Web Docker image since it's not used
|
||||||
uses: docker/build-push-action@v5
|
# during the IT for now. We have a separate action to verify it builds
|
||||||
with:
|
# succesfully
|
||||||
context: ./web
|
- name: Pull Web Docker image
|
||||||
file: ./web/Dockerfile
|
run: |
|
||||||
platforms: linux/arm64
|
docker pull danswer/danswer-web-server:latest
|
||||||
pull: true
|
docker tag danswer/danswer-web-server:latest danswer/danswer-web-server:it
|
||||||
push: true
|
|
||||||
load: true
|
|
||||||
tags: danswer/danswer-web-server:it
|
|
||||||
cache-from: type=registry,ref=danswer/danswer-web-server:it
|
|
||||||
cache-to: |
|
|
||||||
type=registry,ref=danswer/danswer-web-server:it,mode=max
|
|
||||||
type=inline
|
|
||||||
|
|
||||||
- name: Build Backend Docker image
|
- name: Build Backend Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: ./.github/actions/custom-build-and-push
|
||||||
with:
|
with:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
file: ./backend/Dockerfile
|
file: ./backend/Dockerfile
|
||||||
platforms: linux/arm64
|
platforms: linux/arm64
|
||||||
pull: true
|
|
||||||
push: true
|
|
||||||
load: true
|
|
||||||
tags: danswer/danswer-backend:it
|
tags: danswer/danswer-backend:it
|
||||||
cache-from: type=registry,ref=danswer/danswer-backend:it
|
cache-from: type=registry,ref=danswer/danswer-backend:it
|
||||||
cache-to: |
|
cache-to: |
|
||||||
@@ -59,14 +49,11 @@ jobs:
|
|||||||
type=inline
|
type=inline
|
||||||
|
|
||||||
- name: Build Model Server Docker image
|
- name: Build Model Server Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: ./.github/actions/custom-build-and-push
|
||||||
with:
|
with:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
file: ./backend/Dockerfile.model_server
|
file: ./backend/Dockerfile.model_server
|
||||||
platforms: linux/arm64
|
platforms: linux/arm64
|
||||||
pull: true
|
|
||||||
push: true
|
|
||||||
load: true
|
|
||||||
tags: danswer/danswer-model-server:it
|
tags: danswer/danswer-model-server:it
|
||||||
cache-from: type=registry,ref=danswer/danswer-model-server:it
|
cache-from: type=registry,ref=danswer/danswer-model-server:it
|
||||||
cache-to: |
|
cache-to: |
|
||||||
@@ -74,14 +61,11 @@ jobs:
|
|||||||
type=inline
|
type=inline
|
||||||
|
|
||||||
- name: Build integration test Docker image
|
- name: Build integration test Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: ./.github/actions/custom-build-and-push
|
||||||
with:
|
with:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
file: ./backend/tests/integration/Dockerfile
|
file: ./backend/tests/integration/Dockerfile
|
||||||
platforms: linux/arm64
|
platforms: linux/arm64
|
||||||
pull: true
|
|
||||||
push: true
|
|
||||||
load: true
|
|
||||||
tags: danswer/integration-test-runner:it
|
tags: danswer/integration-test-runner:it
|
||||||
cache-from: type=registry,ref=danswer/integration-test-runner:it
|
cache-from: type=registry,ref=danswer/integration-test-runner:it
|
||||||
cache-to: |
|
cache-to: |
|
||||||
@@ -96,7 +80,7 @@ jobs:
|
|||||||
REQUIRE_EMAIL_VERIFICATION=false \
|
REQUIRE_EMAIL_VERIFICATION=false \
|
||||||
DISABLE_TELEMETRY=true \
|
DISABLE_TELEMETRY=true \
|
||||||
IMAGE_TAG=it \
|
IMAGE_TAG=it \
|
||||||
docker compose -f docker-compose.dev.yml -p danswer-stack up -d --build
|
docker compose -f docker-compose.dev.yml -p danswer-stack up -d
|
||||||
id: start_docker
|
id: start_docker
|
||||||
|
|
||||||
- name: Wait for service to be ready
|
- name: Wait for service to be ready
|
||||||
|
@@ -16,7 +16,9 @@ config = context.config
|
|||||||
|
|
||||||
# Interpret the config file for Python logging.
|
# Interpret the config file for Python logging.
|
||||||
# This line sets up loggers basically.
|
# This line sets up loggers basically.
|
||||||
if config.config_file_name is not None:
|
if config.config_file_name is not None and config.attributes.get(
|
||||||
|
"configure_logger", True
|
||||||
|
):
|
||||||
fileConfig(config.config_file_name)
|
fileConfig(config.config_file_name)
|
||||||
|
|
||||||
# add your model's MetaData object here
|
# add your model's MetaData object here
|
||||||
|
@@ -31,6 +31,7 @@ def _run_migrations(
|
|||||||
# Create an Alembic configuration object
|
# Create an Alembic configuration object
|
||||||
alembic_cfg = Config("alembic.ini")
|
alembic_cfg = Config("alembic.ini")
|
||||||
alembic_cfg.set_section_option("logger_alembic", "level", "WARN")
|
alembic_cfg.set_section_option("logger_alembic", "level", "WARN")
|
||||||
|
alembic_cfg.attributes["configure_logger"] = False
|
||||||
|
|
||||||
# Set the SQLAlchemy URL in the Alembic configuration
|
# Set the SQLAlchemy URL in the Alembic configuration
|
||||||
alembic_cfg.set_main_option("sqlalchemy.url", database_url)
|
alembic_cfg.set_main_option("sqlalchemy.url", database_url)
|
||||||
|
Reference in New Issue
Block a user