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

Increase wait time for initialisation to cover slow devices #1274

Merged
merged 1 commit into from
Dec 29, 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
2 changes: 1 addition & 1 deletion docker-compose-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ else

# Simple wait for database migrations
echo "Giving some time for the database to be ready, please wait ..."
sleep 60
sleep 50

echo "Initialize your superuser account..."
docker compose exec backend poetry run python manage.py createsuperuser
Expand Down
24 changes: 12 additions & 12 deletions docker-compose-remote.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#! /usr/bin/env bash

if [ -f db/ciso-assistant.sqlite3 ] ; then
echo "the database seems already created"
echo "you should launch docker compose -f docker-compose-remote.yml up -d"
echo "for clean start, you can remove the database file, run docker compose down and then docker compose rm and start again"
if [ -f db/ciso-assistant.sqlite3 ]; then
echo "the database seems already created"
echo "you should launch docker compose -f docker-compose-remote.yml up -d"
echo "for clean start, you can remove the database file, run docker compose down and then docker compose rm and start again"
else
docker rmi ghcr.io/intuitem/ciso-assistant-community/backend:latest ghcr.io/intuitem/ciso-assistant-community/frontend:latest 2> /dev/null
docker compose -f docker-compose-remote.yml up -d
echo "Giving some time for the database to be ready, please wait ..."
sleep 20
echo "initialize your superuser account..."
docker compose exec backend poetry run python manage.py createsuperuser
echo "connect to ciso assistant on https://cool-vm:8443"
echo "for successive runs you can now use docker compose up"
docker rmi ghcr.io/intuitem/ciso-assistant-community/backend:latest ghcr.io/intuitem/ciso-assistant-community/frontend:latest 2>/dev/null
docker compose -f docker-compose-remote.yml up -d
echo "Giving some time for the database to be ready, please wait ..."
sleep 50
echo "initialize your superuser account..."
docker compose exec backend poetry run python manage.py createsuperuser
echo "connect to ciso assistant on https://cool-vm:8443"
echo "for successive runs you can now use docker compose up"
fi
2 changes: 1 addition & 1 deletion docker-compose.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (Test-Path "db/ciso-assistant.sqlite3") {
# Bring up the Docker Compose services
docker-compose up -d
Write-Output "Giving some time for the database to be ready, please wait ..."
Start-Sleep -Seconds 20
Start-Sleep -Seconds 50
Write-Output "Initialize your superuser account..."
docker-compose exec backend poetry run python manage.py createsuperuser
Write-Output "Connect to CISO Assistant on https://localhost:8443"
Expand Down
24 changes: 12 additions & 12 deletions docker-compose.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#! /usr/bin/env bash

if [ -f db/ciso-assistant.sqlite3 ] ; then
echo "the database seems already created"
echo "you should launch docker compose up -d"
echo "for clean start, you can remove the database file, run docker compose down and then docker compose rm and start again"
if [ -f db/ciso-assistant.sqlite3 ]; then
echo "the database seems already created"
echo "you should launch docker compose up -d"
echo "for clean start, you can remove the database file, run docker compose down and then docker compose rm and start again"
else
docker rmi ghcr.io/intuitem/ciso-assistant-community/backend:latest ghcr.io/intuitem/ciso-assistant-community/frontend:latest 2> /dev/null
docker compose up -d
echo "Giving some time for the database to be ready, please wait ..."
sleep 30
echo "initialize your superuser account..."
docker compose exec backend poetry run python manage.py createsuperuser
echo "connect to ciso assistant on https://localhost:8443"
echo "for successive runs you can now use docker compose up"
docker rmi ghcr.io/intuitem/ciso-assistant-community/backend:latest ghcr.io/intuitem/ciso-assistant-community/frontend:latest 2>/dev/null
docker compose up -d
echo "Giving some time for the database to be ready, please wait (1 mn) ..."
sleep 50
echo "initialize your superuser account..."
docker compose exec backend poetry run python manage.py createsuperuser
echo "connect to ciso assistant on https://localhost:8443"
echo "for successive runs you can now use docker compose up"
fi
2 changes: 1 addition & 1 deletion enterprise/docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ else
docker rmi ghcr.io/intuitem/ciso-assistant-enterprise-backend:latest ghcr.io/intuitem/ciso-assistant-enterprise-frontend:latest 2>/dev/null
docker compose up -d
echo "Giving some time for the database to be ready, please wait ..."
sleep 30
sleep 50
echo "initialize your superuser account..."
docker compose exec backend poetry run python manage.py createsuperuser
echo "connect to ciso assistant on https://localhost:9443"
Expand Down
20 changes: 10 additions & 10 deletions update-ciso-assistant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@ DB_FILE="db/ciso-assistant.sqlite3"
BACKUP_FILE="ciso-assistant-backup.sqlite3"

if [ "$VERSION" = "enterprise" ]; then
BACKEND_IMAGE="ghcr.io/intuitem/ciso-assistant-enterprise-backend:latest"
FRONTEND_IMAGE="ghcr.io/intuitem/ciso-assistant-enterprise-frontend:latest"
BACKEND_IMAGE="ghcr.io/intuitem/ciso-assistant-enterprise-backend:latest"
FRONTEND_IMAGE="ghcr.io/intuitem/ciso-assistant-enterprise-frontend:latest"
else
BACKEND_IMAGE="ghcr.io/intuitem/ciso-assistant-community/backend:latest"
FRONTEND_IMAGE="ghcr.io/intuitem/ciso-assistant-community/frontend:latest"
BACKEND_IMAGE="ghcr.io/intuitem/ciso-assistant-community/backend:latest"
FRONTEND_IMAGE="ghcr.io/intuitem/ciso-assistant-community/frontend:latest"
fi

echo "Update of the version : $VERSION"

# Backup the database
if [ ! -f "$DB_FILE" ]; then
echo "Error: No database found, please initialize CISO Assistant first"
exit 1
echo "Error: No database found, please initialize CISO Assistant first"
exit 1
else
cp "$DB_FILE" "$BACKUP_FILE"
echo "Backup of the database created in $BACKUP_FILE"
cp "$DB_FILE" "$BACKUP_FILE"
echo "Backup of the database created in $BACKUP_FILE"
fi

# Stop the containers
docker compose down

# Remove the images
docker rmi "$BACKEND_IMAGE" "$FRONTEND_IMAGE" 2> /dev/null
docker rmi "$BACKEND_IMAGE" "$FRONTEND_IMAGE" 2>/dev/null

# Start the containers
docker compose up -d

# Wait for the database to be ready
echo "Giving some time for the database to be ready, please wait ..."
sleep 5
sleep 30

# Apply migrations
BACKEND_CONTAINER=$(docker ps --filter "ancestor=$BACKEND_IMAGE" --format "{{.Names}}")
Expand Down
Loading