fix: force recreate postgres with pgvector before app startup in deploy pipeline
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 5s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 5s
This commit is contained in:
@@ -124,12 +124,35 @@ jobs:
|
||||
git fetch origin main
|
||||
git reset --hard origin/main
|
||||
|
||||
echo "=== Building ==="
|
||||
echo "=== Pull & recreate postgres with pgvector ==="
|
||||
docker compose pull postgres
|
||||
docker compose up -d --force-recreate postgres
|
||||
|
||||
echo "=== Waiting for postgres healthy ==="
|
||||
for i in $(seq 1 30); do
|
||||
if docker compose exec -T postgres pg_isready -U "${POSTGRES_USER:-memento}" >/dev/null 2>&1; then
|
||||
echo "Postgres healthy after $((i * 2))s"
|
||||
break
|
||||
fi
|
||||
if [ "$i" -eq 30 ]; then
|
||||
echo "ERROR: Postgres not healthy after 60s"
|
||||
docker compose logs postgres --tail=30
|
||||
exit 1
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "=== Create vector extension ==="
|
||||
docker compose exec -T postgres psql -U "${POSTGRES_USER:-memento}" -d "${POSTGRES_DB:-memento}" -c "CREATE EXTENSION IF NOT EXISTS vector;"
|
||||
|
||||
echo "=== Resolve failed prisma migrations ==="
|
||||
docker compose exec -T postgres psql -U "${POSTGRES_USER:-memento}" -d "${POSTGRES_DB:-memento}" -c "UPDATE \"_prisma_migrations\" SET \"finished_at\"=NOW(), \"rolled_back_at\"=NULL WHERE \"finished_at\" IS NULL AND \"rolled_back_at\" IS NULL;" || true
|
||||
|
||||
echo "=== Building app images ==="
|
||||
docker compose build memento-note
|
||||
docker compose build mcp-server
|
||||
|
||||
echo "=== Starting ==="
|
||||
echo "=== Starting app containers ==="
|
||||
docker compose up -d --remove-orphans
|
||||
docker compose ps
|
||||
ENDSSH
|
||||
|
||||
Reference in New Issue
Block a user