fix(identity-service): convert deploy.sh line endings from CRLF to LF
Fix bash interpreter error caused by Windows-style CRLF line endings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
39804aa981
commit
10e4fa4a5f
|
|
@ -1,140 +1,140 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Identity Service - Individual Deployment Script
|
# Identity Service - Individual Deployment Script
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SERVICE_NAME="identity-service"
|
SERVICE_NAME="identity-service"
|
||||||
CONTAINER_NAME="rwa-identity-service"
|
CONTAINER_NAME="rwa-identity-service"
|
||||||
IMAGE_NAME="services-identity-service"
|
IMAGE_NAME="services-identity-service"
|
||||||
PORT=3000
|
PORT=3000
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||||
log_success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
log_success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
||||||
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||||
|
|
||||||
# Get script directory
|
# Get script directory
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
SERVICES_DIR="$(dirname "$SCRIPT_DIR")"
|
SERVICES_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
|
||||||
# Load environment
|
# Load environment
|
||||||
if [ -f "$SERVICES_DIR/.env" ]; then
|
if [ -f "$SERVICES_DIR/.env" ]; then
|
||||||
export $(cat "$SERVICES_DIR/.env" | grep -v '^#' | xargs)
|
export $(cat "$SERVICES_DIR/.env" | grep -v '^#' | xargs)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
build)
|
build)
|
||||||
log_info "Building $SERVICE_NAME..."
|
log_info "Building $SERVICE_NAME..."
|
||||||
docker build -t "$IMAGE_NAME" "$SCRIPT_DIR"
|
docker build -t "$IMAGE_NAME" "$SCRIPT_DIR"
|
||||||
log_success "$SERVICE_NAME built successfully"
|
log_success "$SERVICE_NAME built successfully"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
build-no-cache)
|
build-no-cache)
|
||||||
log_info "Building $SERVICE_NAME (no cache)..."
|
log_info "Building $SERVICE_NAME (no cache)..."
|
||||||
docker build --no-cache -t "$IMAGE_NAME" "$SCRIPT_DIR"
|
docker build --no-cache -t "$IMAGE_NAME" "$SCRIPT_DIR"
|
||||||
log_success "$SERVICE_NAME built successfully"
|
log_success "$SERVICE_NAME built successfully"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
start)
|
start)
|
||||||
log_info "Starting $SERVICE_NAME..."
|
log_info "Starting $SERVICE_NAME..."
|
||||||
cd "$SERVICES_DIR"
|
cd "$SERVICES_DIR"
|
||||||
docker compose up -d "$SERVICE_NAME"
|
docker compose up -d "$SERVICE_NAME"
|
||||||
log_success "$SERVICE_NAME started"
|
log_success "$SERVICE_NAME started"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
log_info "Stopping $SERVICE_NAME..."
|
log_info "Stopping $SERVICE_NAME..."
|
||||||
docker stop "$CONTAINER_NAME" 2>/dev/null || true
|
docker stop "$CONTAINER_NAME" 2>/dev/null || true
|
||||||
docker rm "$CONTAINER_NAME" 2>/dev/null || true
|
docker rm "$CONTAINER_NAME" 2>/dev/null || true
|
||||||
log_success "$SERVICE_NAME stopped"
|
log_success "$SERVICE_NAME stopped"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
restart)
|
restart)
|
||||||
$0 stop
|
$0 stop
|
||||||
$0 start
|
$0 start
|
||||||
;;
|
;;
|
||||||
|
|
||||||
logs)
|
logs)
|
||||||
docker logs -f "$CONTAINER_NAME"
|
docker logs -f "$CONTAINER_NAME"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
logs-tail)
|
logs-tail)
|
||||||
docker logs --tail 100 "$CONTAINER_NAME"
|
docker logs --tail 100 "$CONTAINER_NAME"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
status)
|
status)
|
||||||
if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
|
if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
|
||||||
log_success "$SERVICE_NAME is running"
|
log_success "$SERVICE_NAME is running"
|
||||||
docker ps --filter "name=$CONTAINER_NAME" --format "table {{.Status}}\t{{.Ports}}"
|
docker ps --filter "name=$CONTAINER_NAME" --format "table {{.Status}}\t{{.Ports}}"
|
||||||
else
|
else
|
||||||
log_warn "$SERVICE_NAME is not running"
|
log_warn "$SERVICE_NAME is not running"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
health)
|
health)
|
||||||
log_info "Checking health of $SERVICE_NAME..."
|
log_info "Checking health of $SERVICE_NAME..."
|
||||||
if curl -sf "http://localhost:$PORT/health" > /dev/null 2>&1; then
|
if curl -sf "http://localhost:$PORT/health" > /dev/null 2>&1; then
|
||||||
log_success "$SERVICE_NAME is healthy"
|
log_success "$SERVICE_NAME is healthy"
|
||||||
else
|
else
|
||||||
log_error "$SERVICE_NAME health check failed"
|
log_error "$SERVICE_NAME health check failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
migrate)
|
migrate)
|
||||||
log_info "Running migrations for $SERVICE_NAME..."
|
log_info "Running migrations for $SERVICE_NAME..."
|
||||||
docker exec "$CONTAINER_NAME" npx prisma migrate deploy
|
docker exec "$CONTAINER_NAME" npx prisma migrate deploy
|
||||||
log_success "Migrations completed"
|
log_success "Migrations completed"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
migrate-dev)
|
migrate-dev)
|
||||||
log_info "Running dev migrations for $SERVICE_NAME..."
|
log_info "Running dev migrations for $SERVICE_NAME..."
|
||||||
docker exec "$CONTAINER_NAME" npx prisma migrate dev
|
docker exec "$CONTAINER_NAME" npx prisma migrate dev
|
||||||
;;
|
;;
|
||||||
|
|
||||||
prisma-studio)
|
prisma-studio)
|
||||||
log_info "Starting Prisma Studio..."
|
log_info "Starting Prisma Studio..."
|
||||||
docker exec -it "$CONTAINER_NAME" npx prisma studio
|
docker exec -it "$CONTAINER_NAME" npx prisma studio
|
||||||
;;
|
;;
|
||||||
|
|
||||||
shell)
|
shell)
|
||||||
log_info "Opening shell in $SERVICE_NAME container..."
|
log_info "Opening shell in $SERVICE_NAME container..."
|
||||||
docker exec -it "$CONTAINER_NAME" sh
|
docker exec -it "$CONTAINER_NAME" sh
|
||||||
;;
|
;;
|
||||||
|
|
||||||
test)
|
test)
|
||||||
log_info "Running tests for $SERVICE_NAME..."
|
log_info "Running tests for $SERVICE_NAME..."
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
npm test
|
npm test
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {build|build-no-cache|start|stop|restart|logs|logs-tail|status|health|migrate|migrate-dev|prisma-studio|shell|test}"
|
echo "Usage: $0 {build|build-no-cache|start|stop|restart|logs|logs-tail|status|health|migrate|migrate-dev|prisma-studio|shell|test}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Commands:"
|
echo "Commands:"
|
||||||
echo " build - Build Docker image"
|
echo " build - Build Docker image"
|
||||||
echo " build-no-cache - Build Docker image without cache"
|
echo " build-no-cache - Build Docker image without cache"
|
||||||
echo " start - Start the service"
|
echo " start - Start the service"
|
||||||
echo " stop - Stop the service"
|
echo " stop - Stop the service"
|
||||||
echo " restart - Restart the service"
|
echo " restart - Restart the service"
|
||||||
echo " logs - Follow logs"
|
echo " logs - Follow logs"
|
||||||
echo " logs-tail - Show last 100 log lines"
|
echo " logs-tail - Show last 100 log lines"
|
||||||
echo " status - Show service status"
|
echo " status - Show service status"
|
||||||
echo " health - Check service health"
|
echo " health - Check service health"
|
||||||
echo " migrate - Run database migrations"
|
echo " migrate - Run database migrations"
|
||||||
echo " migrate-dev - Run dev migrations"
|
echo " migrate-dev - Run dev migrations"
|
||||||
echo " prisma-studio - Open Prisma Studio"
|
echo " prisma-studio - Open Prisma Studio"
|
||||||
echo " shell - Open shell in container"
|
echo " shell - Open shell in container"
|
||||||
echo " test - Run tests locally"
|
echo " test - Run tests locally"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue