initial wcag-ada
This commit is contained in:
parent
042b8cb83a
commit
d52cfe7de2
112 changed files with 9069 additions and 0 deletions
41
apps/wcag-ada/scripts/build-images.sh
Executable file
41
apps/wcag-ada/scripts/build-images.sh
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Script to build all Docker images locally
|
||||
|
||||
echo "Building WCAG-ADA Docker images..."
|
||||
|
||||
# Get the repository root (two levels up from scripts directory)
|
||||
REPO_ROOT=$(cd "$(dirname "$0")/../../.." && pwd)
|
||||
WCAG_ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
||||
|
||||
# Set default registry if not provided
|
||||
REGISTRY=${DOCKER_REGISTRY:-"wcag-ada"}
|
||||
|
||||
# Build API image
|
||||
echo "Building API image..."
|
||||
docker build \
|
||||
-f "$WCAG_ROOT/api/Dockerfile" \
|
||||
-t "$REGISTRY/api:latest" \
|
||||
"$REPO_ROOT"
|
||||
|
||||
# Build Worker image
|
||||
echo "Building Worker image..."
|
||||
docker build \
|
||||
-f "$WCAG_ROOT/worker/Dockerfile" \
|
||||
-t "$REGISTRY/worker:latest" \
|
||||
"$REPO_ROOT"
|
||||
|
||||
# Build Dashboard image
|
||||
echo "Building Dashboard image..."
|
||||
docker build \
|
||||
-f "$WCAG_ROOT/dashboard/Dockerfile" \
|
||||
-t "$REGISTRY/dashboard:latest" \
|
||||
"$REPO_ROOT"
|
||||
|
||||
echo "All images built successfully!"
|
||||
echo ""
|
||||
echo "Images created:"
|
||||
echo " - $REGISTRY/api:latest"
|
||||
echo " - $REGISTRY/worker:latest"
|
||||
echo " - $REGISTRY/dashboard:latest"
|
||||
71
apps/wcag-ada/scripts/deploy-k8s.sh
Executable file
71
apps/wcag-ada/scripts/deploy-k8s.sh
Executable file
|
|
@ -0,0 +1,71 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Script to deploy to Kubernetes
|
||||
|
||||
NAMESPACE=${NAMESPACE:-"wcag-ada"}
|
||||
ENVIRONMENT=${ENVIRONMENT:-"staging"}
|
||||
|
||||
echo "Deploying WCAG-ADA to Kubernetes..."
|
||||
echo "Namespace: $NAMESPACE"
|
||||
echo "Environment: $ENVIRONMENT"
|
||||
|
||||
# Get the script directory
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
K8S_DIR="$SCRIPT_DIR/../k8s"
|
||||
|
||||
# Create namespace if it doesn't exist
|
||||
kubectl create namespace $NAMESPACE --dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# Apply configurations
|
||||
echo "Applying configurations..."
|
||||
kubectl apply -f "$K8S_DIR/configmap.yaml" -n $NAMESPACE
|
||||
|
||||
# Apply secrets (only if file exists)
|
||||
if [ -f "$K8S_DIR/secrets-$ENVIRONMENT.yaml" ]; then
|
||||
echo "Applying environment-specific secrets..."
|
||||
kubectl apply -f "$K8S_DIR/secrets-$ENVIRONMENT.yaml" -n $NAMESPACE
|
||||
else
|
||||
echo "Warning: No environment-specific secrets found. Using default secrets."
|
||||
kubectl apply -f "$K8S_DIR/secrets.yaml" -n $NAMESPACE
|
||||
fi
|
||||
|
||||
# Deploy services
|
||||
echo "Deploying PostgreSQL..."
|
||||
kubectl apply -f "$K8S_DIR/postgres.yaml" -n $NAMESPACE
|
||||
|
||||
echo "Deploying Redis..."
|
||||
kubectl apply -f "$K8S_DIR/redis.yaml" -n $NAMESPACE
|
||||
|
||||
# Wait for databases to be ready
|
||||
echo "Waiting for databases to be ready..."
|
||||
kubectl wait --for=condition=ready pod -l app=postgres -n $NAMESPACE --timeout=300s
|
||||
kubectl wait --for=condition=ready pod -l app=redis -n $NAMESPACE --timeout=300s
|
||||
|
||||
# Deploy applications
|
||||
echo "Deploying API..."
|
||||
kubectl apply -f "$K8S_DIR/api.yaml" -n $NAMESPACE
|
||||
|
||||
echo "Deploying Worker..."
|
||||
kubectl apply -f "$K8S_DIR/worker.yaml" -n $NAMESPACE
|
||||
|
||||
echo "Deploying Dashboard..."
|
||||
kubectl apply -f "$K8S_DIR/dashboard.yaml" -n $NAMESPACE
|
||||
|
||||
# Apply ingress
|
||||
echo "Applying Ingress rules..."
|
||||
kubectl apply -f "$K8S_DIR/ingress.yaml" -n $NAMESPACE
|
||||
|
||||
# Wait for deployments
|
||||
echo "Waiting for deployments to be ready..."
|
||||
kubectl rollout status deployment/wcag-ada-api -n $NAMESPACE
|
||||
kubectl rollout status deployment/wcag-ada-worker -n $NAMESPACE
|
||||
kubectl rollout status deployment/wcag-ada-dashboard -n $NAMESPACE
|
||||
|
||||
echo "Deployment complete!"
|
||||
echo ""
|
||||
echo "Services deployed:"
|
||||
kubectl get services -n $NAMESPACE
|
||||
echo ""
|
||||
echo "Pods status:"
|
||||
kubectl get pods -n $NAMESPACE
|
||||
52
apps/wcag-ada/scripts/local-dev.sh
Executable file
52
apps/wcag-ada/scripts/local-dev.sh
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Script to set up local development environment
|
||||
|
||||
echo "Setting up WCAG-ADA local development environment..."
|
||||
|
||||
# Get the script directory
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
WCAG_ROOT=$(cd "$SCRIPT_DIR/.." && pwd)
|
||||
|
||||
# Check if .env exists
|
||||
if [ ! -f "$WCAG_ROOT/.env" ]; then
|
||||
echo "Creating .env file from template..."
|
||||
cp "$WCAG_ROOT/.env.example" "$WCAG_ROOT/.env"
|
||||
echo "Please edit .env file with your configuration values"
|
||||
fi
|
||||
|
||||
# Start development databases
|
||||
echo "Starting development databases..."
|
||||
cd "$WCAG_ROOT"
|
||||
docker-compose -f docker-compose.dev.yml up -d
|
||||
|
||||
# Wait for databases to be ready
|
||||
echo "Waiting for databases..."
|
||||
sleep 5
|
||||
|
||||
# Install dependencies
|
||||
echo "Installing dependencies..."
|
||||
bun install
|
||||
|
||||
# Run database migrations
|
||||
echo "Running database migrations..."
|
||||
cd "$WCAG_ROOT/api"
|
||||
bunx prisma migrate dev
|
||||
|
||||
# Start services
|
||||
echo ""
|
||||
echo "Development environment ready!"
|
||||
echo ""
|
||||
echo "To start all services, run:"
|
||||
echo " cd $WCAG_ROOT && bun run dev"
|
||||
echo ""
|
||||
echo "Or start individual services:"
|
||||
echo " API: cd $WCAG_ROOT/api && bun run dev"
|
||||
echo " Worker: cd $WCAG_ROOT/worker && bun run dev"
|
||||
echo " Dashboard: cd $WCAG_ROOT/dashboard && bun run dev"
|
||||
echo ""
|
||||
echo "Database tools:"
|
||||
echo " Prisma Studio: cd $WCAG_ROOT/api && bunx prisma studio"
|
||||
echo " Redis CLI: docker exec -it wcag-ada-redis-dev redis-cli"
|
||||
echo " PostgreSQL: docker exec -it wcag-ada-postgres-dev psql -U postgres -d wcag_ada_dev"
|
||||
Loading…
Add table
Add a link
Reference in a new issue