initial checking CICD and remove heart
This commit is contained in:
parent
a81568f907
commit
7e596fd980
7
.gitignore
vendored
7
.gitignore
vendored
@ -20,3 +20,10 @@ logs/
|
||||
# OS specific
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
notes/
|
||||
|
||||
# CI/CD sensitive files
|
||||
kubernetes/gitea-kubeconfig.yaml
|
||||
kubernetes/kubeconfig-base64.txt
|
||||
*kubeconfig*.yaml
|
||||
*kubeconfig*.txt
|
||||
|
||||
12
.travis.yml
12
.travis.yml
@ -1,12 +0,0 @@
|
||||
language: rust
|
||||
rust:
|
||||
- stable
|
||||
- nightly
|
||||
- beta
|
||||
matrix:
|
||||
allow_failures:
|
||||
- rust: stable
|
||||
fast_finish: true
|
||||
cache: cargo
|
||||
before_install:
|
||||
- npm install
|
||||
@ -1,393 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Quick Start Script for socktop webterm Docker Deployment
|
||||
# This script helps you set up and run the containerized application
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print colored output
|
||||
print_info() {
|
||||
echo -e "${BLUE}ℹ ${NC}$1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}✓${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}⚠${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}✗${NC} $1"
|
||||
}
|
||||
|
||||
print_header() {
|
||||
echo ""
|
||||
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${BLUE}║${NC} $1"
|
||||
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Check if Docker is installed
|
||||
check_docker() {
|
||||
print_info "Checking Docker installation..."
|
||||
if ! command -v docker &> /dev/null; then
|
||||
print_error "Docker is not installed. Please install Docker first."
|
||||
echo " Visit: https://docs.docker.com/get-docker/"
|
||||
exit 1
|
||||
fi
|
||||
print_success "Docker is installed: $(docker --version)"
|
||||
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
print_warning "docker-compose not found, checking for docker compose plugin..."
|
||||
if ! docker compose version &> /dev/null; then
|
||||
print_error "Docker Compose is not available. Please install Docker Compose."
|
||||
exit 1
|
||||
fi
|
||||
print_success "Docker Compose plugin is available"
|
||||
DOCKER_COMPOSE="docker compose"
|
||||
else
|
||||
print_success "Docker Compose is installed: $(docker-compose --version)"
|
||||
DOCKER_COMPOSE="docker-compose"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if configuration files exist
|
||||
check_config_files() {
|
||||
print_info "Checking configuration files..."
|
||||
|
||||
local missing_files=()
|
||||
|
||||
# Check for required files
|
||||
if [ ! -f "files/alacritty.toml" ]; then
|
||||
missing_files+=("files/alacritty.toml")
|
||||
fi
|
||||
|
||||
if [ ! -f "files/catppuccin-frappe.toml" ]; then
|
||||
missing_files+=("files/catppuccin-frappe.toml")
|
||||
fi
|
||||
|
||||
if [ ! -f "files/profiles.json" ]; then
|
||||
missing_files+=("files/profiles.json")
|
||||
fi
|
||||
|
||||
if [ ${#missing_files[@]} -gt 0 ]; then
|
||||
print_warning "Some configuration files are missing:"
|
||||
for file in "${missing_files[@]}"; do
|
||||
echo " - $file"
|
||||
done
|
||||
echo ""
|
||||
read -p "Would you like to create them from examples? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
create_config_from_examples
|
||||
else
|
||||
print_error "Cannot continue without configuration files."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_success "All required configuration files found"
|
||||
fi
|
||||
}
|
||||
|
||||
# Create config files from examples
|
||||
create_config_from_examples() {
|
||||
print_info "Creating configuration files from examples..."
|
||||
|
||||
mkdir -p files
|
||||
|
||||
if [ ! -f "files/alacritty.toml" ] && [ -f "files/alacritty.toml.example" ]; then
|
||||
cp files/alacritty.toml.example files/alacritty.toml
|
||||
print_success "Created files/alacritty.toml"
|
||||
fi
|
||||
|
||||
if [ ! -f "files/catppuccin-frappe.toml" ] && [ -f "files/catppuccin-frappe.toml.example" ]; then
|
||||
cp files/catppuccin-frappe.toml.example files/catppuccin-frappe.toml
|
||||
print_success "Created files/catppuccin-frappe.toml"
|
||||
fi
|
||||
|
||||
if [ ! -f "files/profiles.json" ] && [ -f "files/profiles.json.example" ]; then
|
||||
cp files/profiles.json.example files/profiles.json
|
||||
print_success "Created files/profiles.json"
|
||||
fi
|
||||
|
||||
print_warning "Note: You may need to customize these files for your environment"
|
||||
}
|
||||
|
||||
# Check SSH keys
|
||||
check_ssh_keys() {
|
||||
print_info "Checking SSH keys..."
|
||||
|
||||
local key_files=("rpi-master.pem" "rpi-worker-1.pem" "rpi-worker-2.pem" "rpi-worker-3.pem")
|
||||
local missing_keys=()
|
||||
|
||||
for key in "${key_files[@]}"; do
|
||||
if [ ! -f "files/$key" ]; then
|
||||
missing_keys+=("$key")
|
||||
else
|
||||
# Check permissions
|
||||
if [ "$(stat -c %a "files/$key" 2>/dev/null || stat -f %A "files/$key" 2>/dev/null)" != "600" ]; then
|
||||
print_warning "Fixing permissions for files/$key"
|
||||
chmod 600 "files/$key"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#missing_keys[@]} -gt 0 ]; then
|
||||
print_warning "Some SSH key files are missing:"
|
||||
for key in "${missing_keys[@]}"; do
|
||||
echo " - files/$key"
|
||||
done
|
||||
echo ""
|
||||
print_info "If you don't have SSH keys yet, the container will still start with local monitoring."
|
||||
print_info "You can add keys later and restart the container."
|
||||
else
|
||||
print_success "All SSH key files found"
|
||||
fi
|
||||
}
|
||||
|
||||
# Build the Docker image
|
||||
build_image() {
|
||||
print_header "Building Docker Image"
|
||||
|
||||
print_info "This may take several minutes on first build..."
|
||||
if $DOCKER_COMPOSE build; then
|
||||
print_success "Docker image built successfully"
|
||||
else
|
||||
print_error "Failed to build Docker image"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Start the container
|
||||
start_container() {
|
||||
print_header "Starting Container"
|
||||
|
||||
if $DOCKER_COMPOSE up -d; then
|
||||
print_success "Container started successfully"
|
||||
echo ""
|
||||
print_info "Waiting for services to be ready..."
|
||||
sleep 5
|
||||
|
||||
# Check if container is running
|
||||
if docker ps | grep -q socktop-webterm; then
|
||||
print_success "Container is running"
|
||||
else
|
||||
print_error "Container failed to start. Check logs with:"
|
||||
echo " $DOCKER_COMPOSE logs"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_error "Failed to start container"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Show container status
|
||||
show_status() {
|
||||
print_header "Container Status"
|
||||
|
||||
# Show running containers
|
||||
print_info "Running containers:"
|
||||
docker ps --filter name=socktop-webterm --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
|
||||
|
||||
echo ""
|
||||
|
||||
# Show recent logs
|
||||
print_info "Recent logs (last 20 lines):"
|
||||
$DOCKER_COMPOSE logs --tail=20
|
||||
}
|
||||
|
||||
# Show access information
|
||||
show_access_info() {
|
||||
print_header "Access Information"
|
||||
|
||||
echo -e "${GREEN}✓ socktop webterm is ready!${NC}"
|
||||
echo ""
|
||||
echo " 🌐 Web Interface: http://localhost:8082"
|
||||
echo " 📊 Features:"
|
||||
echo " - Beautiful Catppuccin Frappe theme"
|
||||
echo " - Transparent terminal window"
|
||||
echo " - Auto-running socktop -P local"
|
||||
echo " - GitHub, Crates.io, APT links"
|
||||
echo ""
|
||||
echo " 📝 Useful commands:"
|
||||
echo " View logs: $DOCKER_COMPOSE logs -f"
|
||||
echo " Stop container: $DOCKER_COMPOSE down"
|
||||
echo " Restart: $DOCKER_COMPOSE restart"
|
||||
echo " Shell access: docker exec -it socktop-webterm bash"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Show help menu
|
||||
show_help() {
|
||||
echo "socktop webterm Docker Quick Start Script"
|
||||
echo ""
|
||||
echo "Usage: $0 [COMMAND]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " start - Build and start the container (default)"
|
||||
echo " stop - Stop the container"
|
||||
echo " restart - Restart the container"
|
||||
echo " rebuild - Rebuild the image from scratch"
|
||||
echo " logs - Show container logs"
|
||||
echo " shell - Open a shell in the container"
|
||||
echo " status - Show container status"
|
||||
echo " clean - Stop and remove container and volumes"
|
||||
echo " help - Show this help message"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Stop container
|
||||
stop_container() {
|
||||
print_header "Stopping Container"
|
||||
|
||||
if $DOCKER_COMPOSE down; then
|
||||
print_success "Container stopped"
|
||||
else
|
||||
print_error "Failed to stop container"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Restart container
|
||||
restart_container() {
|
||||
print_header "Restarting Container"
|
||||
|
||||
if $DOCKER_COMPOSE restart; then
|
||||
print_success "Container restarted"
|
||||
else
|
||||
print_error "Failed to restart container"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Rebuild image
|
||||
rebuild_image() {
|
||||
print_header "Rebuilding Image"
|
||||
|
||||
print_info "Stopping container..."
|
||||
$DOCKER_COMPOSE down
|
||||
|
||||
print_info "Removing old image..."
|
||||
docker rmi socktop-webterm:latest 2>/dev/null || true
|
||||
|
||||
print_info "Building new image (no cache)..."
|
||||
if $DOCKER_COMPOSE build --no-cache; then
|
||||
print_success "Image rebuilt successfully"
|
||||
|
||||
read -p "Start the container now? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
start_container
|
||||
show_access_info
|
||||
fi
|
||||
else
|
||||
print_error "Failed to rebuild image"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Show logs
|
||||
show_logs() {
|
||||
print_header "Container Logs"
|
||||
|
||||
print_info "Showing logs (Ctrl+C to exit)..."
|
||||
$DOCKER_COMPOSE logs -f
|
||||
}
|
||||
|
||||
# Open shell
|
||||
open_shell() {
|
||||
print_header "Container Shell"
|
||||
|
||||
print_info "Opening bash shell in container..."
|
||||
docker exec -it socktop-webterm bash
|
||||
}
|
||||
|
||||
# Clean everything
|
||||
clean_all() {
|
||||
print_header "Cleaning Up"
|
||||
|
||||
print_warning "This will remove the container and all volumes!"
|
||||
read -p "Are you sure? (y/n) " -n 1 -r
|
||||
echo
|
||||
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
print_info "Stopping and removing container..."
|
||||
$DOCKER_COMPOSE down -v
|
||||
|
||||
print_info "Removing image..."
|
||||
docker rmi socktop-webterm:latest 2>/dev/null || true
|
||||
|
||||
print_success "Cleanup complete"
|
||||
else
|
||||
print_info "Cleanup cancelled"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
# Parse command
|
||||
COMMAND=${1:-start}
|
||||
|
||||
case $COMMAND in
|
||||
start)
|
||||
print_header "socktop webterm - Quick Start"
|
||||
check_docker
|
||||
check_config_files
|
||||
check_ssh_keys
|
||||
build_image
|
||||
start_container
|
||||
show_status
|
||||
show_access_info
|
||||
;;
|
||||
stop)
|
||||
check_docker
|
||||
stop_container
|
||||
;;
|
||||
restart)
|
||||
check_docker
|
||||
restart_container
|
||||
;;
|
||||
rebuild)
|
||||
check_docker
|
||||
rebuild_image
|
||||
;;
|
||||
logs)
|
||||
check_docker
|
||||
show_logs
|
||||
;;
|
||||
shell)
|
||||
check_docker
|
||||
open_shell
|
||||
;;
|
||||
status)
|
||||
check_docker
|
||||
show_status
|
||||
;;
|
||||
clean)
|
||||
check_docker
|
||||
clean_all
|
||||
;;
|
||||
help|--help|-h)
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown command: $COMMAND"
|
||||
echo ""
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Run main function
|
||||
main "$@"
|
||||
@ -1,146 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
GITEA_HOST="192.168.1.208:3002"
|
||||
IMAGE_NAME="socktop-webterm"
|
||||
CARGO_TOML="Cargo.toml"
|
||||
|
||||
echo -e "${GREEN}=== Socktop WebTerm - Multi-Architecture Build & Publish ===${NC}"
|
||||
echo ""
|
||||
echo "This script builds for both AMD64 (x86_64) and ARM64 (Raspberry Pi)"
|
||||
echo ""
|
||||
|
||||
# Check if buildx is available
|
||||
if ! docker buildx version &> /dev/null; then
|
||||
echo -e "${RED}Error: docker buildx is not available${NC}"
|
||||
echo ""
|
||||
echo "Install buildx:"
|
||||
echo " Docker Desktop: Already included"
|
||||
echo " Docker Engine: https://docs.docker.com/buildx/working-with-buildx/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Docker buildx is available${NC}"
|
||||
echo ""
|
||||
|
||||
# Extract version from Cargo.toml
|
||||
if [ ! -f "$CARGO_TOML" ]; then
|
||||
echo -e "${RED}Error: Cargo.toml not found!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(grep '^version = ' "$CARGO_TOML" | head -1 | sed 's/version = "\(.*\)"/\1/')
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo -e "${RED}Error: Could not extract version from Cargo.toml${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}Version detected:${NC} $VERSION"
|
||||
echo -e "${YELLOW}Gitea Host:${NC} $GITEA_HOST"
|
||||
echo ""
|
||||
|
||||
# Prompt for Gitea username
|
||||
read -p "Enter Gitea username: " GITEA_USER
|
||||
|
||||
if [ -z "$GITEA_USER" ]; then
|
||||
echo -e "${RED}Error: Username cannot be empty${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Prompt for Gitea password (hidden input)
|
||||
read -s -p "Enter Gitea password: " GITEA_PASSWORD
|
||||
echo ""
|
||||
|
||||
if [ -z "$GITEA_PASSWORD" ]; then
|
||||
echo -e "${RED}Error: Password cannot be empty${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Docker login to Gitea registry
|
||||
echo -e "${YELLOW}Logging in to Gitea Docker registry...${NC}"
|
||||
echo "$GITEA_PASSWORD" | docker login "$GITEA_HOST" -u "$GITEA_USER" --password-stdin
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Error: Docker login failed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Login successful${NC}"
|
||||
echo ""
|
||||
|
||||
# Create or use existing buildx builder
|
||||
BUILDER_NAME="multiarch-builder"
|
||||
echo -e "${YELLOW}Setting up buildx builder...${NC}"
|
||||
|
||||
if ! docker buildx inspect "$BUILDER_NAME" &> /dev/null; then
|
||||
echo "Creating new buildx builder: $BUILDER_NAME"
|
||||
docker buildx create --name "$BUILDER_NAME" --use
|
||||
else
|
||||
echo "Using existing buildx builder: $BUILDER_NAME"
|
||||
docker buildx use "$BUILDER_NAME"
|
||||
fi
|
||||
|
||||
# Bootstrap the builder
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
echo -e "${GREEN}✓ Builder ready${NC}"
|
||||
echo ""
|
||||
|
||||
# Build and push multi-architecture image
|
||||
echo -e "${YELLOW}Building multi-architecture image...${NC}"
|
||||
echo "Target platforms: linux/amd64, linux/arm64"
|
||||
echo ""
|
||||
echo "This will take several minutes as it builds for both architectures..."
|
||||
echo ""
|
||||
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--tag "${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}" \
|
||||
--tag "${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:latest" \
|
||||
--push \
|
||||
.
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Error: Build failed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}✓ Build and push successful${NC}"
|
||||
echo ""
|
||||
|
||||
# Summary
|
||||
echo -e "${GREEN}=== Publication Complete ===${NC}"
|
||||
echo ""
|
||||
echo "Multi-architecture images published to Gitea registry:"
|
||||
echo -e " ${GREEN}${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}${NC}"
|
||||
echo -e " ${GREEN}${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:latest${NC}"
|
||||
echo ""
|
||||
echo "Architectures:"
|
||||
echo " - linux/amd64 (x86_64)"
|
||||
echo " - linux/arm64 (Raspberry Pi, ARM servers)"
|
||||
echo ""
|
||||
echo "To pull on your k3s cluster (will automatically use correct architecture):"
|
||||
echo -e " ${YELLOW}docker pull ${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}${NC}"
|
||||
echo -e " ${YELLOW}docker pull ${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:latest${NC}"
|
||||
echo ""
|
||||
echo "For Kubernetes, use image:"
|
||||
echo -e " ${YELLOW}image: ${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}${NC}"
|
||||
echo ""
|
||||
|
||||
# Logout
|
||||
echo -e "${YELLOW}Logging out from Gitea registry...${NC}"
|
||||
docker logout "$GITEA_HOST"
|
||||
echo -e "${GREEN}✓ Logged out${NC}"
|
||||
echo ""
|
||||
echo -e "${GREEN}Done!${NC}"
|
||||
@ -1,131 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
GITEA_HOST="192.168.1.208:3002"
|
||||
IMAGE_NAME="socktop-webterm"
|
||||
CARGO_TOML="Cargo.toml"
|
||||
|
||||
echo -e "${GREEN}=== Socktop WebTerm - Gitea Docker Registry Publisher ===${NC}"
|
||||
echo ""
|
||||
|
||||
# Extract version from Cargo.toml
|
||||
if [ ! -f "$CARGO_TOML" ]; then
|
||||
echo -e "${RED}Error: Cargo.toml not found!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(grep '^version = ' "$CARGO_TOML" | head -1 | sed 's/version = "\(.*\)"/\1/')
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo -e "${RED}Error: Could not extract version from Cargo.toml${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}Version detected:${NC} $VERSION"
|
||||
echo -e "${YELLOW}Gitea Host:${NC} $GITEA_HOST"
|
||||
echo ""
|
||||
|
||||
# Prompt for Gitea username
|
||||
read -p "Enter Gitea username: " GITEA_USER
|
||||
|
||||
if [ -z "$GITEA_USER" ]; then
|
||||
echo -e "${RED}Error: Username cannot be empty${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Prompt for Gitea password (hidden input)
|
||||
read -s -p "Enter Gitea password: " GITEA_PASSWORD
|
||||
echo ""
|
||||
|
||||
if [ -z "$GITEA_PASSWORD" ]; then
|
||||
echo -e "${RED}Error: Password cannot be empty${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Docker login to Gitea registry
|
||||
echo -e "${YELLOW}Logging in to Gitea Docker registry...${NC}"
|
||||
echo "$GITEA_PASSWORD" | docker login "$GITEA_HOST" -u "$GITEA_USER" --password-stdin
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Error: Docker login failed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Login successful${NC}"
|
||||
echo ""
|
||||
|
||||
# Build the Docker image
|
||||
echo -e "${YELLOW}Building Docker image...${NC}"
|
||||
docker build -t "${IMAGE_NAME}:${VERSION}" -t "${IMAGE_NAME}:latest" .
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Error: Docker build failed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Build successful${NC}"
|
||||
echo ""
|
||||
|
||||
# Tag images for Gitea registry
|
||||
echo -e "${YELLOW}Tagging images for Gitea registry...${NC}"
|
||||
docker tag "${IMAGE_NAME}:${VERSION}" "${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}"
|
||||
docker tag "${IMAGE_NAME}:latest" "${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:latest"
|
||||
|
||||
echo -e "${GREEN}✓ Tagged: ${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}${NC}"
|
||||
echo -e "${GREEN}✓ Tagged: ${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:latest${NC}"
|
||||
echo ""
|
||||
|
||||
# Push version tag
|
||||
echo -e "${YELLOW}Pushing version ${VERSION} to registry...${NC}"
|
||||
docker push "${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Error: Failed to push version tag${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Pushed version ${VERSION}${NC}"
|
||||
echo ""
|
||||
|
||||
# Push latest tag
|
||||
echo -e "${YELLOW}Pushing 'latest' tag to registry...${NC}"
|
||||
docker push "${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:latest"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}Error: Failed to push latest tag${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Pushed 'latest' tag${NC}"
|
||||
echo ""
|
||||
|
||||
# Summary
|
||||
echo -e "${GREEN}=== Publication Complete ===${NC}"
|
||||
echo ""
|
||||
echo "Images published to Gitea registry:"
|
||||
echo -e " ${GREEN}${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}${NC}"
|
||||
echo -e " ${GREEN}${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:latest${NC}"
|
||||
echo ""
|
||||
echo "To pull on your k3s cluster or CasaOS:"
|
||||
echo -e " ${YELLOW}docker pull ${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}${NC}"
|
||||
echo -e " ${YELLOW}docker pull ${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:latest${NC}"
|
||||
echo ""
|
||||
echo "For Kubernetes, use image:"
|
||||
echo -e " ${YELLOW}image: ${GITEA_HOST}/${GITEA_USER}/${IMAGE_NAME}:${VERSION}${NC}"
|
||||
echo ""
|
||||
|
||||
# Logout
|
||||
echo -e "${YELLOW}Logging out from Gitea registry...${NC}"
|
||||
docker logout "$GITEA_HOST"
|
||||
echo -e "${GREEN}✓ Logged out${NC}"
|
||||
echo ""
|
||||
echo -e "${GREEN}Done!${NC}"
|
||||
@ -149,14 +149,21 @@
|
||||
<!-- Footer -->
|
||||
<footer class="site-footer">
|
||||
<p>
|
||||
Built with
|
||||
Site Built with
|
||||
<a
|
||||
href="https://xtermjs.org/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>xterm.js</a
|
||||
>
|
||||
and ❤️ | Theme:
|
||||
| Source Code:
|
||||
<a
|
||||
href=https://gt.wittyoneoff.com/jason/socktop-webterm"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>gitea</a
|
||||
>
|
||||
| Theme:
|
||||
<a
|
||||
href="https://github.com/catppuccin/catppuccin"
|
||||
target="_blank"
|
||||
|
||||
@ -1,194 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# xterm.js Upgrade Verification Script
|
||||
# This script verifies that the upgrade to xterm.js 5.x was successful
|
||||
|
||||
set -e
|
||||
|
||||
echo "=========================================="
|
||||
echo "xterm.js Upgrade Verification"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Color codes
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Track overall status
|
||||
FAILED=0
|
||||
|
||||
# Function to check if a file exists
|
||||
check_file() {
|
||||
if [ -f "$1" ]; then
|
||||
echo -e "${GREEN}✓${NC} $1 exists"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗${NC} $1 NOT FOUND"
|
||||
FAILED=1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to check if a directory exists
|
||||
check_dir() {
|
||||
if [ -d "$1" ]; then
|
||||
echo -e "${GREEN}✓${NC} $1 exists"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗${NC} $1 NOT FOUND"
|
||||
FAILED=1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to check package version
|
||||
check_version() {
|
||||
local package=$1
|
||||
local expected=$2
|
||||
|
||||
if [ -f "node_modules/$package/package.json" ]; then
|
||||
local version=$(grep '"version"' "node_modules/$package/package.json" | head -1 | sed 's/.*"\([0-9.]*\)".*/\1/')
|
||||
echo -e "${GREEN}✓${NC} $package version: $version"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗${NC} $package NOT INSTALLED"
|
||||
FAILED=1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "1. Checking npm packages..."
|
||||
echo "----------------------------"
|
||||
check_dir "node_modules/@xterm/xterm"
|
||||
check_dir "node_modules/@xterm/addon-fit"
|
||||
check_version "@xterm/xterm" "5.x"
|
||||
check_version "@xterm/addon-fit" "0.x"
|
||||
echo ""
|
||||
|
||||
echo "2. Checking xterm.js files..."
|
||||
echo "----------------------------"
|
||||
check_file "node_modules/@xterm/xterm/lib/xterm.js"
|
||||
check_file "node_modules/@xterm/xterm/css/xterm.css"
|
||||
check_file "node_modules/@xterm/addon-fit/lib/addon-fit.js"
|
||||
echo ""
|
||||
|
||||
echo "3. Checking custom files..."
|
||||
echo "----------------------------"
|
||||
check_file "static/terminado-addon.js"
|
||||
check_file "node_modules/terminado-addon.js"
|
||||
check_file "templates/term.html"
|
||||
echo ""
|
||||
|
||||
echo "4. Checking documentation..."
|
||||
echo "----------------------------"
|
||||
check_file "XTERM_UPGRADE.md"
|
||||
check_file "UPGRADE_SUMMARY.md"
|
||||
check_file "test_xterm.html"
|
||||
echo ""
|
||||
|
||||
echo "5. Verifying HTML template..."
|
||||
echo "----------------------------"
|
||||
if grep -q "@xterm/xterm/lib/xterm.js" templates/term.html; then
|
||||
echo -e "${GREEN}✓${NC} HTML uses new xterm path"
|
||||
else
|
||||
echo -e "${RED}✗${NC} HTML still using old xterm path"
|
||||
FAILED=1
|
||||
fi
|
||||
|
||||
if grep -q "FitAddon.FitAddon" templates/term.html; then
|
||||
echo -e "${GREEN}✓${NC} HTML uses new FitAddon API"
|
||||
else
|
||||
echo -e "${RED}✗${NC} HTML still using old addon API"
|
||||
FAILED=1
|
||||
fi
|
||||
|
||||
if grep -q "TerminadoAddon" templates/term.html; then
|
||||
echo -e "${GREEN}✓${NC} HTML references TerminadoAddon"
|
||||
else
|
||||
echo -e "${RED}✗${NC} HTML missing TerminadoAddon reference"
|
||||
FAILED=1
|
||||
fi
|
||||
|
||||
if grep -q "loadAddon" templates/term.html; then
|
||||
echo -e "${GREEN}✓${NC} HTML uses loadAddon() method"
|
||||
else
|
||||
echo -e "${RED}✗${NC} HTML still using applyAddon()"
|
||||
FAILED=1
|
||||
fi
|
||||
|
||||
if grep -q "applyAddon" templates/term.html; then
|
||||
echo -e "${YELLOW}⚠${NC} HTML contains legacy applyAddon reference (might be in comments)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "6. Checking package.json..."
|
||||
echo "----------------------------"
|
||||
if grep -q '"@xterm/xterm"' package.json; then
|
||||
echo -e "${GREEN}✓${NC} package.json has @xterm/xterm"
|
||||
else
|
||||
echo -e "${RED}✗${NC} package.json missing @xterm/xterm"
|
||||
FAILED=1
|
||||
fi
|
||||
|
||||
if grep -q '"@xterm/addon-fit"' package.json; then
|
||||
echo -e "${GREEN}✓${NC} package.json has @xterm/addon-fit"
|
||||
else
|
||||
echo -e "${RED}✗${NC} package.json missing @xterm/addon-fit"
|
||||
FAILED=1
|
||||
fi
|
||||
|
||||
if grep -q '"xterm":' package.json; then
|
||||
echo -e "${YELLOW}⚠${NC} package.json still has old 'xterm' package"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "7. Checking Rust build..."
|
||||
echo "----------------------------"
|
||||
if command -v cargo &> /dev/null; then
|
||||
echo -e "${GREEN}✓${NC} cargo is installed"
|
||||
|
||||
if cargo check --quiet 2>&1 | grep -q "error"; then
|
||||
echo -e "${RED}✗${NC} Rust code has errors"
|
||||
FAILED=1
|
||||
else
|
||||
echo -e "${GREEN}✓${NC} Rust code compiles successfully"
|
||||
fi
|
||||
else
|
||||
echo -e "${YELLOW}⚠${NC} cargo not found, skipping Rust check"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "8. Checking static assets route..."
|
||||
echo "----------------------------"
|
||||
if grep -q 'Files::new("/assets", "./static")' src/server.rs; then
|
||||
echo -e "${GREEN}✓${NC} /assets route configured for static folder"
|
||||
else
|
||||
echo -e "${YELLOW}⚠${NC} /assets route not found (custom assets may not load)"
|
||||
fi
|
||||
|
||||
if [ -f "static/bg.png" ]; then
|
||||
echo -e "${GREEN}✓${NC} Background image exists"
|
||||
else
|
||||
echo -e "${YELLOW}⚠${NC} No background image found (optional)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "=========================================="
|
||||
if [ $FAILED -eq 0 ]; then
|
||||
echo -e "${GREEN}✓ All checks passed!${NC}"
|
||||
echo ""
|
||||
echo "The xterm.js upgrade is complete and verified."
|
||||
echo "You can now run: cargo run"
|
||||
echo "Then open: http://localhost:8082/"
|
||||
echo "=========================================="
|
||||
exit 0
|
||||
else
|
||||
echo -e "${RED}✗ Some checks failed!${NC}"
|
||||
echo ""
|
||||
echo "Please review the errors above and fix them."
|
||||
echo "Refer to XTERM_UPGRADE.md for detailed instructions."
|
||||
echo "=========================================="
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user