create admin_ui

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Sven laptop
2026-05-06 10:55:31 +02:00
parent 2845f442a3
commit 8cf3fe98cb
40 changed files with 5534 additions and 693 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/bin/bash
# Build and push Docker images to registry
# Usage: ./scripts/build-and-push.sh [registry-url]
set -e
REGISTRY=${1:-ghcr.io/sven491/xtransit}
VERSION=${2:-latest}
echo "🔨 Building Docker images..."
# Build auth_api
echo " Building auth_api..."
docker build -t ${REGISTRY}/auth_api:${VERSION} ./auth_api
# Build transit_api
echo " Building transit_api..."
docker build -t ${REGISTRY}/transit_api:${VERSION} ./transit_api
# Build employee_api
echo " Building employee_api..."
docker build -t ${REGISTRY}/employee_api:${VERSION} ./employee_api
# Build admin_ui
echo " Building admin_ui..."
docker build -t ${REGISTRY}/admin_ui:${VERSION} ./admin_ui
echo "✅ Build complete!"
echo ""
echo "🚀 Pushing images to registry: $REGISTRY"
docker push ${REGISTRY}/auth_api:${VERSION}
echo " ✓ Pushed auth_api:${VERSION}"
docker push ${REGISTRY}/transit_api:${VERSION}
echo " ✓ Pushed transit_api:${VERSION}"
docker push ${REGISTRY}/employee_api:${VERSION}
echo " ✓ Pushed employee_api:${VERSION}"
docker push ${REGISTRY}/admin_ui:${VERSION}
echo " ✓ Pushed admin_ui:${VERSION}"
echo ""
echo "✅ All images pushed successfully!"
echo ""
echo "Update docker-compose.yml with:"
echo " image: ${REGISTRY}/auth_api:${VERSION}"
echo " image: ${REGISTRY}/transit_api:${VERSION}"
echo " image: ${REGISTRY}/employee_api:${VERSION}"
echo " image: ${REGISTRY}/admin_ui:${VERSION}"
+70
View File
@@ -0,0 +1,70 @@
#!/bin/bash
# Quick deployment helper script
# Usage: ./scripts/deploy.sh [start|stop|restart|logs|status]
set -e
COMMAND=${1:-status}
case $COMMAND in
start)
echo "🚀 Starting XTransit services..."
docker-compose up -d
echo "✅ Services started!"
echo ""
echo "📋 Service URLs:"
echo " Admin UI: http://localhost:5174"
echo " Auth API: http://localhost:5000"
echo " Transit API: http://localhost:5001"
echo " Employee API: http://localhost:4000"
;;
stop)
echo "⏹️ Stopping XTransit services..."
docker-compose down
echo "✅ Services stopped!"
;;
restart)
echo "🔄 Restarting XTransit services..."
docker-compose restart
echo "✅ Services restarted!"
;;
logs)
SERVICE=${2:-admin_ui}
echo "📋 Logs for $SERVICE (last 100 lines):"
docker-compose logs --tail=100 -f $SERVICE
;;
status)
echo "📊 XTransit Services Status:"
docker-compose ps
;;
build)
echo "🔨 Building all services..."
docker-compose build
echo "✅ Build complete!"
;;
clean)
echo "🧹 Cleaning up containers and volumes..."
docker-compose down -v
echo "✅ Cleanup complete!"
;;
*)
echo "Usage: $0 [start|stop|restart|logs|status|build|clean]"
echo ""
echo "Commands:"
echo " start - Start all services"
echo " stop - Stop all services"
echo " restart - Restart all services"
echo " logs [svc] - View logs (optional service name)"
echo " status - Show service status"
echo " build - Build all Docker images locally"
echo " clean - Remove containers and volumes"
exit 1
;;
esac
+78
View File
@@ -0,0 +1,78 @@
#!/bin/bash
# XTransit Project - Initial Setup Script
# This script prepares the environment for local development or deployment
set -e
echo "🚀 XTransit Transit Project - Setup Script"
echo "=========================================="
echo ""
# Check prerequisites
echo "📋 Checking prerequisites..."
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker."
exit 1
fi
echo "✅ Docker found: $(docker --version)"
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose."
exit 1
fi
echo "✅ Docker Compose found: $(docker-compose --version)"
echo ""
echo "📝 Setting up configuration..."
# Create .env if it doesn't exist
if [ -f .env ]; then
echo "⚠️ .env file already exists, skipping creation"
else
echo "Creating .env from .env.example..."
cp .env.example .env
echo "✅ .env created. Please edit it with your database credentials."
echo ""
echo "Required values to set:"
echo " - POSTGRES_HOST: Your PostgreSQL server hostname"
echo " - POSTGRES_PORT: PostgreSQL port (default: 5432)"
echo " - POSTGRES_DB: Database name (default: XTransit)"
echo " - POSTGRES_USER_AUTH: Auth API database user"
echo " - POSTGRES_PASSWORD_AUTH: Auth API database password"
echo " - POSTGRES_USER_TRANSIT: Transit API database user"
echo " - POSTGRES_PASSWORD_TRANSIT: Transit API database password"
echo " - POSTGRES_USER_EMPLOYEE: Employee API database user"
echo " - POSTGRES_PASSWORD_EMPLOYEE: Employee API database password"
echo " - JWT_SECRET: JWT signing secret"
echo " - ADMIN_USER_CODES: Comma-separated admin user codes"
echo ""
echo "✏️ Edit .env file now? (y/n)"
read -r response
if [[ "$response" =~ ^[Yy]$ ]]; then
${EDITOR:-nano} .env
fi
fi
echo ""
echo "📦 Building Docker images..."
docker-compose build
echo ""
echo "✅ Setup complete!"
echo ""
echo "Next steps:"
echo " 1. Review and update .env with your database credentials"
echo " 2. Start services: ./scripts/deploy.sh start"
echo " 3. Access Admin UI: http://localhost:5174"
echo ""
echo "Available commands:"
echo " ./scripts/deploy.sh start - Start all services"
echo " ./scripts/deploy.sh stop - Stop all services"
echo " ./scripts/deploy.sh logs - View logs"
echo " ./scripts/deploy.sh status - Show service status"
echo ""
echo "Documentation:"
echo " - DEPLOYMENT.md - Comprehensive deployment guide"
echo " - DOCKER_README.md - Docker specific instructions"
echo " - admin_ui/README.md - Admin UI documentation"