mirror of
https://github.com/Dvorinka/Primora.git
synced 2026-06-03 20:13:01 +00:00
initiall commit
This commit is contained in:
Executable
+74
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Primora Setup Script
|
||||
# Simplified deployment for local and single-dev environments
|
||||
|
||||
echo "🚀 Starting Primora Platform Setup..."
|
||||
|
||||
# Check dependencies
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "❌ Error: docker is not installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
|
||||
echo "❌ Error: docker-compose is not installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create .env from .env.example if it doesn't exist
|
||||
if [ ! -f .env ]; then
|
||||
echo "📝 Creating .env file from .env.example..."
|
||||
cp .env.example .env
|
||||
|
||||
# Generate secrets
|
||||
echo "🔐 Generating secure secrets..."
|
||||
JWT_SECRET=$(openssl rand -base64 32)
|
||||
BETTER_AUTH_SECRET=$(openssl rand -base64 32)
|
||||
|
||||
# Update .env with secrets
|
||||
# Use different sed approach for better compatibility
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' "s/JWT_SECRET=change-me-super-long-jwt-secret/JWT_SECRET=$JWT_SECRET/g" .env
|
||||
sed -i '' "s/BETTER_AUTH_SECRET=change-me-super-long-better-auth-secret/BETTER_AUTH_SECRET=$BETTER_AUTH_SECRET/g" .env
|
||||
else
|
||||
sed -i "s/JWT_SECRET=change-me-super-long-jwt-secret/JWT_SECRET=$JWT_SECRET/g" .env
|
||||
sed -i "s/BETTER_AUTH_SECRET=change-me-super-long-better-auth-secret/BETTER_AUTH_SECRET=$BETTER_AUTH_SECRET/g" .env
|
||||
fi
|
||||
echo "✅ .env file created and secured."
|
||||
else
|
||||
echo "ℹ️ .env file already exists. Skipping creation."
|
||||
fi
|
||||
|
||||
# Ask for domain/host
|
||||
read -p "🌐 Enter your domain or IP (default: localhost): " DOMAIN
|
||||
DOMAIN=${DOMAIN:-localhost}
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' "s/COOKIE_DOMAIN=localhost/COOKIE_DOMAIN=$DOMAIN/g" .env
|
||||
sed -i '' "s/BETTER_AUTH_URL=http:\/\/localhost/BETTER_AUTH_URL=http:\/\/$DOMAIN/g" .env
|
||||
sed -i '' "s/VITE_APP_URL=http:\/\/localhost/VITE_APP_URL=http:\/\/$DOMAIN/g" .env
|
||||
else
|
||||
sed -i "s/COOKIE_DOMAIN=localhost/COOKIE_DOMAIN=$DOMAIN/g" .env
|
||||
sed -i "s/BETTER_AUTH_URL=http:\/\/localhost/BETTER_AUTH_URL=http:\/\/$DOMAIN/g" .env
|
||||
sed -i "s/VITE_APP_URL=http:\/\/localhost/VITE_APP_URL=http:\/\/$DOMAIN/g" .env
|
||||
fi
|
||||
|
||||
# Start services
|
||||
echo "📦 Pulling images and starting services..."
|
||||
if command -v docker-compose &> /dev/null; then
|
||||
docker-compose up -d
|
||||
else
|
||||
docker compose up -d
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✨ Primora is now setting up in the background!"
|
||||
echo "📡 Access your platform at: http://$DOMAIN"
|
||||
echo "📧 Check emails (Mailpit) at: http://$DOMAIN/mailpit"
|
||||
echo ""
|
||||
echo "🛠️ To view logs: docker-compose logs -f"
|
||||
echo "🛑 To stop: docker-compose down"
|
||||
echo ""
|
||||
echo "Enjoy your simplified development platform! 🚀"
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Primora Production Readiness Verification Script
|
||||
# This script checks if all production-ready components are in place
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔍 Verifying Primora Production Readiness..."
|
||||
echo ""
|
||||
|
||||
# Color codes
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
PASSED=0
|
||||
FAILED=0
|
||||
|
||||
check_file() {
|
||||
if [ -f "$1" ]; then
|
||||
echo -e "${GREEN}✓${NC} $2"
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e "${RED}✗${NC} $2 (missing: $1)"
|
||||
((FAILED++))
|
||||
fi
|
||||
}
|
||||
|
||||
check_dir() {
|
||||
if [ -d "$1" ]; then
|
||||
echo -e "${GREEN}✓${NC} $2"
|
||||
((PASSED++))
|
||||
else
|
||||
echo -e "${RED}✗${NC} $2 (missing: $1)"
|
||||
((FAILED++))
|
||||
fi
|
||||
}
|
||||
|
||||
echo "📦 Backend Components:"
|
||||
check_file "apps/backend/internal/observability/metrics.go" "Metrics collection"
|
||||
check_file "apps/backend/internal/middleware/cors.go" "CORS middleware"
|
||||
check_file "apps/backend/internal/middleware/compression.go" "Compression middleware"
|
||||
check_file "apps/backend/internal/middleware/metrics.go" "Metrics middleware"
|
||||
check_file "apps/backend/internal/handlers/http_integration_test.go" "Integration tests"
|
||||
echo ""
|
||||
|
||||
echo "🎨 Frontend Components:"
|
||||
check_file "apps/frontend/vitest.config.ts" "Vitest configuration"
|
||||
check_file "apps/frontend/src/lib/__tests__/setup.ts" "Test setup"
|
||||
check_file "apps/frontend/src/lib/__tests__/api.test.ts" "API tests"
|
||||
echo ""
|
||||
|
||||
echo "🔄 CI/CD:"
|
||||
check_file ".github/workflows/ci.yml" "GitHub Actions workflow"
|
||||
echo ""
|
||||
|
||||
echo "📚 Documentation:"
|
||||
check_file "PRODUCTION_READINESS.md" "Production readiness checklist"
|
||||
check_file "DEPLOYMENT_GUIDE.md" "Deployment guide"
|
||||
check_file "PRODUCTION_IMPROVEMENTS.md" "Improvements summary"
|
||||
check_file "PRODUCTION_READY_SUMMARY.md" "Production ready summary"
|
||||
echo ""
|
||||
|
||||
echo "🐳 Infrastructure:"
|
||||
check_file "docker-compose.yml" "Docker Compose configuration"
|
||||
check_file "apps/backend/Dockerfile" "Backend Dockerfile"
|
||||
check_file "apps/auth/Dockerfile" "Auth Dockerfile"
|
||||
check_file "apps/frontend/Dockerfile" "Frontend Dockerfile"
|
||||
check_file "infra/nginx/default.conf" "Nginx configuration"
|
||||
echo ""
|
||||
|
||||
echo "⚙️ Configuration:"
|
||||
check_file ".env.example" "Environment template"
|
||||
check_file "apps/backend/internal/config/config.go" "Backend config"
|
||||
check_file "apps/auth/src/lib/env.ts" "Auth config"
|
||||
echo ""
|
||||
|
||||
echo "🗄️ Database:"
|
||||
check_file "apps/backend/db/migrations/00001_core_init.sql" "Database migrations"
|
||||
check_dir "apps/backend/db/queries" "Database queries"
|
||||
echo ""
|
||||
|
||||
echo "🔐 Security:"
|
||||
check_file "apps/backend/internal/auth/jwt.go" "JWT verification"
|
||||
check_file "apps/backend/internal/middleware/context.go" "Auth middleware"
|
||||
echo ""
|
||||
|
||||
echo "📊 Results:"
|
||||
echo -e "Passed: ${GREEN}$PASSED${NC}"
|
||||
echo -e "Failed: ${RED}$FAILED${NC}"
|
||||
echo ""
|
||||
|
||||
if [ $FAILED -eq 0 ]; then
|
||||
echo -e "${GREEN}✅ All production-ready components are in place!${NC}"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Review PRODUCTION_READINESS.md for deployment checklist"
|
||||
echo "2. Choose deployment platform from DEPLOYMENT_GUIDE.md"
|
||||
echo "3. Configure environment variables"
|
||||
echo "4. Run: npm run check"
|
||||
echo "5. Deploy to staging first"
|
||||
echo "6. Deploy to production"
|
||||
exit 0
|
||||
else
|
||||
echo -e "${RED}❌ Some components are missing. Please review the output above.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user