Skip to content

feat: 2d hypergraph visual polish #878

feat: 2d hypergraph visual polish

feat: 2d hypergraph visual polish #878

name: Atlas Migrations
on:
pull_request:
branches:
- main
- dev
types:
- opened
- reopened
- synchronize
push:
branches:
- main
- dev
- feature/migrations
paths:
- "atlas/migrations/**"
- atlas.hcl
- ".github/workflows/atlas-migrations.yml"
- ".github/actions/import-db-secrets/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
# Check jobs - run in parallel for all environments
check-webapps:
uses: ./.github/workflows/check-migration-reusable.yml
with:
env_name: webapps
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
check-prediction-swarm:
uses: ./.github/workflows/check-migration-reusable.yml
with:
env_name: prediction_swarm
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
check-apostle-swarm:
uses: ./.github/workflows/check-migration-reusable.yml
with:
env_name: apostle_swarm
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
# Shadow apply checks - only on PRs to main with pending migrations
shadow-apply-check-webapps:
needs: check-webapps
if: github.event_name == 'pull_request' && github.base_ref == 'main' && needs.check-webapps.outputs.pending == 'true'
uses: ./.github/workflows/shadow-apply-check-reusable.yml
with:
env_name: webapps
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
shadow-apply-check-prediction-swarm:
needs: check-prediction-swarm
if: github.event_name == 'pull_request' && github.base_ref == 'main' && needs.check-prediction-swarm.outputs.pending == 'true'
uses: ./.github/workflows/shadow-apply-check-reusable.yml
with:
env_name: prediction_swarm
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
shadow-apply-check-apostle-swarm:
needs: check-apostle-swarm
if: github.event_name == 'pull_request' && github.base_ref == 'main' && needs.check-apostle-swarm.outputs.pending == 'true'
uses: ./.github/workflows/shadow-apply-check-reusable.yml
with:
env_name: apostle_swarm
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
# Apply jobs - only on push with pending migrations
apply-webapps:
needs: check-webapps
if: github.event_name == 'push' && needs.check-webapps.outputs.pending == 'true'
uses: ./.github/workflows/apply-migration-reusable.yml
with:
env_name: webapps
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
apply-prediction-swarm:
needs: check-prediction-swarm
if: github.event_name == 'push' && needs.check-prediction-swarm.outputs.pending == 'true'
uses: ./.github/workflows/apply-migration-reusable.yml
with:
env_name: prediction_swarm
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
apply-apostle-swarm:
needs: check-apostle-swarm
if: github.event_name == 'push' && needs.check-apostle-swarm.outputs.pending == 'true'
uses: ./.github/workflows/apply-migration-reusable.yml
with:
env_name: apostle_swarm
secrets:
vault_addr: ${{ secrets.VAULT_ADDR }}
vault_role_id: ${{ secrets.VAULT_ROLE_ID }}
vault_secret_id: ${{ secrets.VAULT_SECRET_ID }}
# Restart webapps after their migrations are applied
restart-webapps:
needs: apply-webapps
if: github.event_name == 'push' && needs.apply-webapps.outputs.applied == 'true'
runs-on: ubicloud-standard-2
container:
image: ghcr.io/renlabs-dev/devops-ci:latest
env:
VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }}
VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }}
strategy:
matrix:
app:
- torus-allocator
- torus-cache
- torus-governance
- torus-worker
- torus-portal
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Kubernetes authentication
run: /apps/k8s_auth_w_approle_sa.sh
- name: Set environment variables
run: |
echo "NAMESPACE=torus-${{ github.ref_name == 'main' && 'prod' || 'dev' }}-web-apps" >> $GITHUB_ENV
- name: Restart apps (${{ matrix.app }})
id: restart-app
run: |
set -euo pipefail
kubectl rollout restart -n ${NAMESPACE} deployment -l app=${{ matrix.app }}
kubectl rollout status -n ${NAMESPACE} deployment -l app=${{ matrix.app }} --timeout=300s
- name: Generate restart summary
if: always()
run: |
if [ "${{ strategy.job-index }}" == "0" ]; then
echo "## Application Restart After Migration" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Applications restarted to pick up database schema changes (webapps only):" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ steps.restart-app.outcome }}" == "success" ]; then
echo "- **${{ matrix.app }}**: Successfully restarted" >> $GITHUB_STEP_SUMMARY
else
echo "- **${{ matrix.app }}**: Restart failed" >> $GITHUB_STEP_SUMMARY
fi