Improve Deployment Workflow and Database Migration Logic
Some checks failed
Test Suite / playwright-tests (push) Waiting to run
Deploy Development / deploy (push) Failing after 43s
Test Suite / pytest-backend (push) Failing after 31s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Has been cancelled
Some checks failed
Test Suite / playwright-tests (push) Waiting to run
Deploy Development / deploy (push) Failing after 43s
Test Suite / pytest-backend (push) Failing after 31s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Has been cancelled
- Enhanced the deployment workflow to include error handling for the DEV API, ensuring logs are captured if the API is unreachable. - Updated the migration scripts to safely rename existing tables by checking for their existence, preventing potential conflicts during migrations. - Added exception handling in migration 079 to ensure the prerequisites are met before proceeding with the creation of the capabilities table.
This commit is contained in:
parent
3e87f7515a
commit
7db77f4738
|
|
@ -18,6 +18,11 @@ jobs:
|
||||||
docker compose -f docker-compose.dev-env.yml build --no-cache
|
docker compose -f docker-compose.dev-env.yml build --no-cache
|
||||||
docker compose -f docker-compose.dev-env.yml up -d
|
docker compose -f docker-compose.dev-env.yml up -d
|
||||||
sleep 5
|
sleep 5
|
||||||
curl -sf http://localhost:8098/api/version && echo "✓ DEV API healthy"
|
if ! curl -sf http://localhost:8098/api/version; then
|
||||||
|
echo "✗ DEV API nicht erreichbar — Backend-Logs (Migration/Startup):"
|
||||||
|
docker compose -f docker-compose.dev-env.yml logs backend --tail 120 || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✓ DEV API healthy"
|
||||||
curl -sf http://localhost:3098/api/version && echo "✓ DEV über Frontend-Nginx (wie Browser) healthy"
|
curl -sf http://localhost:3098/api/version && echo "✓ DEV über Frontend-Nginx (wie Browser) healthy"
|
||||||
echo "=== Shinkan DEV Deploy complete ==="
|
echo "=== Shinkan DEV Deploy complete ==="
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,8 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Pytest im laufenden backend-Container; ACCESS_LAYER + TRAINING_PLANNING Integration gegen dieselbe PostgreSQL wie Deploy (Schema via Container-Start migriert).
|
# Pytest im laufenden backend-Container; ACCESS_LAYER + TRAINING_PLANNING Integration gegen dieselbe PostgreSQL wie Deploy (Schema via Container-Start migriert).
|
||||||
# Nicht bei push auf develop/main: Deploy läuft parallel → Container oft im Restart (siehe workflow_run nach Deploy).
|
|
||||||
pytest-backend:
|
pytest-backend:
|
||||||
if: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'pull_request' }}
|
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Backend pytest im deployten Container
|
- name: Backend pytest im deployten Container
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,15 @@ BEGIN
|
||||||
SELECT 1 FROM information_schema.columns
|
SELECT 1 FROM information_schema.columns
|
||||||
WHERE table_schema = 'public' AND table_name = 'features' AND column_name = 'limit_type'
|
WHERE table_schema = 'public' AND table_name = 'features' AND column_name = 'limit_type'
|
||||||
) THEN
|
) THEN
|
||||||
ALTER TABLE features RENAME TO features_legacy_001;
|
-- Nach abgebrochenem Erstversuch kann features_legacy_001 schon existieren
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.tables
|
||||||
|
WHERE table_schema = 'public' AND table_name = 'features_legacy_001'
|
||||||
|
) THEN
|
||||||
|
DROP TABLE features;
|
||||||
|
ELSE
|
||||||
|
ALTER TABLE features RENAME TO features_legacy_001;
|
||||||
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF EXISTS (
|
IF EXISTS (
|
||||||
|
|
@ -25,7 +33,14 @@ BEGIN
|
||||||
SELECT 1 FROM information_schema.columns
|
SELECT 1 FROM information_schema.columns
|
||||||
WHERE table_schema = 'public' AND table_name = 'tier_limits' AND column_name = 'tier'
|
WHERE table_schema = 'public' AND table_name = 'tier_limits' AND column_name = 'tier'
|
||||||
) THEN
|
) THEN
|
||||||
ALTER TABLE tier_limits RENAME TO tier_limits_legacy_001;
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.tables
|
||||||
|
WHERE table_schema = 'public' AND table_name = 'tier_limits_legacy_001'
|
||||||
|
) THEN
|
||||||
|
DROP TABLE tier_limits;
|
||||||
|
ELSE
|
||||||
|
ALTER TABLE tier_limits RENAME TO tier_limits_legacy_001;
|
||||||
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF EXISTS (
|
IF EXISTS (
|
||||||
|
|
@ -35,7 +50,14 @@ BEGIN
|
||||||
SELECT 1 FROM information_schema.columns
|
SELECT 1 FROM information_schema.columns
|
||||||
WHERE table_schema = 'public' AND table_name = 'user_feature_usage' AND column_name = 'profile_id'
|
WHERE table_schema = 'public' AND table_name = 'user_feature_usage' AND column_name = 'profile_id'
|
||||||
) THEN
|
) THEN
|
||||||
ALTER TABLE user_feature_usage RENAME TO user_feature_usage_legacy_001;
|
IF EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.tables
|
||||||
|
WHERE table_schema = 'public' AND table_name = 'user_feature_usage_legacy_001'
|
||||||
|
) THEN
|
||||||
|
DROP TABLE user_feature_usage;
|
||||||
|
ELSE
|
||||||
|
ALTER TABLE user_feature_usage RENAME TO user_feature_usage_legacy_001;
|
||||||
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
END
|
END
|
||||||
$migration$;
|
$migration$;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,19 @@
|
||||||
-- Migration 079: Capability-Registry + Rollen-Grants (M3 / CAPABILITY_CATALOG.v1.md C1)
|
-- Migration 079: Capability-Registry + Rollen-Grants (M3 / CAPABILITY_CATALOG.v1.md C1)
|
||||||
-- Account-Gates und Enforcement in Python (account_lifecycle.py, capabilities.py).
|
-- Account-Gates und Enforcement in Python (account_lifecycle.py, capabilities.py).
|
||||||
|
-- Voraussetzung: Migration 078 (features.id TEXT). Kein FK auf features — vermeidet
|
||||||
|
-- Startup-Abbruch wenn 078 noch aussteht oder features-Schema driftet (001 vs v9c).
|
||||||
|
|
||||||
|
DO $migration$
|
||||||
|
BEGIN
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.columns
|
||||||
|
WHERE table_schema = 'public' AND table_name = 'features' AND column_name = 'limit_type'
|
||||||
|
) THEN
|
||||||
|
RAISE EXCEPTION
|
||||||
|
'Migration 079: features-Tabelle nicht v9c (limit_type fehlt). Zuerst 078_club_features_and_plans anwenden.';
|
||||||
|
END IF;
|
||||||
|
END
|
||||||
|
$migration$;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS capabilities (
|
CREATE TABLE IF NOT EXISTS capabilities (
|
||||||
id TEXT PRIMARY KEY,
|
id TEXT PRIMARY KEY,
|
||||||
|
|
@ -10,7 +24,7 @@ CREATE TABLE IF NOT EXISTS capabilities (
|
||||||
CHECK (min_account_state IN (
|
CHECK (min_account_state IN (
|
||||||
'unverified', 'verified_pending_club', 'active_member', 'platform_admin'
|
'unverified', 'verified_pending_club', 'active_member', 'platform_admin'
|
||||||
)),
|
)),
|
||||||
linked_feature_id TEXT REFERENCES features(id) ON DELETE SET NULL,
|
linked_feature_id TEXT,
|
||||||
active BOOLEAN NOT NULL DEFAULT true,
|
active BOOLEAN NOT NULL DEFAULT true,
|
||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user