generated from oci/template
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 2m53s
98 lines
2.4 KiB
Bash
Executable file
98 lines
2.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# TAK Server Management Script
|
|
# This script provides easy access to container management functions
|
|
|
|
CONTAINER_NAME="tak-hybrid"
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
log_info() {
|
|
echo -e "${GREEN}[INFO]${NC} $1"
|
|
}
|
|
|
|
log_warn() {
|
|
echo -e "${YELLOW}[WARN]${NC} $1"
|
|
}
|
|
|
|
log_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1"
|
|
}
|
|
|
|
# Check if container is running
|
|
check_container() {
|
|
if ! docker ps | grep -q "$CONTAINER_NAME"; then
|
|
log_error "Container '$CONTAINER_NAME' is not running"
|
|
log_info "Start the container with: docker-compose up -d"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# Execute script in container
|
|
exec_script() {
|
|
check_container
|
|
docker exec "$CONTAINER_NAME" "$@"
|
|
}
|
|
|
|
# Show usage
|
|
show_usage() {
|
|
echo "TAK Server Management Script"
|
|
echo "Usage: $0 <command> [options]"
|
|
echo ""
|
|
echo "Commands:"
|
|
echo " health [component] - Run health checks"
|
|
echo " db <action> - Database operations"
|
|
echo " version [action] - TAK version operations"
|
|
echo " logs - Show container logs"
|
|
echo " shell - Open shell in container"
|
|
echo " status - Show container status"
|
|
echo " restart - Restart container"
|
|
echo ""
|
|
echo "Examples:"
|
|
echo " $0 health all - Run all health checks"
|
|
echo " $0 db test - Test database connection"
|
|
echo " $0 version list - List available TAK versions"
|
|
echo " $0 logs - Show recent logs"
|
|
}
|
|
|
|
case "$1" in
|
|
"health")
|
|
shift
|
|
exec_script /scripts/healthcheck.sh "$@"
|
|
;;
|
|
"db")
|
|
shift
|
|
exec_script /scripts/db-setup.sh "$@"
|
|
;;
|
|
"version")
|
|
shift
|
|
exec_script /scripts/tak-version.sh /takserver-zip "$@"
|
|
;;
|
|
"logs")
|
|
docker-compose logs -f tak-hybrid
|
|
;;
|
|
"shell")
|
|
check_container
|
|
docker exec -it "$CONTAINER_NAME" /bin/bash
|
|
;;
|
|
"status")
|
|
if docker ps | grep -q "$CONTAINER_NAME"; then
|
|
log_info "Container is running"
|
|
docker ps | grep "$CONTAINER_NAME"
|
|
else
|
|
log_warn "Container is not running"
|
|
fi
|
|
;;
|
|
"restart")
|
|
log_info "Restarting container..."
|
|
docker-compose restart tak-hybrid
|
|
;;
|
|
*)
|
|
show_usage
|
|
exit 1
|
|
;;
|
|
esac
|